Skip to content

Commit

Permalink
support restart all services
Browse files Browse the repository at this point in the history
  • Loading branch information
yudong2015 committed Sep 22, 2023
1 parent 0c85e1b commit c72e9d8
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
8 changes: 6 additions & 2 deletions package/cluster.json.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,15 @@
"services": {
"start": {
"order": 2,
"cmd": "USER=root /opt/hbase/bin/start.sh;echo balance_switch true | /opt/hbase/bin/hbase shell"
"cmd": "USER=root /opt/hbase/bin/start.sh"
},
"restart": {
"order": 1,
"cmd": "USER=root /opt/hbase/bin/restart.sh"
},
"stop": {
"order": 1,
"cmd": "USER=root echo balance_switch false | /opt/hbase/bin/hbase shell;/opt/hbase/bin/stop.sh"
"cmd": "USER=root /opt/hbase/bin/stop.sh"
},
"scale_out": {
"order": 2,
Expand Down
2 changes: 1 addition & 1 deletion src/node/conf.d/hdfs-site.xml.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ dest = "/opt/hadoop/etc/hadoop/hdfs-site.xml.tmp"
keys = [
"/",
]
reload_cmd = "cp /opt/hadoop/etc/hadoop/hdfs-site.xml.tmp /opt/hadoop/etc/hadoop/hdfs-site.xml;sh /opt/hbase/bin/reload-hdfs-site.sh;/opt/hadoop/sbin/restart-dfs.sh"
reload_cmd = "cp /opt/hadoop/etc/hadoop/hdfs-site.xml.tmp /opt/hadoop/etc/hadoop/hdfs-site.xml;sh /opt/hbase/bin/reload-hdfs-site.sh"
7 changes: 7 additions & 0 deletions src/node/conf.d/restart.sh.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[template]
src = "restart.sh.tmpl"
dest = "/opt/hbase/bin/restart.sh"
mode = "0777"
keys = [
"/",
]
21 changes: 21 additions & 0 deletions src/node/templates/restart.sh.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

role='{{getv "/host/role"}}'
if [ "x$role" = "xhbase-master" ]
then
exit 0
fi


# stop all hbase services
USER=root /opt/hbase/bin/stop.sh


{{range $dir := lsdir "/hosts/hbase-hdfs-master/"}}{{$ip := printf "/hosts/hbase-hdfs-master/%s/ip" $dir}}
HBASE_HDFS_MASTER_IP={{getv $ip}}{{end}}
# restart hdfs
USER=root ssh ${HBASE_HDFS_MASTER_IP} "/opt/hadoop/sbin/restart-dfs.sh"


# start all hbase services
USER=root /opt/hbase/bin/start.sh

0 comments on commit c72e9d8

Please sign in to comment.