install.sh 18.1 KB
Newer Older
D
dailidong 已提交
1
#!/bin/sh
B
bao liang 已提交
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
source ${workDir}/conf/config/install_config.conf
51

B
bao liang 已提交
52 53
# for example postgresql or mysql ...
dbtype="postgresql"
Q
qiaozhanwei 已提交
54 55 56

# db config
# db address and port
B
bao liang 已提交
57
dbhost="192.168.xx.xx:5432"
58

B
bao liang 已提交
59
# db name
Q
qiaozhanwei 已提交
60
dbname="dolphinscheduler"
61

B
bao liang 已提交
62
# db username
Q
qiaozhanwei 已提交
63
username="xx"
64

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

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

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

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

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

84 85 86 87
# ssh port, default 22
# Note: if ssh port is not default, modify here
sshPort=22

88 89
# run master machine
# Note: list of hosts hostname for deploying master
B
baoliang 已提交
90 91
masters="ark0,ark1"

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

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

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

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

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

111
# mail server port
B
baoliang 已提交
112 113
mailServerPort="25"

114
# sender
B
baoliang 已提交
115 116
mailSender="xxxxxxxxxx"

Q
qiaozhanwei 已提交
117 118 119
# user
mailUser="xxxxxxxxxx"

120
# sender password
B
baoliang 已提交
121 122
mailPassword="xxxxxxxxxx"

123
# TLS mail protocol support
124 125
starttlsEnable="false"

Q
qiaozhanwei 已提交
126 127
sslTrust="xxxxxxxxxx"

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

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

136
# Enterprise WeChat Enterprise ID Configuration
L
lgcareer 已提交
137 138
enterpriseWechatCorpId="xxxxxxxxxx"

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

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

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

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

151
# 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 已提交
152 153
# if S3,write S3 address,HA,for example :s3a://dolphinscheduler,
# Note,s3 be sure to create the root directory /dolphinscheduler
journey2018's avatar
journey2018 已提交
154 155
defaultFS="hdfs://mycluster:8020"

156
# if S3 is configured, the following configuration is required.
journey2018's avatar
journey2018 已提交
157 158 159
s3Endpoint="http://192.168.xx.xx:9010"
s3AccessKey="xxxxxxxxxx"
s3SecretKey="xxxxxxxxxx"
160

161
# resourcemanager HA configuration, if it is a single resourcemanager, here is yarnHaIps=""
D
dailidong 已提交
162
yarnHaIps="192.168.xx.xx,192.168.xx.xx"
163

164
# 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 已提交
165
singleYarnIp="ark1"
166

167 168
# 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 已提交
169
hdfsPath="/dolphinscheduler"
170

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

175 176
# common config
# Program root path
Q
qiaozhanwei 已提交
177
programPath="/tmp/dolphinscheduler"
178

179
# download path
Q
qiaozhanwei 已提交
180
downloadPath="/tmp/dolphinscheduler/download"
181

182
# task execute path
Q
qiaozhanwei 已提交
183
execPath="/tmp/dolphinscheduler/exec"
184

185
# SHELL environmental variable path
186
shellEnvPath="$installPath/conf/env/dolphinscheduler_env.sh"
187

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

191 192
# 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 已提交
193
devState="true"
194

195 196
# kerberos config
# kerberos whether to start
journey2018's avatar
journey2018 已提交
197 198
kerberosStartUp="false"

199
# kdc krb5 config file path
journey2018's avatar
journey2018 已提交
200 201
krb5ConfPath="$installPath/conf/krb5.conf"

202
# keytab username
journey2018's avatar
journey2018 已提交
203 204
keytabUserName="hdfs-mycluster@ESZ.COM"

205
# username keytab path
journey2018's avatar
journey2018 已提交
206 207
keytabPath="$installPath/conf/hdfs.headless.keytab"

208 209
# zk config
# zk root directory
Q
qiaozhanwei 已提交
210
zkRoot="/dolphinscheduler"
211

212
# zk session timeout
213 214
zkSessionTimeout="300"

215
# zk connection timeout
216 217
zkConnectionTimeout="300"

218
# zk retry interval
219
zkRetryMaxSleep="100"
220

221
# zk retry maximum number of times
D
dailidong 已提交
222
zkRetryMaxtime="5"
223 224


225 226
# master config 
# master execution thread maximum number, maximum parallelism of process instance
D
dailidong 已提交
227
masterExecThreads="100"
228

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

232
# master heartbeat interval
D
dailidong 已提交
233
masterHeartbeatInterval="10"
234

235
# master task submission retries
D
dailidong 已提交
236
masterTaskCommitRetryTimes="5"
237

238
# master task submission retry interval
239
masterTaskCommitInterval="1000"
240

241
# master maximum cpu average load, used to determine whether the master has execution capability
242
masterMaxCpuLoadAvg="100"
243

244
# master reserve memory to determine if the master has execution capability
245
masterReservedMemory="0.1"
Q
qiaozhanwei 已提交
246

247
# worker config
248
# worker execution thread
D
dailidong 已提交
249
workerExecThreads="100"
250

251
# worker heartbeat interval
D
dailidong 已提交
252
workerHeartbeatInterval="10"
253

254
# worker number of fetch tasks
D
dailidong 已提交
255
workerFetchTaskNum="3"
256

257
# worker reserve memory to determine if the master has execution capability
258
workerReservedMemory="0.1"
Q
qiaozhanwei 已提交
259

260 261
# api config
# api server port
D
dailidong 已提交
262
apiServerPort="12345"
263

264
# api session timeout
D
dailidong 已提交
265
apiServerSessionTimeout="7200"
266

267
# spring max file size
D
dailidong 已提交
268
springMaxFileSize="1024MB"
269

270
# spring max request size
D
dailidong 已提交
271
springMaxRequestSize="1024MB"
272

273
# api max http post size
274 275
apiMaxHttpPostSize="5000000"

Q
qiaozhanwei 已提交
276

277 278
# 1,replace file
echo "1,replace file"
Q
qiaozhanwei 已提交
279
if [ $dbtype == "mysql" ];then
280 281 282 283
    sed -i ${txt} "s#spring.datasource.url.*#spring.datasource.url=jdbc:mysql://${dbhost}/${dbname}?characterEncoding=UTF-8#g" conf/application.properties
    sed -i ${txt} "s#spring.datasource.username.*#spring.datasource.username=${username}#g" conf/application.properties
    sed -i ${txt} "s#spring.datasource.password.*#spring.datasource.password=${passowrd}#g" conf/application.properties
    sed -i ${txt} "s#spring.datasource.driver-class-name.*#spring.datasource.driver-class-name=com.mysql.jdbc.Driver#g" conf/application.properties
Q
qiaozhanwei 已提交
284 285 286 287 288

    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
B
bao liang 已提交
289
    sed -i ${txt} "s#org.quartz.jobStore.driverDelegateClass.*#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate#g" conf/quartz.properties
Q
qiaozhanwei 已提交
290 291 292
fi

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

X
xingchun-chen 已提交
298
    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 已提交
299 300 301
    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 已提交
302
    sed -i ${txt} "s#org.quartz.jobStore.driverDelegateClass.*#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.PostgreSQLDelegate#g" conf/quartz.properties
Q
qiaozhanwei 已提交
303
fi
D
dailidong 已提交
304

305 306 307 308 309 310
sed -i ${txt} "s#master.exec.threads.*#master.exec.threads=${masterExecThreads}#g" conf/application.properties
sed -i ${txt} "s#master.exec.task.num.*#master.exec.task.num=${masterExecTaskNum}#g" conf/application.properties
sed -i ${txt} "s#master.heartbeat.interval.*#master.heartbeat.interval=${masterHeartbeatInterval}#g" conf/application.properties
sed -i ${txt} "s#master.task.commit.retryTimes.*#master.task.commit.retryTimes=${masterTaskCommitRetryTimes}#g" conf/application.properties
sed -i ${txt} "s#master.task.commit.interval.*#master.task.commit.interval=${masterTaskCommitInterval}#g" conf/application.properties
sed -i ${txt} "s#master.reserved.memory.*#master.reserved.memory=${masterReservedMemory}#g" conf/application.properties
D
dailidong 已提交
311

312 313 314 315
sed -i ${txt} "s#worker.exec.threads.*#worker.exec.threads=${workerExecThreads}#g" conf/application.properties
sed -i ${txt} "s#worker.heartbeat.interval.*#worker.heartbeat.interval=${workerHeartbeatInterval}#g" conf/application.properties
sed -i ${txt} "s#worker.fetch.task.num.*#worker.fetch.task.num=${workerFetchTaskNum}#g" conf/application.properties
sed -i ${txt} "s#worker.reserved.memory.*#worker.reserved.memory=${workerReservedMemory}#g" conf/application.properties
D
dailidong 已提交
316

317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341
sed -i ${txt} "s#fs.defaultFS.*#fs.defaultFS=${defaultFS}#g" conf/common.properties
sed -i ${txt} "s#fs.s3a.endpoint.*#fs.s3a.endpoint=${s3Endpoint}#g" conf/common.properties
sed -i ${txt} "s#fs.s3a.access.key.*#fs.s3a.access.key=${s3AccessKey}#g" conf/common.properties
sed -i ${txt} "s#fs.s3a.secret.key.*#fs.s3a.secret.key=${s3SecretKey}#g" conf/common.properties
sed -i ${txt} "s#yarn.resourcemanager.ha.rm.ids.*#yarn.resourcemanager.ha.rm.ids=${yarnHaIps}#g" conf/common.properties
sed -i ${txt} "s#yarn.application.status.address.*#yarn.application.status.address=http://${singleYarnIp}:8088/ws/v1/cluster/apps/%s#g" conf/common.properties

sed -i ${txt} "s#data.basedir.path.*#data.basedir.path=${programPath}#g" conf/common.properties
sed -i ${txt} "s#data.download.basedir.path.*#data.download.basedir.path=${downloadPath}#g" conf/common.properties
sed -i ${txt} "s#process.exec.basepath.*#process.exec.basepath=${execPath}#g" conf/common.properties
sed -i ${txt} "s#hdfs.root.user.*#hdfs.root.user=${hdfsRootUser}#g" conf/common.properties
sed -i ${txt} "s#data.store2hdfs.basepath.*#data.store2hdfs.basepath=${hdfsPath}#g" conf/common.properties
sed -i ${txt} "s#res.upload.startup.type.*#res.upload.startup.type=${resUploadStartupType}#g" conf/common.properties
sed -i ${txt} "s#dolphinscheduler.env.path.*#dolphinscheduler.env.path=${shellEnvPath}#g" conf/common.properties
sed -i ${txt} "s#resource.view.suffixs.*#resource.view.suffixs=${resSuffixs}#g" conf/common.properties
sed -i ${txt} "s#development.state.*#development.state=${devState}#g" conf/common.properties
sed -i ${txt} "s#hadoop.security.authentication.startup.state.*#hadoop.security.authentication.startup.state=${kerberosStartUp}#g" conf/common.properties
sed -i ${txt} "s#java.security.krb5.conf.path.*#java.security.krb5.conf.path=${krb5ConfPath}#g" conf/common.properties
sed -i ${txt} "s#login.user.keytab.username.*#login.user.keytab.username=${keytabUserName}#g" conf/common.properties
sed -i ${txt} "s#login.user.keytab.path.*#login.user.keytab.path=${keytabPath}#g" conf/common.properties

sed -i ${txt} "s#zookeeper.quorum.*#zookeeper.quorum=${zkQuorum}#g" conf/common.properties
sed -i ${txt} "s#zookeeper.dolphinscheduler.root.*#zookeeper.dolphinscheduler.root=${zkRoot}#g" conf/common.properties
sed -i ${txt} "s#zookeeper.session.timeout.*#zookeeper.session.timeout=${zkSessionTimeout}#g" conf/common.properties
sed -i ${txt} "s#zookeeper.connection.timeout.*#zookeeper.connection.timeout=${zkConnectionTimeout}#g" conf/common.properties
342
sed -i ${txt} "s#zookeeper.retry.max.sleep.*#zookeeper.retry.max.sleep=${zkRetryMaxSleep}#g" conf/common.properties
343
sed -i ${txt} "s#zookeeper.retry.maxtime.*#zookeeper.retry.maxtime=${zkRetryMaxtime}#g" conf/common.properties
D
dailidong 已提交
344

Q
qiaozhanwei 已提交
345 346 347 348 349
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#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 已提交
350 351 352 353 354 355


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 已提交
356
sed -i ${txt} "s#mail.user.*#mail.user=${mailUser}#g" conf/alert.properties
D
dailidong 已提交
357
sed -i ${txt} "s#mail.passwd.*#mail.passwd=${mailPassword}#g" conf/alert.properties
358
sed -i ${txt} "s#mail.smtp.starttls.enable.*#mail.smtp.starttls.enable=${starttlsEnable}#g" conf/alert.properties
Q
qiaozhanwei 已提交
359
sed -i ${txt} "s#mail.smtp.ssl.trust.*#mail.smtp.ssl.trust=${sslTrust}#g" conf/alert.properties
360
sed -i ${txt} "s#mail.smtp.ssl.enable.*#mail.smtp.ssl.enable=${sslEnable}#g" conf/alert.properties
D
dailidong 已提交
361
sed -i ${txt} "s#xls.file.path.*#xls.file.path=${xlsFilePath}#g" conf/alert.properties
L
lgcareer 已提交
362 363 364 365
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 已提交
366

D
dailidong 已提交
367 368 369 370 371


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
372
sed -i ${txt} "s#sshPort.*#sshPort=${sshPort}#g" conf/config/install_config.conf
D
dailidong 已提交
373 374


375 376 377 378 379
sed -i ${txt} "s#masters.*#masters=${masters}#g" conf/config/install_config.conf
sed -i ${txt} "s#workers.*#workers=${workers}#g" conf/config/install_config.conf
sed -i ${txt} "s#alertServer.*#alertServer=${alertServer}#g" conf/config/install_config.conf
sed -i ${txt} "s#apiServers.*#apiServers=${apiServers}#g" conf/config/install_config.conf
sed -i ${txt} "s#sshPort.*#sshPort=${sshPort}#g" conf/config/install_config.conf
380 381


382 383
# 2,create directory
echo "2,create directory"
384 385

if [ ! -d $installPath ];then
D
dailidong 已提交
386 387
  sudo mkdir -p $installPath
  sudo chown -R $deployUser:$deployUser $installPath
388 389
fi

D
dailidong 已提交
390 391
hostsArr=(${ips//,/ })
for host in ${hostsArr[@]}
392 393
do

394
# create if programPath does not exist
395 396
if ! ssh -p $sshPort $host test -e $programPath; then
  ssh -p $sshPort $host "sudo mkdir -p $programPath;sudo chown -R $deployUser:$deployUser $programPath"
397 398
fi

399
# create if downloadPath does not exist
400 401
if ! ssh -p $sshPort $host test -e $downloadPath; then
  ssh -p $sshPort $host "sudo mkdir -p $downloadPath;sudo chown -R $deployUser:$deployUser $downloadPath"
402 403
fi

404
# create if execPath does not exist
405 406
if ! ssh -p $sshPort $host test -e $execPath; then
  ssh -p $sshPort $host "sudo mkdir -p $execPath; sudo chown -R $deployUser:$deployUser $execPath"
407 408
fi

409
# create if xlsFilePath does not exist
410 411
if ! ssh -p $sshPort $host test -e $xlsFilePath; then
  ssh -p $sshPort $host "sudo mkdir -p $xlsFilePath; sudo chown -R $deployUser:$deployUser $xlsFilePath"
412 413 414 415 416
fi

done


417 418 419
# 3,stop server
echo "3,stop server"
sh ${workDir}/script/stop-all.sh
420

421 422
# 4,delete zk node
echo "4,delete zk node"
Q
qiaozhanwei 已提交
423 424

sh ${workDir}/script/remove-zk-node.sh $zkRoot
425

426 427 428
# 5,scp resources
echo "5,scp resources"
sh ${workDir}/script/scp-hosts.sh
429 430
if [ $? -eq 0 ]
then
431
	echo 'scp copy completed'
432
else
433
	echo 'scp copy failed to exit'
434 435 436
	exit -1
fi

437 438
# 6,startup
echo "6,startup"
Q
qiaozhanwei 已提交
439
sh ${workDir}/script/start-all.sh