status-all.sh 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #!/bin/sh
  2. #
  3. # Licensed to the Apache Software Foundation (ASF) under one or more
  4. # contributor license agreements. See the NOTICE file distributed with
  5. # this work for additional information regarding copyright ownership.
  6. # The ASF licenses this file to You under the Apache License, Version 2.0
  7. # (the "License"); you may not use this file except in compliance with
  8. # the License. You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. #
  18. workDir=`dirname $0`
  19. workDir=`cd ${workDir};pwd`
  20. source ${workDir}/env/install_env.sh
  21. # install_env.sh info
  22. echo -e '\n'
  23. echo "====================== dolphinscheduler server config ============================="
  24. echo -e "1.dolphinscheduler server node config hosts:[ \033[1;32m ${ips} \033[0m ]"
  25. echo -e "2.master server node config hosts:[ \033[1;32m ${masters} \033[0m ]"
  26. echo -e "3.worker server node config hosts:[ \033[1;32m ${workers} \033[0m ]"
  27. echo -e "4.alert server node config hosts:[ \033[1;32m ${alertServer} \033[0m ]"
  28. echo -e "5.api server node config hosts:[ \033[1;32m ${apiServers} \033[0m ]"
  29. # all server check state
  30. echo -e '\n'
  31. echo "====================== dolphinscheduler server status ============================="
  32. firstColumn="node server state"
  33. echo $firstColumn
  34. echo -e '\n'
  35. workersGroupMap=()
  36. workersGroup=(${workers//,/ })
  37. for workerGroup in ${workersGroup[@]}
  38. do
  39. worker=`echo $workerGroup|awk -F':' '{print $1}'`
  40. groupName=`echo $workerGroup|awk -F':' '{print $2}'`
  41. workersGroupMap+=([$worker]=$groupName)
  42. done
  43. StateRunning="Running"
  44. # 1.master server check state
  45. mastersHost=(${masters//,/ })
  46. for master in ${mastersHost[@]}
  47. do
  48. masterState=`ssh -p $sshPort $master "cd $installPath/; sh bin/dolphinscheduler-daemon.sh status master-server;"`
  49. echo "$master $masterState"
  50. done
  51. # 2.worker server check state
  52. for worker in ${!workersGroupMap[*]}
  53. do
  54. workerState=`ssh -p $sshPort $worker "cd $installPath/; sh bin/dolphinscheduler-daemon.sh status worker-server;"`
  55. echo "$worker $workerState"
  56. done
  57. # 3.alter server check state
  58. alertState=`ssh -p $sshPort $alertServer "cd $installPath/; sh bin/dolphinscheduler-daemon.sh status alert-server;"`
  59. echo "$alertServer $alertState"
  60. # 4.api server check state
  61. apiServersHost=(${apiServers//,/ })
  62. for apiServer in ${apiServersHost[@]}
  63. do
  64. apiState=`ssh -p $sshPort $apiServer "cd $installPath/; sh bin/dolphinscheduler-daemon.sh status api-server;"`
  65. echo "$apiServer $apiState"
  66. done
  67. # python gateway server check state
  68. pythonGatewayHost=(${pythonGatewayServers//,/ })
  69. for pythonGatewayServer in "${pythonGatewayHost[@]}"
  70. do
  71. pythonGatewayState=`ssh -p $sshPort $pythonGatewayServer "cd $installPath/; sh bin/dolphinscheduler-daemon.sh status python-gateway-server;"`
  72. echo "$pythonGatewayServer $pythonGatewayState"
  73. done