This commit is contained in:
wangchuxiao
2022-09-12 19:32:24 +08:00
parent 692cebe659
commit ef66b10501
30 changed files with 275 additions and 44 deletions
Regular → Executable
+6 -3
View File
@@ -7,13 +7,16 @@ ulimit -n 200000
list1=$(cat $config_path | grep openImMessageGatewayPort | awk -F '[:]' '{print $NF}')
list2=$(cat $config_path | grep openImWsPort | awk -F '[:]' '{print $NF}')
list3=$(cat $config_path | grep messageGatewayPrometheusPort | awk -F '[:]' '{print $NF}')
list_to_string $list1
rpc_ports=($ports_array)
list_to_string $list2
ws_ports=($ports_array)
if [ ${#rpc_ports[@]} -ne ${#ws_ports[@]} ]; then
list_to_string $list3
prome_ports=($ports_array)
if [ ${#rpc_ports[@]} -ne ${#ws_ports[@]} -ne ${#prome_ports[@]} ]; then
echo -e ${RED_PREFIX}"ws_ports does not match push_rpc_ports in quantity!!!"${COLOR_SUFFIX}
echo -e ${RED_PREFIX}"ws_ports does not match push_rpc_ports or prome_ports in quantity!!!"${COLOR_SUFFIX}
exit -1
fi
@@ -28,7 +31,7 @@ fi
sleep 1
cd ${msg_gateway_binary_root}
for ((i = 0; i < ${#ws_ports[@]}; i++)); do
nohup ./${msg_gateway_name} -rpc_port ${rpc_ports[$i]} -ws_port ${ws_ports[$i]} >>../logs/openIM.log 2>&1 &
nohup ./${msg_gateway_name} -rpc_port ${rpc_ports[$i]} -ws_port ${ws_ports[$i]} -prometheus_port ${prome_ports[$i]} >>../logs/openIM.log 2>&1 &
done
#Check launched service process
Regular → Executable
+3 -1
View File
@@ -3,6 +3,8 @@
source ./style_info.cfg
source ./path_info.cfg
list1=$(cat $config_path | grep messageTransferPrometheusPort | awk -F '[:]' '{print $NF}')
prome_ports=($ports_array)
#Check if the service exists
@@ -18,7 +20,7 @@ sleep 1
cd ${msg_transfer_binary_root}
for ((i = 0; i < ${msg_transfer_service_num}; i++)); do
nohup ./${msg_transfer_name} >>../logs/openIM.log 2>&1 &
nohup ./${msg_transfer_name} -prometheus_port ${prome_ports[$i]} >>../logs/openIM.log 2>&1 &
done
#Check launched service process
+4 -1
View File
@@ -7,8 +7,11 @@ source ./function.sh
list1=$(cat $config_path | grep openImPushPort | awk -F '[:]' '{print $NF}')
list2=$(cat $config_path | grep pushPrometheusPort | awk -F '[:]' '{print $NF}')
list_to_string $list1
rpc_ports=($ports_array)
list_to_string $list2
prome_ports=($ports_array)
#Check if the service exists
#If it is exists,kill this process
@@ -22,7 +25,7 @@ sleep 1
cd ${push_binary_root}
for ((i = 0; i < ${#rpc_ports[@]}; i++)); do
nohup ./${push_name} -port ${rpc_ports[$i]} >>../logs/openIM.log 2>&1 &
nohup ./${push_name} -port ${rpc_ports[$i]} -prometheus_port ${prome_ports[$i]} >>../logs/openIM.log 2>&1 &
done
sleep 3
+24 -2
View File
@@ -40,6 +40,23 @@ service_port_name=(
openImCachePort
)
service_prometheus_port_name=(
#api port name
openImApiPort
openImCmsApiPort
#rpc port name
userPrometheusPort
friendPrometheusPort
groupPrometheusPort
authPrometheusPort
adminCmsPrometheusPort
messagePrometheusPort
officePrometheusPort
organizationPrometheusPort
conversationPrometheusPort
cachePrometheusPort
)
for ((i = 0; i < ${#service_filename[*]}; i++)); do
#Check whether the service exists
service_name="ps -aux |grep -w ${service_filename[$i]} |grep -v grep"
@@ -57,11 +74,16 @@ for ((i = 0; i < ${#service_filename[*]}; i++)); do
#Get the rpc port in the configuration file
portList=$(cat $config_path | grep ${service_port_name[$i]} | awk -F '[:]' '{print $NF}')
list_to_string ${portList}
service_ports=($ports_array)
portList2=$(cat $config_path | grep pushPrometheusPort | awk -F '[:]' '{print $NF}')
list_to_string $portList2
prome_ports=($ports_array)
#Start related rpc services based on the number of ports
for j in ${ports_array}; do
for j in ${service_ports}; do
#Start the service in the background
# ./${service_filename[$i]} -port $j &
nohup ./${service_filename[$i]} -port $j >>../logs/openIM.log 2>&1 &
nohup ./${service_filename[$i]} -port $j -prometheus_port ${prome_ports[$i]} >>../logs/openIM.log 2>&1 &
sleep 1
pid="netstat -ntlp|grep $j |awk '{printf \$7}'|cut -d/ -f1"
echo -e "${GREEN_PREFIX}${service_filename[$i]} start success,port number:$j pid:$(eval $pid)$COLOR_SUFFIX"