startup-init-conf.sh 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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 "init env variables"
  20. # Define parameters default value
  21. #============================================================================
  22. # Database Source
  23. #============================================================================
  24. export DATABASE_HOST=${DATABASE_HOST:-"127.0.0.1"}
  25. export DATABASE_PORT=${DATABASE_PORT:-"5432"}
  26. export DATABASE_USERNAME=${DATABASE_USERNAME:-"root"}
  27. export DATABASE_PASSWORD=${DATABASE_PASSWORD:-"root"}
  28. export DATABASE_DATABASE=${DATABASE_DATABASE:-"dolphinscheduler"}
  29. export DATABASE_TYPE=${DATABASE_TYPE:-"postgresql"}
  30. export DATABASE_DRIVER=${DATABASE_DRIVER:-"org.postgresql.Driver"}
  31. export DATABASE_PARAMS=${DATABASE_PARAMS:-"characterEncoding=utf8"}
  32. #============================================================================
  33. # Common
  34. #============================================================================
  35. # dolphinscheduler env
  36. export HADOOP_HOME=${HADOOP_HOME:-"/opt/soft/hadoop"}
  37. export HADOOP_CONF_DIR=${HADOOP_CONF_DIR:-"/opt/soft/hadoop/etc/hadoop"}
  38. export SPARK_HOME1=${SPARK_HOME1:-"/opt/soft/spark1"}
  39. export SPARK_HOME2=${SPARK_HOME2:-"/opt/soft/spark2"}
  40. export PYTHON_HOME=${PYTHON_HOME:-"/usr/bin/python"}
  41. export JAVA_HOME=${JAVA_HOME:-"/usr/lib/jvm/java-1.8-openjdk"}
  42. export HIVE_HOME=${HIVE_HOME:-"/opt/soft/hive"}
  43. export FLINK_HOME=${FLINK_HOME:-"/opt/soft/flink"}
  44. export DATAX_HOME=${DATAX_HOME:-"/opt/soft/datax/bin/datax.py"}
  45. # common env
  46. export DOLPHINSCHEDULER_DATA_BASEDIR_PATH=${DOLPHINSCHEDULER_DATA_BASEDIR_PATH:-"/tmp/dolphinscheduler"}
  47. export DOLPHINSCHEDULER_OPTS=${DOLPHINSCHEDULER_OPTS:-""}
  48. export RESOURCE_STORAGE_TYPE=${RESOURCE_STORAGE_TYPE:-"HDFS"}
  49. export RESOURCE_UPLOAD_PATH=${RESOURCE_UPLOAD_PATH:-"/dolphinscheduler"}
  50. export FS_DEFAULT_FS=${FS_DEFAULT_FS:-"file:///"}
  51. export FS_S3A_ENDPOINT=${FS_S3A_ENDPOINT:-"s3.xxx.amazonaws.com"}
  52. export FS_S3A_ACCESS_KEY=${FS_S3A_ACCESS_KEY:-"xxxxxxx"}
  53. export FS_S3A_SECRET_KEY=${FS_S3A_SECRET_KEY:-"xxxxxxx"}
  54. #============================================================================
  55. # Zookeeper
  56. #============================================================================
  57. export ZOOKEEPER_QUORUM=${ZOOKEEPER_QUORUM:-"127.0.0.1:2181"}
  58. export ZOOKEEPER_ROOT=${ZOOKEEPER_ROOT:-"/dolphinscheduler"}
  59. #============================================================================
  60. # Master Server
  61. #============================================================================
  62. export MASTER_EXEC_THREADS=${MASTER_EXEC_THREADS:-"100"}
  63. export MASTER_EXEC_TASK_NUM=${MASTER_EXEC_TASK_NUM:-"20"}
  64. export MASTER_HEARTBEAT_INTERVAL=${MASTER_HEARTBEAT_INTERVAL:-"10"}
  65. export MASTER_TASK_COMMIT_RETRYTIMES=${MASTER_TASK_COMMIT_RETRYTIMES:-"5"}
  66. export MASTER_TASK_COMMIT_INTERVAL=${MASTER_TASK_COMMIT_INTERVAL:-"1000"}
  67. export MASTER_MAX_CPULOAD_AVG=${MASTER_MAX_CPULOAD_AVG:-"100"}
  68. export MASTER_RESERVED_MEMORY=${MASTER_RESERVED_MEMORY:-"0.1"}
  69. export MASTER_LISTEN_PORT=${MASTER_LISTEN_PORT:-"5678"}
  70. #============================================================================
  71. # Worker Server
  72. #============================================================================
  73. export WORKER_EXEC_THREADS=${WORKER_EXEC_THREADS:-"100"}
  74. export WORKER_HEARTBEAT_INTERVAL=${WORKER_HEARTBEAT_INTERVAL:-"10"}
  75. export WORKER_MAX_CPULOAD_AVG=${WORKER_MAX_CPULOAD_AVG:-"100"}
  76. export WORKER_RESERVED_MEMORY=${WORKER_RESERVED_MEMORY:-"0.1"}
  77. export WORKER_LISTEN_PORT=${WORKER_LISTEN_PORT:-"1234"}
  78. export WORKER_GROUPS=${WORKER_GROUPS:-"default"}
  79. export WORKER_WEIGHT=${WORKER_WEIGHT:-"100"}
  80. export ALERT_LISTEN_HOST=${ALERT_LISTEN_HOST:-"127.0.0.1"}
  81. #============================================================================
  82. # Alert Server
  83. #============================================================================
  84. export ALERT_PLUGIN_DIR=${ALERT_PLUGIN_DIR:-"lib/plugin/alert"}
  85. echo "generate dolphinscheduler config"
  86. ls ${DOLPHINSCHEDULER_HOME}/conf/ | grep ".tpl" | while read line; do
  87. eval "cat << EOF
  88. $(cat ${DOLPHINSCHEDULER_HOME}/conf/${line})
  89. EOF
  90. " > ${DOLPHINSCHEDULER_HOME}/conf/${line%.*}
  91. done
  92. # generate dolphinscheduler env only in docker
  93. DOLPHINSCHEDULER_ENV_PATH=${DOLPHINSCHEDULER_HOME}/conf/env/dolphinscheduler_env.sh
  94. if [ -z "${KUBERNETES_SERVICE_HOST}" ] && [ -r "${DOLPHINSCHEDULER_ENV_PATH}.tpl" ]; then
  95. eval "cat << EOF
  96. $(cat ${DOLPHINSCHEDULER_ENV_PATH}.tpl)
  97. EOF
  98. " > ${DOLPHINSCHEDULER_ENV_PATH}
  99. chmod +x ${DOLPHINSCHEDULER_ENV_PATH}
  100. fi