etcd 配置文件是一个 YAML 格式的文件,包含 etcd 服务器的各种配置选项,例如监听的地址和端口、数据存储路径、集群节点信息、身份验证等。以下是一个示例 etcd 配置文件:
# 监听地址和端口
advertise-client-urls: http://192.168.1.100:2379
listen-client-urls: http://0.0.0.0:2379
# 数据存储目录
data-dir: /var/lib/etcd
# 集群节点信息
initial-cluster-state: new
initial-cluster-token: etcd-cluster-1
initial-cluster:
node-1=http://192.168.1.100:2380,node-2=http://192.168.1.101:2380,node-3=http://192.168.1.102:2380
# 身份验证
auth-enabled: true
上述配置文件中,advertise-client-urls 指定 etcd 服务器对外公开的客户端访问地址和端口;listen-client-urls 指定 etcd 服务器监听的客户端访问地址和端口;data-dir 指定 etcd 存储数据的目录;initial-cluster 指定 etcd 集群中各个节点的地址和端口;auth-enabled 指定是否启用身份验证功能。




