php微服务之consul群集构建

wget consul/1.4.1/consul_1.4.1_linux_amd64.zipunzip consul_1.4.1_linux_amd64.zipyum install -y unzip zipmv consul /usr/local/bin/mkdir /var/consulmkdir /etc/consul.d
consul agent -server -bootstrap-expect 1 -bind=192.168.4.117 -client=0.0.0.0 -data-dir=/var/consul -ui -node=192.168.4.117 -advertise-wan=192.168.4.117 -advertise=192.168.4.117
consul agent -server -bind=192.168.4.123 -client=0.0.0.0 -data-dir=/var/consul -ui -node=192.168.4.123 -client 0.0.0.0 -advertise=192.168.4.123 -join=192.168.4.117
consul agent -bind=192.168.4.115 -data-dir=/var/consul -ui -node=192.168.4.115 -client 0.0.0.0 -ui -advertise=121.196.219.40 -join=192.168.4.123

 

注:假如想撤出群集务必实行consul leave命令,强制撤出会不断輸出系统日志xx连接点联接不成功, 假如想改动某一台服务端连接点为顾客端,请先撤出连接点后在实行添加顾客端命令,不然還是会一直提示xx连接点联接不成功。