consul命令记录

服务端启动脚本

#/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
原文地址:https://www.cnblogs.com/lizhaojun-ops/p/10676534.html