🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
[TOC] ## 方式一 不使用 goreman 分别执行 ``` > bin/etcd --name infra1 --listen-client-urls http://0.0.0.0:2379 --advertise-client-urls http://0.0.0.0:2379 --listen-peer-urls http://0.0.0.0:12380 --initial-advertise-peer-urls http://0.0.0.0:12380 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=http://0.0.0.0:12380,infra2=http://0.0.0.0:22380,infra3=http://0.0.0.0:32380' --initial-cluster-state new --enable-pprof > bin/etcd --name infra2 --listen-client-urls http://0.0.0.0:22379 --advertise-client-urls http://0.0.0.0:22379 --listen-peer-urls http://0.0.0.0:22380 --initial-advertise-peer-urls http://0.0.0.0:22380 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=http://0.0.0.0:12380,infra2=http://0.0.0.0:22380,infra3=http://0.0.0.0:32380' --initial-cluster-state new --enable-pprof > bin/etcd --name infra3 --listen-client-urls http://0.0.0.0:32379 --advertise-client-urls http://0.0.0.0:32379 --listen-peer-urls http://0.0.0.0:32380 --initial-advertise-peer-urls http://0.0.0.0:32380 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=http://0.0.0.0:12380,infra2=http://0.0.0.0:22380,infra3=http://0.0.0.0:32380' --initial-cluster-state new --enable-pprof ``` 测试 ``` ./etcdctl -endpoint http://127.0.0.1:22379 set /1/2 "hello" ./etcdctl -endpoint http://127.0.0.1:32379 get /1/2 "hello" ``` ## 方式二 使用 goreman 创建 `Procfile` ``` etcd1: bin/etcd --name infra1 --listen-client-urls http://0.0.0.0:2379 --advertise-client-urls http://0.0.0.0:2379 --listen-peer-urls http://0.0.0.0:12380 --initial-advertise-peer-urls http://0.0.0.0:12380 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=http://0.0.0.0:12380,infra2=http://0.0.0.0:22380,infra3=http://0.0.0.0:32380' --initial-cluster-state new --enable-pprof etcd2: bin/etcd --name infra2 --listen-client-urls http://0.0.0.0:22379 --advertise-client-urls http://0.0.0.0:22379 --listen-peer-urls http://0.0.0.0:22380 --initial-advertise-peer-urls http://0.0.0.0:22380 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=http://0.0.0.0:12380,infra2=http://0.0.0.0:22380,infra3=http://0.0.0.0:32380' --initial-cluster-state new --enable-pprof etcd3: bin/etcd --name infra3 --listen-client-urls http://0.0.0.0:32379 --advertise-client-urls http://0.0.0.0:32379 --listen-peer-urls http://0.0.0.0:32380 --initial-advertise-peer-urls http://0.0.0.0:32380 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=http://0.0.0.0:12380,infra2=http://0.0.0.0:22380,infra3=http://0.0.0.0:32380' --initial-cluster-state new --enable-pprof ``` `goreman start`