status-all.sh 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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/../conf/config/install_config.conf
  21. # install_config.conf 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. declare -A 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 and logger-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. masterState=`ssh -p $sshPort $worker "cd $installPath/; sh bin/dolphinscheduler-daemon.sh status logger-server;"`
  57. echo "$worker $masterState"
  58. done
  59. # 3.alter server check state
  60. alertState=`ssh -p $sshPort $alertServer "cd $installPath/; sh bin/dolphinscheduler-daemon.sh status alert-server;"`
  61. echo "$alertServer $alertState"
  62. # 4.api server check state
  63. apiServersHost=(${apiServers//,/ })
  64. for apiServer in ${apiServersHost[@]}
  65. do
  66. apiState=`ssh -p $sshPort $apiServer "cd $installPath/; sh bin/dolphinscheduler-daemon.sh status api-server;"`
  67. echo "$apiServer $apiState"
  68. done