centos7.6下部署ETCD3.4.7集群的详细步骤
这篇文章主要讲解了“centos7.6下部署ETCD3.4.7 集群的详细步骤”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“centos7.6下部署ETCD3.4.7 集群的详细步骤”吧!
创新互联建站专注为客户提供全方位的互联网综合服务,包含不限于网站制作、网站建设、万年网络推广、成都小程序开发、万年网络营销、万年企业策划、万年品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们最大的嘉奖;创新互联建站为所有大学生创业者提供万年建站搭建服务,24小时服务热线:18980820575,官方网址:www.cdcxhl.com
安装包地址:
https://github.com/etcd-io/etcd/releases
解压安装文件
tar -xvf etcd-v3.4.7-linux-amd64.tar.gz cd etcd-v3.4.7-linux-amd64 cp etcd etcdctl /k8s/etcd/bin/
设置etcd的配置文件
cat /k8s/etcd/cfg/etcd #[Member] ETCD_NAME="etcd01" ETCD_DATA_DIR="/var/lib/etcd/default.etcd" ETCD_LISTEN_PEER_URLS="https://192.168.2.88:2380" ETCD_LISTEN_CLIENT_URLS="https://192.168.2.88:2379" #[Clustering] ETCD_INITIAL_ADVERTISE_PEER_URLS="https://192.168.2.88:2380" ETCD_ADVERTISE_CLIENT_URLS="https://192.168.2.88:2379" ETCD_INITIAL_CLUSTER="etcd01=https://192.168.2.88:2380,etcd02=https://192.168.2.81:2380,etcd03=https://192.168.2.82:2380" ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster"
创建 etcd的 systemd unit 文件
cat /usr/lib/systemd/system/etcd.service
[Unit] Description=Etcd Server After=network.target After=network-online.target Wants=network-online.target [Service] Type=notify EnvironmentFile=/k8s/etcd/cfg/etcd ExecStart=/k8s/etcd/bin/etcd \ --initial-cluster-state=new \ --cert-file=/k8s/etcd/ssl/server.pem \ --key-file=/k8s/etcd/ssl/server-key.pem \ --peer-cert-file=/k8s/etcd/ssl/server.pem \ --peer-key-file=/k8s/etcd/ssl/server-key.pem \ --trusted-ca-file=/k8s/etcd/ssl/ca.pem \ --peer-trusted-ca-file=/k8s/etcd/ssl/ca.pem Restart=on-failure LimitNOFILE=65536 [Install] WantedBy=multi-user.target
启动ETCD服务
systemctl daemon-reload systemctl enable etcd systemctl start etcd
查看etcd状态
systemctl status etcd ● etcd.service - Etcd Server Loaded: loaded (/usr/lib/systemd/system/etcd.service; enabled; vendor preset: disabled) Active: active (running) since Tue 2019-07-09 15:55:58 CST; 1h 12min ago Main PID: 29830 (etcd) Tasks: 12 Memory: 66.7M CGroup: /system.slice/etcd.service └─29830 /k8s/etcd/bin/etcd --name=etcd01 --data-dir=/var/lib/etcd/default.etcd --listen-peer-urls=https://192.168.1.10... Jul 09 17:07:39 qas-k8s-master01 etcd[29830]: the clock difference against peer 2369b1ebd5f356e7 is too high [1.340843978s ...SAGE") Jul 09 17:07:39 qas-k8s-master01 etcd[29830]: the clock difference against peer 2369b1ebd5f356e7 is too high [1.343013157s ...SHOT") Jul 09 17:08:04 qas-k8s-master01 etcd[29830]: the clock difference against peer 67ad1178efd89256 is too high [1.287315582s ...SHOT") Jul 09 17:08:04 qas-k8s-master01 etcd[29830]: the clock difference against peer 67ad1178efd89256 is too high [1.285244104s ...SAGE") Jul 09 17:08:09 qas-k8s-master01 etcd[29830]: the clock difference against peer 2369b1ebd5f356e7 is too high [1.340602239s ...SAGE") Jul 09 17:08:09 qas-k8s-master01 etcd[29830]: the clock difference against peer 2369b1ebd5f356e7 is too high [1.342891162s ...SHOT") Jul 09 17:08:34 qas-k8s-master01 etcd[29830]: the clock difference against peer 67ad1178efd89256 is too high [1.285259365s ...SAGE") Jul 09 17:08:34 qas-k8s-master01 etcd[29830]: the clock difference against peer 67ad1178efd89256 is too high [1.287337806s ...SHOT") Jul 09 17:08:39 qas-k8s-master01 etcd[29830]: the clock difference against peer 2369b1ebd5f356e7 is too high [1.342999378s ...SHOT") Jul 09 17:08:39 qas-k8s-master01 etcd[29830]: the clock difference against peer 2369b1ebd5f356e7 is too high [1.339802949s ...SAGE") Hint: Some lines were ellipsized, use -l to show in full.
将启动文件、配置文件拷贝到 节点1、节点2
cd /k8s/ scp -r etcd 192.168.2.81:/k8s/ scp -r etcd 192.168.2.82:/k8s/ scp /usr/lib/systemd/system/etcd.service 192.168.2.81:/usr/lib/systemd/system/etcd.service scp /usr/lib/systemd/system/etcd.service 192.168.2.82:/usr/lib/systemd/system/etcd.service
node01节点修改
cat /k8s/etcd/cfg/etcd
#[Member] ETCD_NAME="etcd02" ETCD_DATA_DIR="/var/lib/etcd/default.etcd" ETCD_LISTEN_PEER_URLS="https://192.168.2.81:2380" ETCD_LISTEN_CLIENT_URLS="https://192.168.2.81:2379" #[Clustering] ETCD_INITIAL_ADVERTISE_PEER_URLS="https://192.168.2.81:2380" ETCD_ADVERTISE_CLIENT_URLS="https://192.168.2.81:2379" ETCD_INITIAL_CLUSTER="etcd01=https://192.168.2.88:2380,etcd02=https://192.168.2.81:2380,etcd03=https://192.168.2.82:2380" ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster"
node02节点修改
cat /k8s/etcd/cfg/etcd
#[Member] ETCD_NAME="etcd03" ETCD_DATA_DIR="/var/lib/etcd/default.etcd" ETCD_LISTEN_PEER_URLS="https://192.168.2.82:2380" ETCD_LISTEN_CLIENT_URLS="https://192.168.2.82:2379" #[Clustering] ETCD_INITIAL_ADVERTISE_PEER_URLS="https://192.168.2.82:2380" ETCD_ADVERTISE_CLIENT_URLS="https://192.168.2.82:2379" ETCD_INITIAL_CLUSTER="etcd01=https://192.168.2.88:2380,etcd02=https://192.168.2.81:2380,etcd03=https://192.168.2.82:2380" ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster"
验证集群是否正常运行
./etcdctl --cacert=/k8s/etcd/ssl/ca.pem --cert=/k8s/etcd/ssl/server.pem --key=/k8s/etcd/ssl/server-key.pem --endpoints="https://192.168.2.88:2379,https://192.168.2.81:2379,https://192.168.2.82:2379" endpoint health
注意: 启动ETCD集群同时启动二个节点,启动一个节点集群是无法正常启动的; 返回以下表示ok
https://192.168.2.82:2379 is healthy: successfully committed proposal: took = 15.675731ms https://192.168.2.88:2379 is healthy: successfully committed proposal: took = 15.764248ms https://192.168.2.81:2379 is healthy: successfully committed proposal: took = 14.121678ms
感谢各位的阅读,以上就是“centos7.6下部署ETCD3.4.7 集群的详细步骤”的内容了,经过本文的学习后,相信大家对centos7.6下部署ETCD3.4.7 集群的详细步骤这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是创新互联,小编将为大家推送更多相关知识点的文章,欢迎关注!
标题名称:centos7.6下部署ETCD3.4.7集群的详细步骤
分享地址:http://ybzwz.com/article/peeppi.html