etcd v3 集群——简单配置
2017-08-02 00:00
696 查看
摘要: For K8S
一、etcd v3安装:
#如果不设置 ETCDCTL_API=3,则默认是的API版本是2
二、集群配置:
单机,双点,可根据实际情况修改端口
参数说明:
三、实例:
一、etcd v3安装:
tar -axf etcd-v3.2.0-linux-amd64.tar.gz -C /usr/local/src/ chmod a+x /usr/local/src/etcd-v3.2.0-linux-amd64/etcd* cp -a /usr/local/src/etcd-v3.2.0-linux-amd64/etcd* /usr/local/bin/ |
export ETCDCTL_API=3 echo 'export ETCDCTL_API=3' >> /etc/profile |
单机,双点,可根据实际情况修改端口
#node1 etcd -name perofu1 -debug \ -initial-advertise-peer-urls http://0.0.0.0:2380 \ -listen-peer-urls http://0.0.0.0:2380 \ -listen-client-urls http://0.0.0.0:2379 \ -advertise-client-urls http://0.0.0.0:2379 \ -initial-cluster-token etcd-cluster-1 \ -initial-cluster perofu1=http://0.0.0.0:2380,perofu2=http://0.0.0.0:4380 \ -initial-cluster-state new >> /var/log/kubernetes/test-etcd.log 2>&1 & #node2 etcd -name perofu2 -debug \ -initial-advertise-peer-urls http://0.0.0.0:4380 \ -listen-peer-urls http://0.0.0.0:4380 \ -listen-client-urls http://0.0.0.0:4379 \ -advertise-client-urls http://0.0.0.0:4379 \ -initial-cluster-token etcd-cluster-1 \ -initial-cluster perofu1=http://0.0.0.0:2380,perofu2=http://0.0.0.0:4380 \ -initial-cluster-state new >> /var/log/kubernetes/test-etcd-1.log 2>&1 & |
● –data-dir 指定节点的数据存储目录,若不指定,则默认是当前目录。这些数据包括节点ID,集群ID,集群初始化配置,Snapshot文件,若未指 定–wal-dir,还会存储WAL文件 ● –wal-dir 指定节点的was文件存储目录,若指定了该参数,wal文件会和其他数据文件分开存储 ● –name 节点名称 ● –initial-advertise-peer-urls 告知集群其他节点的URL,tcp 2380端口用于集群通信 ● –listen-peer-urls 监听URL,用于与其他节点通讯 ● –advertise-client-urls 告知客户端的URL, 也就是服务的URL,tcp 2379端口用于监听客户端请求 ● –initial-cluster-token 集群的ID ● –initial-cluster 集群中所有节点 ● –initial-cluster-state 集群状态,new为新创建集群,existing为已存在的集群 |
[root@www ~]# curl -s http://192.168.0.211:2379/v2/machines http://0.0.0.0:2379, http://0.0.0.0:4379 [root@www ~]# [root@www ~]# etcdctl member list 25a7dd0a87b3530: name=perofu2 peerURLs=http://0.0.0.0:4380 clientURLs=http://0.0.0.0:4379 isLeader=false 2006f2ad47deea09: name=perofu1 peerURLs=http://0.0.0.0:2380 clientURLs=http://0.0.0.0:2379 isLeader=true [root@www ~]# [root@www ~]# etcdctl cluster-health member 25a7dd0a87b3530 is healthy: got healthy result from http://0.0.0.0:4379 member 2006f2ad47deea09 is healthy: got healthy result from http://0.0.0.0:2379 cluster is healthy #设置key [root@www ~]# etcdctl --endpoints "http://127.0.0.1:2379" set api_server http://192.168.0.211:8080 http://192.168.0.211:8080 [root@www ~]# [root@www ~]# etcdctl --endpoints "http://127.0.0.1:2379" get api_server http://192.168.0.211:8080 [root@www ~]# [root@www ~]# etcdctl --endpoints "http://127.0.0.1:4379" get api_server http://192.168.0.211:8080 [root@www ~]# |
相关文章推荐
- etcd v3 集群——简单配置
- ETCD集群安装配置及简单应用
- apache jk_mod和tomcat集群做负载均衡简单配置
- Kubernetes学习系列之简单集群安装与配置
- Redis简单梳理及集群配置
- Redis简单集群配置
- 做简单的集群SSH免密码配置(只需要在1台机器操作!只需要2步!)
- Etcd配置集群但不起作用的解决办法
- 最详细的hadoop2.2.0集群的HA高可靠的最简单配置
- SpringCloud(第 054 篇)简单 Quartz-Cluster 微服务,采用注解配置 Quartz 分布式集群
- 【Quartz】配置最简单的集群
- 最详细的hadoop2.2.0集群的HA高可靠的最简单配置
- hadoop2.2.0集群的高可用HA及MapReduce简单配置
- 简单易懂的Tomcat+Apache集群配置
- NAT和DR负载均衡集群简单配置
- Zookeeper介绍和简单3台配置集群
- 用LVS配置一个简单的web LB集群
- zookeeper简单的集群配置!
- Nginx + Tomcat 配置负载均衡集群简单实例
- Redis集群 - 配置最简单的Redis主从