startup.sh 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. set -e
  19. echo "start postgresql service"
  20. /etc/init.d/postgresql restart
  21. echo "create user and init db"
  22. sudo -u postgres psql <<'ENDSSH'
  23. create user root with password 'root@123';
  24. create database dolphinscheduler owner root;
  25. grant all privileges on database dolphinscheduler to root;
  26. \q
  27. ENDSSH
  28. echo "import sql data"
  29. /opt/dolphinscheduler/script/create-dolphinscheduler.sh
  30. /opt/zookeeper/bin/zkServer.sh restart
  31. sleep 90
  32. echo "start api-server"
  33. /opt/dolphinscheduler/bin/dolphinscheduler-daemon.sh stop api-server
  34. /opt/dolphinscheduler/bin/dolphinscheduler-daemon.sh start api-server
  35. echo "start master-server"
  36. /opt/dolphinscheduler/bin/dolphinscheduler-daemon.sh stop master-server
  37. python /opt/dolphinscheduler/script/del-zk-node.py 127.0.0.1 /dolphinscheduler/masters
  38. /opt/dolphinscheduler/bin/dolphinscheduler-daemon.sh start master-server
  39. echo "start worker-server"
  40. /opt/dolphinscheduler/bin/dolphinscheduler-daemon.sh stop worker-server
  41. python /opt/dolphinscheduler/script/del-zk-node.py 127.0.0.1 /dolphinscheduler/workers
  42. /opt/dolphinscheduler/bin/dolphinscheduler-daemon.sh start worker-server
  43. echo "start logger-server"
  44. /opt/dolphinscheduler/bin/dolphinscheduler-daemon.sh stop logger-server
  45. /opt/dolphinscheduler/bin/dolphinscheduler-daemon.sh start logger-server
  46. echo "start alert-server"
  47. /opt/dolphinscheduler/bin/dolphinscheduler-daemon.sh stop alert-server
  48. /opt/dolphinscheduler/bin/dolphinscheduler-daemon.sh start alert-server
  49. echo "start nginx"
  50. /etc/init.d/nginx stop
  51. nginx &
  52. while true
  53. do
  54. sleep 101
  55. done
  56. exec "$@"