操作环境
- 三台AlpineLinux主机
- 主机名分别为
host-11/12/13
- IP地址分别为
192.168.0.11/12/13
- 主机名分别为
自动执行脚本
#!/bin/sh
#
###############################################################
# consul-1/2/3
apk add consul
rc-update add consul boot
cat <<EOF >/etc/consul/server.json
{
"datacenter": "test",
"data_dir": "/var/consul",
"server": true,
"bootstrap_expect": 3,
"bind_addr": "{{ GetInterfaceIP \"eth0\" }}",
"client_addr": "0.0.0.0",
"retry_join": [
"192.168.0.11",
"192.168.0.12",
"192.168.0.13"
],
"ui_config": {
"enabled": true
}
}
EOF
rc-service consul start
###############################################################
# consul-cli
consul members
consul operator raft list-peers
正文完