要点,将etcd拷贝到不同的目录,每个etcd用不同的端口号,cd到etcd目录,做如下配置即可:
./etcd --name etcd00 --initial-advertise-peer-urls http://192.168.75.145:2380 \
--listen-peer-urls http://192.168.75.145:2380 \
--listen-client-urls http://192.168.75.145:2379,http://127.0.0.1:2379 \
--advertise-client-urls http://192.168.75.145:2379 \
--initial-cluster-token etcd-cluster-1 \
--initial-cluster etcd00=http://192.168.75.145:2380,etcd01=http://192.168.75.145:3380,etcd02=http://192.168.75.145:4380 \
--initial-cluster-state new
================================
./etcd --name etcd01 --initial-advertise-peer-urls http://192.168.75.145:3380 \
--listen-peer-urls http://192.168.75.145:3380 \
--listen-client-urls http://192.168.75.145:3379,http://127.0.0.1:3379 \
--advertise-client-urls http://192.168.75.145:3379 \
--initial-cluster-token etcd-cluster-1 \
--initial-cluster etcd00=http://192.168.75.145:2380,etcd01=http://192.168.75.145:3380,etcd02=http://192.168.75.145:4380 \
--initial-cluster-state new
================================
./etcd --name etcd02 --initial-advertise-peer-urls http://192.168.75.145:4380 \
--listen-peer-urls http://192.168.75.145:4380 \
--listen-client-urls http://192.168.75.145:4379,http://127.0.0.1:4379 \
--advertise-client-urls http://192.168.75.145:4379 \
--initial-cluster-token etcd-cluster-1 \
--initial-cluster etcd00=http://192.168.75.145:2380,etcd01=http://192.168.75.145:3380,etcd02=http://192.168.75.145:4380 \
--initial-cluster-state new
当然了,可以直接按照上面启动,也可以放到一个shell文件里面启动。