status-all.sh 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #!/bin/bash
  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. workersGroup=(${workers//,/ })
  36. for workerGroup in ${workersGroup[@]}
  37. do
  38. worker=`echo $workerGroup|awk -F':' '{print $1}'`
  39. groupName=`echo $workerGroup|awk -F':' '{print $2}'`
  40. workersGroupMap+=([$worker]=$groupName)
  41. done
  42. StateRunning="Running"
  43. # 1.master server check state
  44. mastersHost=(${masters//,/ })
  45. for master in ${mastersHost[@]}
  46. do
  47. masterState=`ssh -p $sshPort $master "cd $installPath/; bash bin/dolphinscheduler-daemon.sh status master-server;"`
  48. echo "$master $masterState"
  49. done
  50. # 2.worker server check state
  51. for worker in ${!workersGroupMap[*]}
  52. do
  53. workerState=`ssh -p $sshPort $worker "cd $installPath/; bash bin/dolphinscheduler-daemon.sh status worker-server;"`
  54. echo "$worker $workerState"
  55. done
  56. # 3.alter server check state
  57. alertState=`ssh -p $sshPort $alertServer "cd $installPath/; bash bin/dolphinscheduler-daemon.sh status alert-server;"`
  58. echo "$alertServer $alertState"
  59. # 4.api server check state
  60. apiServersHost=(${apiServers//,/ })
  61. for apiServer in ${apiServersHost[@]}
  62. do
  63. apiState=`ssh -p $sshPort $apiServer "cd $installPath/; bash bin/dolphinscheduler-daemon.sh status api-server;"`
  64. echo "$apiServer $apiState"
  65. done