install.sh 21.4 KB
Newer Older
D
dailidong 已提交
1
#!/bin/sh
L
lgcareer 已提交
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
18

D
dailidong 已提交
19 20
workDir=`dirname $0`
workDir=`cd ${workDir};pwd`
D
dailidong 已提交
21

D
dailidong 已提交
22 23 24 25 26 27 28 29 30 31
#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
Q
qiaozhanwei 已提交
32
    echo "DolphinScheduler not support Windows operating system"
D
dailidong 已提交
33 34 35
    exit 1
elif [[ "$OSTYPE" == "msys" ]]; then
    # Lightweight shell and GNU utilities compiled for Windows (part of MinGW)
Q
qiaozhanwei 已提交
36
    echo "DolphinScheduler not support Windows operating system"
D
dailidong 已提交
37 38
    exit 1
elif [[ "$OSTYPE" == "win32" ]]; then
Q
qiaozhanwei 已提交
39
    echo "DolphinScheduler not support Windows operating system"
D
dailidong 已提交
40 41 42 43 44 45 46 47 48 49
    exit 1
elif [[ "$OSTYPE" == "freebsd"* ]]; then
    # ...
    txt=""
else
    # Unknown.
    echo "Operating system unknown, please tell us(submit issue) for better service"
    exit 1
fi

D
dailidong 已提交
50 51
source ${workDir}/conf/config/run_config.conf
source ${workDir}/conf/config/install_config.conf
52

Q
qiaozhanwei 已提交
53 54 55 56 57 58
# for example mysql or postgresql ...
dbtype="mysql"

# db config
# db address and port
dbhost="192.168.xx.xx:3306"
59

60
# mysql database
Q
qiaozhanwei 已提交
61
dbname="dolphinscheduler"
62

63
# mysql username
Q
qiaozhanwei 已提交
64
username="xx"
65

66 67
# mysql passwprd
# Note: if there are special characters, please use the \ transfer character to transfer
Q
qiaozhanwei 已提交
68
passowrd="xx"
69

70 71
# conf/config/install_config.conf config
# Note: the installation path is not the same as the current path (pwd)
Q
qiaozhanwei 已提交
72
installPath="/data1_1T/dolphinscheduler"
B
baoliang 已提交
73

74 75
# 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
Q
qiaozhanwei 已提交
76
deployUser="dolphinscheduler"
B
baoliang 已提交
77

78
# zk cluster
B
baoliang 已提交
79 80
zkQuorum="192.168.xx.xx:2181,192.168.xx.xx:2181,192.168.xx.xx:2181"

81 82
# install hosts
# Note: install the scheduled hostname list. If it is pseudo-distributed, just write a pseudo-distributed hostname
B
baoliang 已提交
83 84
ips="ark0,ark1,ark2,ark3,ark4"

85 86 87
# conf/config/run_config.conf config
# run master machine
# Note: list of hosts hostname for deploying master
B
baoliang 已提交
88 89
masters="ark0,ark1"

90 91
# run worker machine
# note: list of machine hostnames for deploying workers
B
baoliang 已提交
92 93
workers="ark2,ark3,ark4"

94 95
# run alert machine
# note: list of machine hostnames for deploying alert server
B
baoliang 已提交
96 97
alertServer="ark3"

98 99
# run api machine
# note: list of machine hostnames for deploying api server
B
baoliang 已提交
100 101
apiServers="ark1"

102 103
# alert config
# mail protocol
B
baoliang 已提交
104 105
mailProtocol="SMTP"

106
# mail server host
B
baoliang 已提交
107 108
mailServerHost="smtp.exmail.qq.com"

109
# mail server port
B
baoliang 已提交
110 111
mailServerPort="25"

112
# sender
B
baoliang 已提交
113 114
mailSender="xxxxxxxxxx"

Q
qiaozhanwei 已提交
115 116 117
# user
mailUser="xxxxxxxxxx"

118
# sender password
B
baoliang 已提交
119 120
mailPassword="xxxxxxxxxx"

121
# TLS mail protocol support
122 123
starttlsEnable="false"

Q
qiaozhanwei 已提交
124 125
sslTrust="xxxxxxxxxx"

126 127 128
# SSL mail protocol support
# note: The SSL protocol is enabled by default. 
# only one of TLS and SSL can be in the true state.
129 130
sslEnable="true"

131
# download excel path
B
baoliang 已提交
132 133
xlsFilePath="/tmp/xls"

134
# Enterprise WeChat Enterprise ID Configuration
L
lgcareer 已提交
135 136
enterpriseWechatCorpId="xxxxxxxxxx"

137
# Enterprise WeChat application Secret configuration
L
lgcareer 已提交
138 139
enterpriseWechatSecret="xxxxxxxxxx"

140
# Enterprise WeChat Application AgentId Configuration
L
lgcareer 已提交
141 142
enterpriseWechatAgentId="xxxxxxxxxx"

143
# Enterprise WeChat user configuration, multiple users to , split
L
lgcareer 已提交
144 145
enterpriseWechatUsers="xxxxx,xxxxx"

Q
qiaozhanwei 已提交
146 147 148
# alert port
alertPort=7789

149

150
# whether to start monitoring self-starting scripts
151 152
monitorServerState="false"

153
# resource Center upload and select storage method:HDFS,S3,NONE
journey2018's avatar
journey2018 已提交
154
resUploadStartupType="NONE"
B
baoliang 已提交
155

156
# if resUploadStartupType is HDFS,defaultFS write namenode address,HA you need to put core-site.xml and hdfs-site.xml in the conf directory.
Q
qiaozhanwei 已提交
157 158
# if S3,write S3 address,HA,for example :s3a://dolphinscheduler,
# Note,s3 be sure to create the root directory /dolphinscheduler
journey2018's avatar
journey2018 已提交
159 160
defaultFS="hdfs://mycluster:8020"

161
# if S3 is configured, the following configuration is required.
journey2018's avatar
journey2018 已提交
162 163 164
s3Endpoint="http://192.168.xx.xx:9010"
s3AccessKey="xxxxxxxxxx"
s3SecretKey="xxxxxxxxxx"
165

166
# resourcemanager HA configuration, if it is a single resourcemanager, here is yarnHaIps=""
D
dailidong 已提交
167
yarnHaIps="192.168.xx.xx,192.168.xx.xx"
168

169
# if it is a single resourcemanager, you only need to configure one host name. If it is resourcemanager HA, the default configuration is fine.
D
dailidong 已提交
170
singleYarnIp="ark1"
171

172 173
# 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.
Q
qiaozhanwei 已提交
174
hdfsPath="/dolphinscheduler"
175

176 177
# have users who create directory permissions under hdfs root path /
# Note: if kerberos is enabled, hdfsRootUser="" can be used directly.
L
lgcareer 已提交
178 179
hdfsRootUser="hdfs"

180 181
# common config
# Program root path
Q
qiaozhanwei 已提交
182
programPath="/tmp/dolphinscheduler"
183

184
# download path
Q
qiaozhanwei 已提交
185
downloadPath="/tmp/dolphinscheduler/download"
186

187
# task execute path
Q
qiaozhanwei 已提交
188
execPath="/tmp/dolphinscheduler/exec"
189

190
# SHELL environmental variable path
191
shellEnvPath="$installPath/conf/env/.dolphinscheduler_env.sh"
192

193
# suffix of the resource file
D
dailidong 已提交
194
resSuffixs="txt,log,sh,conf,cfg,py,java,sql,hql,xml"
195

196 197
# 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
D
dailidong 已提交
198
devState="true"
199

200 201
# kerberos config
# kerberos whether to start
journey2018's avatar
journey2018 已提交
202 203
kerberosStartUp="false"

204
# kdc krb5 config file path
journey2018's avatar
journey2018 已提交
205 206
krb5ConfPath="$installPath/conf/krb5.conf"

207
# keytab username
journey2018's avatar
journey2018 已提交
208 209
keytabUserName="hdfs-mycluster@ESZ.COM"

210
# username keytab path
journey2018's avatar
journey2018 已提交
211 212
keytabPath="$installPath/conf/hdfs.headless.keytab"

213 214
# zk config
# zk root directory
Q
qiaozhanwei 已提交
215
zkRoot="/dolphinscheduler"
216

217
# used to record the zk directory of the hanging machine
Q
qiaozhanwei 已提交
218
zkDeadServers="$zkRoot/dead-servers"
219

220 221
# masters directory
zkMasters="$zkRoot/masters"
222

223 224
# workers directory
zkWorkers="$zkRoot/workers"
225

226 227
# zk master distributed lock
mastersLock="$zkRoot/lock/masters"
228

229 230
# zk worker distributed lock
workersLock="$zkRoot/lock/workers"
231

232 233
# zk master fault-tolerant distributed lock
mastersFailover="$zkRoot/lock/failover/masters"
234

235 236
# zk worker fault-tolerant distributed lock
workersFailover="$zkRoot/lock/failover/workers"
237

238 239
# zk master start fault tolerant distributed lock
mastersStartupFailover="$zkRoot/lock/failover/startup-masters"
240

241
# zk session timeout
242 243
zkSessionTimeout="300"

244
# zk connection timeout
245 246
zkConnectionTimeout="300"

247
# zk retry interval
D
dailidong 已提交
248
zkRetrySleep="100"
249

250
# zk retry maximum number of times
D
dailidong 已提交
251
zkRetryMaxtime="5"
252 253


254 255
# master config 
# master execution thread maximum number, maximum parallelism of process instance
D
dailidong 已提交
256
masterExecThreads="100"
257

258
# the maximum number of master task execution threads, the maximum degree of parallelism for each process instance
D
dailidong 已提交
259
masterExecTaskNum="20"
260

261
# master heartbeat interval
D
dailidong 已提交
262
masterHeartbeatInterval="10"
263

264
# master task submission retries
D
dailidong 已提交
265
masterTaskCommitRetryTimes="5"
266

267
# master task submission retry interval
D
dailidong 已提交
268
masterTaskCommitInterval="100"
269

270
# master maximum cpu average load, used to determine whether the master has execution capability
D
dailidong 已提交
271
masterMaxCpuLoadAvg="10"
272

273
# master reserve memory to determine if the master has execution capability
D
dailidong 已提交
274
masterReservedMemory="1"
275

Q
qiaozhanwei 已提交
276 277 278
# master port
masterPort=5566

279

280 281
# worker config 
# worker execution thread
D
dailidong 已提交
282
workerExecThreads="100"
283

284
# worker heartbeat interval
D
dailidong 已提交
285
workerHeartbeatInterval="10"
286

287
# worker number of fetch tasks
D
dailidong 已提交
288
workerFetchTaskNum="3"
289

290
# worker reserve memory to determine if the master has execution capability
D
dailidong 已提交
291
workerReservedMemory="1"
292

Q
qiaozhanwei 已提交
293 294 295 296
# master port
workerPort=7788


297 298
# api config
# api server port
D
dailidong 已提交
299
apiServerPort="12345"
300

301
# api session timeout
D
dailidong 已提交
302
apiServerSessionTimeout="7200"
303

304
# api server context path
Q
qiaozhanwei 已提交
305
apiServerContextPath="/dolphinscheduler/"
306

307
# spring max file size
D
dailidong 已提交
308
springMaxFileSize="1024MB"
309

310
# spring max request size
D
dailidong 已提交
311
springMaxRequestSize="1024MB"
312

313
# api max http post size
314 315
apiMaxHttpPostSize="5000000"

Q
qiaozhanwei 已提交
316

317 318
# 1,replace file
echo "1,replace file"
Q
qiaozhanwei 已提交
319
if [ $dbtype == "mysql" ];then
320 321 322 323
    sed -i ${txt} "s#spring.datasource.url.*#spring.datasource.url=jdbc:mysql://${dbhost}/${dbname}?characterEncoding=UTF-8#g" conf/application-dao.properties
    sed -i ${txt} "s#spring.datasource.username.*#spring.datasource.username=${username}#g" conf/application-dao.properties
    sed -i ${txt} "s#spring.datasource.password.*#spring.datasource.password=${passowrd}#g" conf/application-dao.properties
    sed -i ${txt} "s#spring.datasource.driver-class-name.*#spring.datasource.driver-class-name=com.mysql.jdbc.Driver#g" conf/application-dao.properties
Q
qiaozhanwei 已提交
324 325 326 327 328 329 330 331 332


    sed -i ${txt} "s#org.quartz.dataSource.myDs.URL.*#org.quartz.dataSource.myDs.URL=jdbc:mysql://${dbhost}/${dbname}?characterEncoding=UTF-8#g" conf/quartz.properties
    sed -i ${txt} "s#org.quartz.dataSource.myDs.user.*#org.quartz.dataSource.myDs.user=${username}#g" conf/quartz.properties
    sed -i ${txt} "s#org.quartz.dataSource.myDs.password.*#org.quartz.dataSource.myDs.password=${passowrd}#g" conf/quartz.properties
    sed -i ${txt} "s#org.quartz.dataSource.myDs.driver.*#org.quartz.dataSource.myDs.driver=com.mysql.jdbc.Driver#g" conf/quartz.properties
fi

if [ $dbtype == "postgresql" ];then
333 334 335 336
    sed -i ${txt} "s#spring.datasource.url.*#spring.datasource.url=jdbc:postgresql://${dbhost}/${dbname}?characterEncoding=UTF-8#g" conf/application-dao.properties
    sed -i ${txt} "s#spring.datasource.username.*#spring.datasource.username=${username}#g" conf/application-dao.properties
    sed -i ${txt} "s#spring.datasource.password.*#spring.datasource.password=${passowrd}#g" conf/application-dao.properties
    sed -i ${txt} "s#spring.datasource.driver-class-name.*#spring.datasource.driver-class-name=org.postgresql.Driver#g" conf/application-dao.properties
Q
qiaozhanwei 已提交
337

X
xingchun-chen 已提交
338
    sed -i ${txt} "s#org.quartz.dataSource.myDs.URL.*#org.quartz.dataSource.myDs.URL=jdbc:postgresql://${dbhost}/${dbname}?characterEncoding=UTF-8#g" conf/quartz.properties
Q
qiaozhanwei 已提交
339 340 341
    sed -i ${txt} "s#org.quartz.dataSource.myDs.user.*#org.quartz.dataSource.myDs.user=${username}#g" conf/quartz.properties
    sed -i ${txt} "s#org.quartz.dataSource.myDs.password.*#org.quartz.dataSource.myDs.password=${passowrd}#g" conf/quartz.properties
    sed -i ${txt} "s#org.quartz.dataSource.myDs.driver.*#org.quartz.dataSource.myDs.driver=org.postgresql.Driver#g" conf/quartz.properties
B
bao liang 已提交
342
    sed -i ${txt} "s#org.quartz.jobStore.driverDelegateClass.*#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.PostgreSQLDelegate#g" conf/quartz.properties
Q
qiaozhanwei 已提交
343
fi
D
dailidong 已提交
344 345 346



journey2018's avatar
journey2018 已提交
347 348 349 350
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
D
dailidong 已提交
351 352 353
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

354

D
dailidong 已提交
355 356 357
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
L
lgcareer 已提交
358
sed -i ${txt} "s#hdfs.root.user.*#hdfs.root.user=${hdfsRootUser}#g" conf/common/common.properties
D
dailidong 已提交
359
sed -i ${txt} "s#data.store2hdfs.basepath.*#data.store2hdfs.basepath=${hdfsPath}#g" conf/common/common.properties
journey2018's avatar
journey2018 已提交
360
sed -i ${txt} "s#res.upload.startup.type.*#res.upload.startup.type=${resUploadStartupType}#g" conf/common/common.properties
Q
qiaozhanwei 已提交
361
sed -i ${txt} "s#dolphinscheduler.env.path.*#dolphinscheduler.env.path=${shellEnvPath}#g" conf/common/common.properties
D
dailidong 已提交
362 363
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
364 365 366 367
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
D
dailidong 已提交
368 369

sed -i ${txt} "s#zookeeper.quorum.*#zookeeper.quorum=${zkQuorum}#g" conf/zookeeper.properties
Q
qiaozhanwei 已提交
370 371 372 373 374 375 376 377 378
sed -i ${txt} "s#zookeeper.dolphinscheduler.root.*#zookeeper.dolphinscheduler.root=${zkRoot}#g" conf/zookeeper.properties
sed -i ${txt} "s#zookeeper.dolphinscheduler.dead.servers.*#zookeeper.dolphinscheduler.dead.servers=${zkDeadServers}#g" conf/zookeeper.properties
sed -i ${txt} "s#zookeeper.dolphinscheduler.masters.*#zookeeper.dolphinscheduler.masters=${zkMasters}#g" conf/zookeeper.properties
sed -i ${txt} "s#zookeeper.dolphinscheduler.workers.*#zookeeper.dolphinscheduler.workers=${zkWorkers}#g" conf/zookeeper.properties
sed -i ${txt} "s#zookeeper.dolphinscheduler.lock.masters.*#zookeeper.dolphinscheduler.lock.masters=${mastersLock}#g" conf/zookeeper.properties
sed -i ${txt} "s#zookeeper.dolphinscheduler.lock.workers.*#zookeeper.dolphinscheduler.lock.workers=${workersLock}#g" conf/zookeeper.properties
sed -i ${txt} "s#zookeeper.dolphinscheduler.lock.failover.masters.*#zookeeper.dolphinscheduler.lock.failover.masters=${mastersFailover}#g" conf/zookeeper.properties
sed -i ${txt} "s#zookeeper.dolphinscheduler.lock.failover.workers.*#zookeeper.dolphinscheduler.lock.failover.workers=${workersFailover}#g" conf/zookeeper.properties
sed -i ${txt} "s#zookeeper.dolphinscheduler.lock.failover.startup.masters.*#zookeeper.dolphinscheduler.lock.failover.startup.masters=${mastersStartupFailover}#g" conf/zookeeper.properties
D
dailidong 已提交
379 380 381 382 383 384 385 386 387 388 389
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
sed -i ${txt} "s#master.reserved.memory.*#master.reserved.memory=${masterReservedMemory}#g" conf/master.properties
Q
qiaozhanwei 已提交
390
sed -i ${txt} "s#server.port.*#server.port=${masterPort}#g" conf/application-master.properties
D
dailidong 已提交
391 392 393 394 395 396


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
sed -i ${txt} "s#worker.reserved.memory.*#worker.reserved.memory=${workerReservedMemory}#g" conf/worker.properties
Q
qiaozhanwei 已提交
397
sed -i ${txt} "s#server.port.*#server.port=${workerPort}#g" conf/application-worker.properties
D
dailidong 已提交
398 399


Q
qiaozhanwei 已提交
400 401 402 403 404 405
sed -i ${txt} "s#server.port.*#server.port=${apiServerPort}#g" conf/application-api.properties
sed -i ${txt} "s#server.servlet.session.timeout.*#server.servlet.session.timeout=${apiServerSessionTimeout}#g" conf/application-api.properties
sed -i ${txt} "s#server.servlet.context-path.*#server.servlet.context-path=${apiServerContextPath}#g" conf/application-api.properties
sed -i ${txt} "s#spring.servlet.multipart.max-file-size.*#spring.servlet.multipart.max-file-size=${springMaxFileSize}#g" conf/application-api.properties
sed -i ${txt} "s#spring.servlet.multipart.max-request-size.*#spring.servlet.multipart.max-request-size=${springMaxRequestSize}#g" conf/application-api.properties
sed -i ${txt} "s#server.jetty.max-http-post-size.*#server.jetty.max-http-post-size=${apiMaxHttpPostSize}#g" conf/application-api.properties
D
dailidong 已提交
406 407 408 409 410 411


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
Q
qiaozhanwei 已提交
412
sed -i ${txt} "s#mail.user.*#mail.user=${mailUser}#g" conf/alert.properties
D
dailidong 已提交
413
sed -i ${txt} "s#mail.passwd.*#mail.passwd=${mailPassword}#g" conf/alert.properties
414
sed -i ${txt} "s#mail.smtp.starttls.enable.*#mail.smtp.starttls.enable=${starttlsEnable}#g" conf/alert.properties
Q
qiaozhanwei 已提交
415
sed -i ${txt} "s#mail.smtp.ssl.trust.*#mail.smtp.ssl.trust=${sslTrust}#g" conf/alert.properties
416
sed -i ${txt} "s#mail.smtp.ssl.enable.*#mail.smtp.ssl.enable=${sslEnable}#g" conf/alert.properties
D
dailidong 已提交
417
sed -i ${txt} "s#xls.file.path.*#xls.file.path=${xlsFilePath}#g" conf/alert.properties
L
lgcareer 已提交
418 419 420 421
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
Q
qiaozhanwei 已提交
422

D
dailidong 已提交
423 424 425 426 427 428 429 430 431 432 433


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
434 435


436 437
# 2,create directory
echo "2,create directory"
438 439

if [ ! -d $installPath ];then
D
dailidong 已提交
440 441
  sudo mkdir -p $installPath
  sudo chown -R $deployUser:$deployUser $installPath
442 443
fi

D
dailidong 已提交
444 445
hostsArr=(${ips//,/ })
for host in ${hostsArr[@]}
446 447
do

448
# create if programPath does not exist
D
dailidong 已提交
449 450
if ! ssh $host test -e $programPath; then
  ssh $host "sudo mkdir -p $programPath;sudo chown -R $deployUser:$deployUser $programPath"
451 452
fi

453
# create if downloadPath does not exist
454
if ! ssh $host test -e $downloadPath; then
D
dailidong 已提交
455
  ssh $host "sudo mkdir -p $downloadPath;sudo chown -R $deployUser:$deployUser $downloadPath"
456 457
fi

458
# create if execPath does not exist
459
if ! ssh $host test -e $execPath; then
D
dailidong 已提交
460
  ssh $host "sudo mkdir -p $execPath; sudo chown -R $deployUser:$deployUser $execPath"
461 462
fi

463
# create if xlsFilePath does not exist
464
if ! ssh $host test -e $xlsFilePath; then
D
dailidong 已提交
465
  ssh $host "sudo mkdir -p $xlsFilePath; sudo chown -R $deployUser:$deployUser $xlsFilePath"
466 467 468 469 470
fi

done


471 472 473
# 3,stop server
echo "3,stop server"
sh ${workDir}/script/stop-all.sh
474

475 476
# 4,delete zk node
echo "4,delete zk node"
477
sleep 1
478
python ${workDir}/script/del-zk-node.py $zkQuorum $zkRoot
479

480 481 482
# 5,scp resources
echo "5,scp resources"
sh ${workDir}/script/scp-hosts.sh
483 484
if [ $? -eq 0 ]
then
485
	echo 'scp copy completed'
486
else
487
	echo 'scp copy failed to exit'
488 489 490
	exit -1
fi

491 492 493
# 6,startup
echo "6,startup"
sh ${workDir}/script/start-all.sh
L
ligang 已提交
494

495
# 7,start monitoring self-starting script
L
ligang 已提交
496
monitor_pid=${workDir}/monitor_server.pid
L
ligang 已提交
497
if [ "true" = $monitorServerState ];then
L
ligang 已提交
498 499 500 501 502 503 504
        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
L
ligang 已提交
505
                                echo "monitor server did not stop gracefully after 5 seconds: killing with kill -9"
L
ligang 已提交
506 507 508 509 510 511 512 513
                                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
514
        nohup python -u ${workDir}/script/monitor-server.py $installPath $zkQuorum $zkMasters $zkWorkers > ${workDir}/monitor-server.log 2>&1 &
L
ligang 已提交
515 516 517
        echo $! > $monitor_pid
        echo "start monitor server success as process `cat $monitor_pid`"

518
fi