网络规划
复制代码
1
2
3#关闭防火墙 sudo systemctl stop firewalld && sudo systemctl disable firewalld;
- 虚拟机3台:
- ip: 10.0.0.30-32
- 主机名: p8-etcd-node01-master, p8-etcd-node02-slave01, p8-etcd-node03-slave02
- 命令:
复制代码
1
2
3vi /etc/sysconfig/network-scripts/ifcfg-ens33 hostnamectl set-hostname p8-etcd-node01-master && hostname p8-etcd-node01-master;
- 安装:
- 在线安装:
复制代码
1
2
3
4
5
6
7
8
9#安装 yum install -y etcd #验证 rpm -qa etcd #etcd-3.3.11-2.el7.centos.x86_64 etcdctl -v #etcdctl version: 3.3.11 #API version: 2
- 离线安装:
- 配置文件修改(每台localhost配置为自己的ip)
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20cp /etc/etcd/etcd.conf /etc/etcd/etcd.conf.bak vi /etc/etcd/etcd.conf # 打开 ETCD_LISTEN_PEER_URLS 和 ETCD_INITIAL_ADVERTISE_PEER_URLS 的注释 # 将 localhost 替换成本机 ip; 增加127.0.0.1访问权限 ETCD_LISTEN_PEER_URLS="http://10.0.0.30:2380" #无127.0.0.1:2379会报本机没有访问2379端口的权限 ETCD_LISTEN_CLIENT_URLS="http://10.0.0.30:2379,http://127.0.0.1:2379" ETCD_INITIAL_ADVERTISE_PEER_URLS="http://10.0.0.30:2380" ETCD_ADVERTISE_CLIENT_URLS="http://10.0.0.30:2379" # ETCD_NAME 的值对应配置为 Master, Node02, Node03 ETCD_NAME="Master" # 集群配置注释打开, default改为 ETCD_NAME 配置的值, 使用逗号分隔 ETCD_INITIAL_CLUSTER="Master=http://10.0.0.30:2380,Node02=http://10.0.0.31:2380,Node03=http://10.0.0.32:2380" ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster" ETCD_INITIAL_CLUSTER_STATE="new"
- 重启
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14#重启 systemctl restart etcd #验证 etcdctl member list #显示为 #5f44000e312e72: name=Node03 peerURLs=http://10.0.0.32:2380 clientURLs=http://10.0.0.32:2379 isLeader=false #2ed06313262270a9: name=Node02 peerURLs=http://10.0.0.31:2380 clientURLs=http://10.0.0.31:2379 isLeader=false #d3845ffbfa785ee1: name=Master peerURLs=http://10.0.0.30:2380 clientURLs=http://10.0.0.30:2379 isLeader=true #命令测试 etcdctl set name gin etcdctl get name
最后
以上就是舒服高跟鞋最近收集整理的关于etcd_install的全部内容,更多相关etcd_install内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复