服務端啟動腳本
#/bin/bash!
echo "******************************************************************************************"
echo "* 注意: *"
echo "* consul 已經使用supervisor服務進行管理 *"
echo "* 如要啟動請執行 supervisorctl update *"
echo "* 啟動/重啟服務: supervisorctl start/restart consul *"
echo "* 查看運行狀態: supervisorctl status *"
echo "******************************************************************************************"
#consul agent -server -ui -bootstrap-expect 1 -client=10.100.5.29 -data-dir /home/changcheng/app/tools/monitor/consul/data -log-file /home/changcheng/app/tools/monitor/consul/log/consul_log-$(date +%Y-%m-%d--%H-%M)
客戶端
get_ip=`ip a show dev eth0|grep -w inet|awk '{print $2}'|awk -F '/' '{print $1}'|head -n 1`
cat > $app_path/join.sh << _FEOF
#!/bin/bash
cd /home/changcheng/app/consul && ./consul join $consul_server
_FEOF
cat > $app_path/start.sh << _BEOF
#!/bin/bash
nohup /home/changcheng/app/consul/consul agent -data-dir /home/changcheng/data/consul -node=${get_ip} -bind= -client=0.0.0.0 -retry-join ${consul_server} >> /home/changcheng/app/consul/consul.log &
_BEOF