2019-03-29 18:30:03 +08:00
#!/bin/sh
2019-03-29 14:37:07 +08:00
2019-03-29 23:20:22 +08:00
workDir = ` dirname $0 `
workDir = ` cd ${ workDir } ; pwd `
2019-03-29 18:30:03 +08:00
2019-03-30 09:42:12 +08:00
#To be compatible with MacOS and Linux
txt = ""
if [ [ " $OSTYPE " = = "darwin" * ] ] ; then
# Mac OSX
txt = "''"
elif [ [ " $OSTYPE " = = "linux-gnu" ] ] ; then
# linux
txt = ""
elif [ [ " $OSTYPE " = = "cygwin" ] ] ; then
# POSIX compatibility layer and Linux environment emulation for Windows
echo "Easy Scheduler not support Windows operating system"
exit 1
elif [ [ " $OSTYPE " = = "msys" ] ] ; then
# Lightweight shell and GNU utilities compiled for Windows (part of MinGW)
echo "Easy Scheduler not support Windows operating system"
exit 1
elif [ [ " $OSTYPE " = = "win32" ] ] ; then
echo "Easy Scheduler not support Windows operating system"
exit 1
elif [ [ " $OSTYPE " = = "freebsd" * ] ] ; then
# ...
txt = ""
else
# Unknown.
echo "Operating system unknown, please tell us(submit issue) for better service"
exit 1
fi
2019-03-29 23:20:22 +08:00
source ${ workDir } /conf/config/run_config.conf
source ${ workDir } /conf/config/install_config.conf
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# mysql config
# mysql address and port
2019-03-29 14:37:07 +08:00
mysqlHost = "192.168.xx.xx:3306"
2019-09-18 18:01:34 +08:00
# mysql database
2019-03-29 23:20:22 +08:00
mysqlDb = "escheduler"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# mysql username
2019-03-29 23:20:22 +08:00
mysqlUserName = "xx"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# mysql passwprd
# Note: if there are special characters, please use the \ transfer character to transfer
2019-03-29 23:20:22 +08:00
mysqlPassword = "xx"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# conf/config/install_config.conf config
# Note: the installation path is not the same as the current path (pwd)
2019-04-11 11:20:21 +08:00
installPath = "/data1_1T/escheduler"
2019-09-18 18:01:34 +08:00
# deployment user
# Note: the deployment user needs to have sudo privileges and permissions to operate hdfs. If hdfs is enabled, the root directory needs to be created by itself
2019-04-11 11:20:21 +08:00
deployUser = "escheduler"
2019-09-18 18:01:34 +08:00
# zk cluster
2019-04-11 11:20:21 +08:00
zkQuorum = "192.168.xx.xx:2181,192.168.xx.xx:2181,192.168.xx.xx:2181"
2019-09-18 18:01:34 +08:00
# install hosts
# Note: install the scheduled hostname list. If it is pseudo-distributed, just write a pseudo-distributed hostname
2019-04-11 11:20:21 +08:00
ips = "ark0,ark1,ark2,ark3,ark4"
2019-09-18 18:01:34 +08:00
# conf/config/run_config.conf config
# run master machine
# Note: list of hosts hostname for deploying master
2019-04-11 11:20:21 +08:00
masters = "ark0,ark1"
2019-09-18 18:01:34 +08:00
# run worker machine
# note: list of machine hostnames for deploying workers
2019-04-11 11:20:21 +08:00
workers = "ark2,ark3,ark4"
2019-09-18 18:01:34 +08:00
# run alert machine
# note: list of machine hostnames for deploying alert server
2019-04-11 11:20:21 +08:00
alertServer = "ark3"
2019-09-18 18:01:34 +08:00
# run api machine
# note: list of machine hostnames for deploying api server
2019-04-11 11:20:21 +08:00
apiServers = "ark1"
2019-09-18 18:01:34 +08:00
# alert config
# mail protocol
2019-04-11 11:20:21 +08:00
mailProtocol = "SMTP"
2019-09-18 18:01:34 +08:00
# mail server host
2019-04-11 11:20:21 +08:00
mailServerHost = "smtp.exmail.qq.com"
2019-09-18 18:01:34 +08:00
# mail server port
2019-04-11 11:20:21 +08:00
mailServerPort = "25"
2019-09-18 18:01:34 +08:00
# sender
2019-04-11 11:20:21 +08:00
mailSender = "xxxxxxxxxx"
2019-09-18 18:01:34 +08:00
# sender password
2019-04-11 11:20:21 +08:00
mailPassword = "xxxxxxxxxx"
2019-09-18 18:01:34 +08:00
# TLS mail protocol support
2019-05-24 10:26:09 +08:00
starttlsEnable = "false"
2019-09-18 18:01:34 +08:00
# SSL mail protocol support
# note: The SSL protocol is enabled by default.
# only one of TLS and SSL can be in the true state.
2019-05-24 10:26:09 +08:00
sslEnable = "true"
2019-09-18 18:01:34 +08:00
# download excel path
2019-04-11 11:20:21 +08:00
xlsFilePath = "/tmp/xls"
2019-09-18 18:01:34 +08:00
# Enterprise WeChat Enterprise ID Configuration
2019-07-04 17:16:05 +08:00
enterpriseWechatCorpId = "xxxxxxxxxx"
2019-09-18 18:01:34 +08:00
# Enterprise WeChat application Secret configuration
2019-07-04 17:16:05 +08:00
enterpriseWechatSecret = "xxxxxxxxxx"
2019-09-18 18:01:34 +08:00
# Enterprise WeChat Application AgentId Configuration
2019-07-04 17:16:05 +08:00
enterpriseWechatAgentId = "xxxxxxxxxx"
2019-09-18 18:01:34 +08:00
# Enterprise WeChat user configuration, multiple users to , split
2019-07-04 17:16:05 +08:00
enterpriseWechatUsers = "xxxxx,xxxxx"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# whether to start monitoring self-starting scripts
2019-05-23 16:29:55 +08:00
monitorServerState = "false"
2019-09-18 18:01:34 +08:00
# resource Center upload and select storage method: HDFS,S3,NONE
2019-06-24 19:33:17 +08:00
resUploadStartupType = "NONE"
2019-04-11 11:20:21 +08:00
2019-09-18 18:01:34 +08:00
# if resUploadStartupType is HDFS, defaultFS write namenode address, HA you need to put core-site.xml and hdfs-site.xml in the conf directory.
# if S3, write S3 address, HA, for example : s3a://escheduler,
# Note, s3 be sure to create the root directory /escheduler
2019-06-24 19:33:17 +08:00
defaultFS = "hdfs://mycluster:8020"
2019-09-18 18:01:34 +08:00
# if S3 is configured, the following configuration is required.
2019-07-19 19:11:14 +08:00
s3Endpoint = "http://192.168.xx.xx:9010"
s3AccessKey = "xxxxxxxxxx"
s3SecretKey = "xxxxxxxxxx"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# resourcemanager HA configuration, if it is a single resourcemanager, here is yarnHaIps=""
2019-03-29 23:20:22 +08:00
yarnHaIps = "192.168.xx.xx,192.168.xx.xx"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# if it is a single resourcemanager, you only need to configure one host name. If it is resourcemanager HA, the default configuration is fine.
2019-03-29 23:20:22 +08:00
singleYarnIp = "ark1"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# hdfs root path, the owner of the root path must be the deployment user.
# versions prior to 1.1.0 do not automatically create the hdfs root directory, you need to create it yourself.
2019-04-11 11:20:21 +08:00
hdfsPath = "/escheduler"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# have users who create directory permissions under hdfs root path /
# Note: if kerberos is enabled, hdfsRootUser="" can be used directly.
2019-06-13 17:55:20 +08:00
hdfsRootUser = "hdfs"
2019-09-18 18:01:34 +08:00
# common config
# Program root path
2019-03-29 23:20:22 +08:00
programPath = "/tmp/escheduler"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# download path
2019-03-29 23:20:22 +08:00
downloadPath = "/tmp/escheduler/download"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# task execute path
2019-03-29 23:20:22 +08:00
execPath = "/tmp/escheduler/exec"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# SHELL environmental variable path
2019-09-30 15:21:59 +08:00
shellEnvPath = " $installPath /conf/env/.dolphinscheduler_env.sh "
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# suffix of the resource file
2019-03-29 23:20:22 +08:00
resSuffixs = "txt,log,sh,conf,cfg,py,java,sql,hql,xml"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# development status, if true, for the SHELL script, you can view the encapsulated SHELL script in the execPath directory.
# If it is false, execute the direct delete
2019-03-29 23:20:22 +08:00
devState = "true"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# kerberos config
# kerberos whether to start
2019-06-13 11:34:56 +08:00
kerberosStartUp = "false"
2019-09-18 18:01:34 +08:00
# kdc krb5 config file path
2019-06-13 11:34:56 +08:00
krb5ConfPath = " $installPath /conf/krb5.conf "
2019-09-18 18:01:34 +08:00
# keytab username
2019-06-13 11:34:56 +08:00
keytabUserName = "hdfs-mycluster@ESZ.COM"
2019-09-18 18:01:34 +08:00
# username keytab path
2019-06-13 11:34:56 +08:00
keytabPath = " $installPath /conf/hdfs.headless.keytab "
2019-09-18 18:01:34 +08:00
# zk config
# zk root directory
2019-03-29 23:20:22 +08:00
zkRoot = "/escheduler"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# used to record the zk directory of the hanging machine
2019-03-29 23:20:22 +08:00
zkDeadServers = "/escheduler/dead-servers"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# masters directory
zkMasters = " $zkRoot /masters "
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# workers directory
zkWorkers = " $zkRoot /workers "
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# zk master distributed lock
mastersLock = " $zkRoot /lock/masters "
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# zk worker distributed lock
workersLock = " $zkRoot /lock/workers "
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# zk master fault-tolerant distributed lock
mastersFailover = " $zkRoot /lock/failover/masters "
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# zk worker fault-tolerant distributed lock
workersFailover = " $zkRoot /lock/failover/workers "
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# zk master start fault tolerant distributed lock
mastersStartupFailover = " $zkRoot /lock/failover/startup-masters "
2019-05-23 16:29:55 +08:00
2019-09-18 18:01:34 +08:00
# zk session timeout
2019-03-29 14:37:07 +08:00
zkSessionTimeout = "300"
2019-09-18 18:01:34 +08:00
# zk connection timeout
2019-03-29 14:37:07 +08:00
zkConnectionTimeout = "300"
2019-09-18 18:01:34 +08:00
# zk retry interval
2019-03-29 23:20:22 +08:00
zkRetrySleep = "100"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# zk retry maximum number of times
2019-03-29 23:20:22 +08:00
zkRetryMaxtime = "5"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# master config
# master execution thread maximum number, maximum parallelism of process instance
2019-03-29 23:20:22 +08:00
masterExecThreads = "100"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# the maximum number of master task execution threads, the maximum degree of parallelism for each process instance
2019-03-29 23:20:22 +08:00
masterExecTaskNum = "20"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# master heartbeat interval
2019-03-29 23:20:22 +08:00
masterHeartbeatInterval = "10"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# master task submission retries
2019-03-29 23:20:22 +08:00
masterTaskCommitRetryTimes = "5"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# master task submission retry interval
2019-03-29 23:20:22 +08:00
masterTaskCommitInterval = "100"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# master maximum cpu average load, used to determine whether the master has execution capability
2019-04-25 19:58:27 +08:00
masterMaxCpuLoadAvg = "10"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# master reserve memory to determine if the master has execution capability
2019-03-29 23:20:22 +08:00
masterReservedMemory = "1"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# worker config
# worker execution thread
2019-03-29 23:20:22 +08:00
workerExecThreads = "100"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# worker heartbeat interval
2019-03-29 23:20:22 +08:00
workerHeartbeatInterval = "10"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# worker number of fetch tasks
2019-04-25 19:56:29 +08:00
workerFetchTaskNum = "3"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# workerThe maximum cpu average load, used to determine whether the worker still has the ability to execute,
# keep the system default, the default is twice the number of cpu cores, when the load reaches 2 times
2019-04-25 19:56:29 +08:00
#workerMaxCupLoadAvg="10"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# worker reserve memory to determine if the master has execution capability
2019-03-29 23:20:22 +08:00
workerReservedMemory = "1"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# api config
# api server port
2019-03-29 23:20:22 +08:00
apiServerPort = "12345"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# api session timeout
2019-03-29 23:20:22 +08:00
apiServerSessionTimeout = "7200"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# api server context path
2019-03-29 23:20:22 +08:00
apiServerContextPath = "/escheduler/"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# spring max file size
2019-03-29 23:20:22 +08:00
springMaxFileSize = "1024MB"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# spring max request size
2019-03-29 23:20:22 +08:00
springMaxRequestSize = "1024MB"
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# api max http post size
2019-03-29 14:37:07 +08:00
apiMaxHttpPostSize = "5000000"
2019-09-18 18:01:34 +08:00
# 1,replace file
echo "1,replace file"
2019-03-30 09:42:12 +08:00
sed -i ${ txt } " s#spring.datasource.url.*#spring.datasource.url=jdbc:mysql:// ${ mysqlHost } / ${ mysqlDb } ?characterEncoding=UTF-8#g " conf/dao/data_source.properties
sed -i ${ txt } " s#spring.datasource.username.*#spring.datasource.username= ${ mysqlUserName } #g " conf/dao/data_source.properties
sed -i ${ txt } " s#spring.datasource.password.*#spring.datasource.password= ${ mysqlPassword } #g " conf/dao/data_source.properties
sed -i ${ txt } " s#org.quartz.dataSource.myDs.URL.*#org.quartz.dataSource.myDs.URL=jdbc:mysql:// ${ mysqlHost } / ${ mysqlDb } ?characterEncoding=UTF-8#g " conf/quartz.properties
sed -i ${ txt } " s#org.quartz.dataSource.myDs.user.*#org.quartz.dataSource.myDs.user= ${ mysqlUserName } #g " conf/quartz.properties
sed -i ${ txt } " s#org.quartz.dataSource.myDs.password.*#org.quartz.dataSource.myDs.password= ${ mysqlPassword } #g " conf/quartz.properties
2019-06-24 19:33:17 +08:00
sed -i ${ txt } " s#fs.defaultFS.*#fs.defaultFS= ${ defaultFS } #g " conf/common/hadoop/hadoop.properties
sed -i ${ txt } " s#fs.s3a.endpoint.*#fs.s3a.endpoint= ${ s3Endpoint } #g " conf/common/hadoop/hadoop.properties
sed -i ${ txt } " s#fs.s3a.access.key.*#fs.s3a.access.key= ${ s3AccessKey } #g " conf/common/hadoop/hadoop.properties
sed -i ${ txt } " s#fs.s3a.secret.key.*#fs.s3a.secret.key= ${ s3SecretKey } #g " conf/common/hadoop/hadoop.properties
2019-03-30 09:42:12 +08:00
sed -i ${ txt } " s#yarn.resourcemanager.ha.rm.ids.*#yarn.resourcemanager.ha.rm.ids= ${ yarnHaIps } #g " conf/common/hadoop/hadoop.properties
sed -i ${ txt } " s#yarn.application.status.address.*#yarn.application.status.address=http:// ${ singleYarnIp } :8088/ws/v1/cluster/apps/%s#g " conf/common/hadoop/hadoop.properties
2019-06-13 15:48:14 +08:00
2019-03-30 09:42:12 +08:00
sed -i ${ txt } " s#data.basedir.path.*#data.basedir.path= ${ programPath } #g " conf/common/common.properties
sed -i ${ txt } " s#data.download.basedir.path.*#data.download.basedir.path= ${ downloadPath } #g " conf/common/common.properties
sed -i ${ txt } " s#process.exec.basepath.*#process.exec.basepath= ${ execPath } #g " conf/common/common.properties
2019-06-13 18:03:29 +08:00
sed -i ${ txt } " s#hdfs.root.user.*#hdfs.root.user= ${ hdfsRootUser } #g " conf/common/common.properties
2019-03-30 09:42:12 +08:00
sed -i ${ txt } " s#data.store2hdfs.basepath.*#data.store2hdfs.basepath= ${ hdfsPath } #g " conf/common/common.properties
2019-06-24 19:33:17 +08:00
sed -i ${ txt } " s#res.upload.startup.type.*#res.upload.startup.type= ${ resUploadStartupType } #g " conf/common/common.properties
2019-03-30 09:42:12 +08:00
sed -i ${ txt } " s#escheduler.env.path.*#escheduler.env.path= ${ shellEnvPath } #g " conf/common/common.properties
sed -i ${ txt } " s#resource.view.suffixs.*#resource.view.suffixs= ${ resSuffixs } #g " conf/common/common.properties
sed -i ${ txt } " s#development.state.*#development.state= ${ devState } #g " conf/common/common.properties
2019-06-13 15:48:14 +08:00
sed -i ${ txt } " s#hadoop.security.authentication.startup.state.*#hadoop.security.authentication.startup.state= ${ kerberosStartUp } #g " conf/common/common.properties
sed -i ${ txt } " s#java.security.krb5.conf.path.*#java.security.krb5.conf.path= ${ krb5ConfPath } #g " conf/common/common.properties
sed -i ${ txt } " s#login.user.keytab.username.*#login.user.keytab.username= ${ keytabUserName } #g " conf/common/common.properties
sed -i ${ txt } " s#login.user.keytab.path.*#login.user.keytab.path= ${ keytabPath } #g " conf/common/common.properties
2019-03-30 09:42:12 +08:00
sed -i ${ txt } " s#zookeeper.quorum.*#zookeeper.quorum= ${ zkQuorum } #g " conf/zookeeper.properties
sed -i ${ txt } " s#zookeeper.escheduler.root.*#zookeeper.escheduler.root= ${ zkRoot } #g " conf/zookeeper.properties
sed -i ${ txt } " s#zookeeper.escheduler.dead.servers.*#zookeeper.escheduler.dead.servers= ${ zkDeadServers } #g " conf/zookeeper.properties
sed -i ${ txt } " s#zookeeper.escheduler.masters.*#zookeeper.escheduler.masters= ${ zkMasters } #g " conf/zookeeper.properties
sed -i ${ txt } " s#zookeeper.escheduler.workers.*#zookeeper.escheduler.workers= ${ zkWorkers } #g " conf/zookeeper.properties
sed -i ${ txt } " s#zookeeper.escheduler.lock.masters.*#zookeeper.escheduler.lock.masters= ${ mastersLock } #g " conf/zookeeper.properties
sed -i ${ txt } " s#zookeeper.escheduler.lock.workers.*#zookeeper.escheduler.lock.workers= ${ workersLock } #g " conf/zookeeper.properties
sed -i ${ txt } " s#zookeeper.escheduler.lock.failover.masters.*#zookeeper.escheduler.lock.failover.masters= ${ mastersFailover } #g " conf/zookeeper.properties
sed -i ${ txt } " s#zookeeper.escheduler.lock.failover.workers.*#zookeeper.escheduler.lock.failover.workers= ${ workersFailover } #g " conf/zookeeper.properties
2019-05-23 16:29:55 +08:00
sed -i ${ txt } " s#zookeeper.escheduler.lock.failover.startup.masters.*#zookeeper.escheduler.lock.failover.startup.masters= ${ mastersStartupFailover } #g " conf/zookeeper.properties
2019-03-30 09:42:12 +08:00
sed -i ${ txt } " s#zookeeper.session.timeout.*#zookeeper.session.timeout= ${ zkSessionTimeout } #g " conf/zookeeper.properties
sed -i ${ txt } " s#zookeeper.connection.timeout.*#zookeeper.connection.timeout= ${ zkConnectionTimeout } #g " conf/zookeeper.properties
sed -i ${ txt } " s#zookeeper.retry.sleep.*#zookeeper.retry.sleep= ${ zkRetrySleep } #g " conf/zookeeper.properties
sed -i ${ txt } " s#zookeeper.retry.maxtime.*#zookeeper.retry.maxtime= ${ zkRetryMaxtime } #g " conf/zookeeper.properties
sed -i ${ txt } " s#master.exec.threads.*#master.exec.threads= ${ masterExecThreads } #g " conf/master.properties
sed -i ${ txt } " s#master.exec.task.number.*#master.exec.task.number= ${ masterExecTaskNum } #g " conf/master.properties
sed -i ${ txt } " s#master.heartbeat.interval.*#master.heartbeat.interval= ${ masterHeartbeatInterval } #g " conf/master.properties
sed -i ${ txt } " s#master.task.commit.retryTimes.*#master.task.commit.retryTimes= ${ masterTaskCommitRetryTimes } #g " conf/master.properties
sed -i ${ txt } " s#master.task.commit.interval.*#master.task.commit.interval= ${ masterTaskCommitInterval } #g " conf/master.properties
2019-06-24 11:40:23 +08:00
#sed -i ${txt} "s#master.max.cpuload.avg.*#master.max.cpuload.avg=${masterMaxCpuLoadAvg}#g" conf/master.properties
2019-03-30 09:42:12 +08:00
sed -i ${ txt } " s#master.reserved.memory.*#master.reserved.memory= ${ masterReservedMemory } #g " conf/master.properties
sed -i ${ txt } " s#worker.exec.threads.*#worker.exec.threads= ${ workerExecThreads } #g " conf/worker.properties
sed -i ${ txt } " s#worker.heartbeat.interval.*#worker.heartbeat.interval= ${ workerHeartbeatInterval } #g " conf/worker.properties
sed -i ${ txt } " s#worker.fetch.task.num.*#worker.fetch.task.num= ${ workerFetchTaskNum } #g " conf/worker.properties
2019-04-25 19:56:29 +08:00
#sed -i ${txt} "s#worker.max.cpuload.avg.*#worker.max.cpuload.avg=${workerMaxCupLoadAvg}#g" conf/worker.properties
2019-03-30 09:42:12 +08:00
sed -i ${ txt } " s#worker.reserved.memory.*#worker.reserved.memory= ${ workerReservedMemory } #g " conf/worker.properties
sed -i ${ txt } " s#server.port.*#server.port= ${ apiServerPort } #g " conf/application.properties
2019-07-19 19:11:14 +08:00
sed -i ${ txt } " s#server.servlet.session.timeout.*#server.servlet.session.timeout= ${ apiServerSessionTimeout } #g " conf/application.properties
sed -i ${ txt } " s#server.servlet.context-path.*#server.servlet.context-path= ${ apiServerContextPath } #g " conf/application.properties
sed -i ${ txt } " s#spring.servlet.multipart.max-file-size.*#spring.servlet.multipart.max-file-size= ${ springMaxFileSize } #g " conf/application.properties
sed -i ${ txt } " s#spring.servlet.multipart.max-request-size.*#spring.servlet.multipart.max-request-size= ${ springMaxRequestSize } #g " conf/application.properties
sed -i ${ txt } " s#server.jetty.max-http-post-size.*#server.jetty.max-http-post-size= ${ apiMaxHttpPostSize } #g " conf/application.properties
2019-03-30 09:42:12 +08:00
sed -i ${ txt } " s#mail.protocol.*#mail.protocol= ${ mailProtocol } #g " conf/alert.properties
sed -i ${ txt } " s#mail.server.host.*#mail.server.host= ${ mailServerHost } #g " conf/alert.properties
sed -i ${ txt } " s#mail.server.port.*#mail.server.port= ${ mailServerPort } #g " conf/alert.properties
sed -i ${ txt } " s#mail.sender.*#mail.sender= ${ mailSender } #g " conf/alert.properties
sed -i ${ txt } " s#mail.passwd.*#mail.passwd= ${ mailPassword } #g " conf/alert.properties
2019-05-24 10:26:09 +08:00
sed -i ${ txt } " s#mail.smtp.starttls.enable.*#mail.smtp.starttls.enable= ${ starttlsEnable } #g " conf/alert.properties
sed -i ${ txt } " s#mail.smtp.ssl.enable.*#mail.smtp.ssl.enable= ${ sslEnable } #g " conf/alert.properties
2019-03-30 09:42:12 +08:00
sed -i ${ txt } " s#xls.file.path.*#xls.file.path= ${ xlsFilePath } #g " conf/alert.properties
2019-07-04 17:16:05 +08:00
sed -i ${ txt } " s#enterprise.wechat.corp.id.*#enterprise.wechat.corp.id= ${ enterpriseWechatCorpId } #g " conf/alert.properties
sed -i ${ txt } " s#enterprise.wechat.secret.*#enterprise.wechat.secret= ${ enterpriseWechatSecret } #g " conf/alert.properties
sed -i ${ txt } " s#enterprise.wechat.agent.id.*#enterprise.wechat.agent.id= ${ enterpriseWechatAgentId } #g " conf/alert.properties
sed -i ${ txt } " s#enterprise.wechat.users.*#enterprise.wechat.users= ${ enterpriseWechatUsers } #g " conf/alert.properties
2019-03-30 09:42:12 +08:00
sed -i ${ txt } " s#installPath.*#installPath= ${ installPath } #g " conf/config/install_config.conf
sed -i ${ txt } " s#deployUser.*#deployUser= ${ deployUser } #g " conf/config/install_config.conf
sed -i ${ txt } " s#ips.*#ips= ${ ips } #g " conf/config/install_config.conf
sed -i ${ txt } " s#masters.*#masters= ${ masters } #g " conf/config/run_config.conf
sed -i ${ txt } " s#workers.*#workers= ${ workers } #g " conf/config/run_config.conf
sed -i ${ txt } " s#alertServer.*#alertServer= ${ alertServer } #g " conf/config/run_config.conf
sed -i ${ txt } " s#apiServers.*#apiServers= ${ apiServers } #g " conf/config/run_config.conf
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# 2,create directory
echo "2,create directory"
2019-03-29 14:37:07 +08:00
if [ ! -d $installPath ] ; then
2019-03-29 23:20:22 +08:00
sudo mkdir -p $installPath
sudo chown -R $deployUser :$deployUser $installPath
2019-03-29 14:37:07 +08:00
fi
2019-03-29 23:20:22 +08:00
hostsArr = ( ${ ips //,/ } )
for host in ${ hostsArr [@] }
2019-03-29 14:37:07 +08:00
do
2019-09-18 18:01:34 +08:00
# create if programPath does not exist
2019-03-29 23:20:22 +08:00
if ! ssh $host test -e $programPath ; then
ssh $host " sudo mkdir -p $programPath ;sudo chown -R $deployUser : $deployUser $programPath "
2019-03-29 14:37:07 +08:00
fi
2019-09-18 18:01:34 +08:00
# create if downloadPath does not exist
2019-03-29 14:37:07 +08:00
if ! ssh $host test -e $downloadPath ; then
2019-03-29 23:20:22 +08:00
ssh $host " sudo mkdir -p $downloadPath ;sudo chown -R $deployUser : $deployUser $downloadPath "
2019-03-29 14:37:07 +08:00
fi
2019-09-18 18:01:34 +08:00
# create if execPath does not exist
2019-03-29 14:37:07 +08:00
if ! ssh $host test -e $execPath ; then
2019-03-29 23:20:22 +08:00
ssh $host " sudo mkdir -p $execPath ; sudo chown -R $deployUser : $deployUser $execPath "
2019-03-29 14:37:07 +08:00
fi
2019-09-18 18:01:34 +08:00
# create if xlsFilePath does not exist
2019-03-29 14:37:07 +08:00
if ! ssh $host test -e $xlsFilePath ; then
2019-03-29 23:20:22 +08:00
ssh $host " sudo mkdir -p $xlsFilePath ; sudo chown -R $deployUser : $deployUser $xlsFilePath "
2019-03-29 14:37:07 +08:00
fi
done
2019-09-18 18:01:34 +08:00
# 3,stop server
echo "3,stop server"
sh ${ workDir } /script/stop-all.sh
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# 4,delete zk node
echo "4,delete zk node"
2019-03-29 14:37:07 +08:00
sleep 1
2019-09-18 18:01:34 +08:00
python ${ workDir } /script/del-zk-node.py $zkQuorum $zkRoot
2019-03-29 14:37:07 +08:00
2019-09-18 18:01:34 +08:00
# 5,scp resources
echo "5,scp resources"
sh ${ workDir } /script/scp-hosts.sh
2019-03-29 14:37:07 +08:00
if [ $? -eq 0 ]
then
2019-09-18 18:01:34 +08:00
echo 'scp copy completed'
2019-03-29 14:37:07 +08:00
else
2019-09-18 18:01:34 +08:00
echo 'sc copy failed to exit'
2019-03-29 14:37:07 +08:00
exit -1
fi
2019-09-18 18:01:34 +08:00
# 6,startup
echo "6,startup"
sh ${ workDir } /script/start-all.sh
2019-05-22 16:16:01 +08:00
2019-09-18 18:01:34 +08:00
# 7,start monitoring self-starting script
2019-05-23 11:02:42 +08:00
monitor_pid = ${ workDir } /monitor_server.pid
2019-05-22 16:16:01 +08:00
if [ "true" = $monitorServerState ] ; then
2019-05-23 11:02:42 +08:00
if [ -f $monitor_pid ] ; then
TARGET_PID = ` cat $monitor_pid `
if kill -0 $TARGET_PID > /dev/null 2>& 1; then
echo " monitor server running as process ${ TARGET_PID } .Stopping "
kill $TARGET_PID
sleep 5
if kill -0 $TARGET_PID > /dev/null 2>& 1; then
2019-05-23 11:05:37 +08:00
echo "monitor server did not stop gracefully after 5 seconds: killing with kill -9"
2019-05-23 11:02:42 +08:00
kill -9 $TARGET_PID
fi
else
echo "no monitor server to stop"
fi
echo " monitor server running as process ${ TARGET_PID } .Stopped success "
rm -f $monitor_pid
fi
2019-09-18 18:01:34 +08:00
nohup python -u ${ workDir } /script/monitor-server.py $installPath $zkQuorum $zkMasters $zkWorkers > ${ workDir } /monitor-server.log 2>& 1 &
2019-05-23 11:02:42 +08:00
echo $! > $monitor_pid
echo " start monitor server success as process `cat $monitor_pid ` "
2019-09-18 18:01:34 +08:00
fi