<em>Mac</em>Book项目 2009年学校开始实施<em>Mac</em>Book项目,所有师生配备一本<em>Mac</em>Book,并同步更新了校园无线网络。学校每周进行电脑技术更新,每月发送技术支持资料,极大改变了教学及学习方式。因此2011
2021-06-01 09:32:01
需要安裝:
docker
docker-compose
引數詳細:
–name
:設定成員節點的別名,建議為每個成員節點設定可識別的命名–advertise-client-urls
:廣播到叢集中本成員的監聽使用者端請求的地址–initial-advertise-peer-urls
:廣播到叢集中本成員的Peer監聽通訊地址–listen-client-urls
:使用者端請求的監聽地址列表–listen-peer-urls
:Peer訊息的監聽服務地址列表–initial-cluster-token
:啟動叢集的時候指定叢集口令,只有相同token的幾點才能加入到同一叢集–initial-cluster
:所有叢集節點的地址列表–initial-cluster-state
:初始化叢集狀態,預設為new,也可以指定為exi-string表示要加入到一個已有叢集mkdir -p ./etcd-node{1,2,3}
docker network create --driver bridge --subnet 172.62.0.0/16 --gateway 172.62.0.1 etcd-cluster
version: '3' networks: etcd-cluster: external: true services: etcd-node1: image: quay.io/coreos/etcd:v3.3.1 container_name: etcd-node1 ports: - "12379:2379" - "12380:2380" restart: always volumes: - ./etcd-node1:/data/app/etcd command: etcd --name etcd-node1 --data-dir /data/app/etcd/ --advertise-client-urls http://172.62.0.10:2379 --initial-advertise-peer-urls http://172.62.0.10:2380 --listen-client-urls http://0.0.0.0:2379 --listen-peer-urls http://0.0.0.0:2380 --initial-cluster-token etcd-cluster --initial-cluster "etcd-node1=http://172.62.0.10:2380,etcd-node2=http://172.62.0.11:2380,etcd-node3=http://172.62.0.12:2380" --initial-cluster-state new networks: etcd-cluster: ipv4_address: 172.62.0.10 etcd-node2: image: quay.io/coreos/etcd:v3.3.1 container_name: etcd-node2 ports: - "22379:2379" - "22380:2380" restart: always volumes: - ./etcd-node2:/data/app/etcd command: etcd --name etcd-node2 --data-dir /data/app/etcd/ --advertise-client-urls http://172.62.0.11:2379 --initial-advertise-peer-urls http://172.62.0.11:2380 --listen-client-urls http://0.0.0.0:2379 --listen-peer-urls http://0.0.0.0:2380 --initial-cluster-token etcd-cluster --initial-cluster "etcd-node1=http://172.62.0.10:2380,etcd-node2=http://172.62.0.11:2380,etcd-node3=http://172.62.0.12:2380" --initial-cluster-state new networks: etcd-cluster: ipv4_address: 172.62.0.11 etcd-node3: image: quay.io/coreos/etcd:v3.3.1 container_name: etcd-node3 ports: - "32379:2379" - "32380:2380" restart: always volumes: - ./etcd-node3:/data/app/etcd command: etcd --name etcd-node3 --data-dir /data/app/etcd/ --advertise-client-urls http://172.62.0.12:2379 --initial-advertise-peer-urls http://172.62.0.12:2380 --listen-client-urls http://0.0.0.0:2379 --listen-peer-urls http://0.0.0.0:2380 --initial-cluster-token etcd-cluster --initial-cluster "etcd-node1=http://172.62.0.10:2380,etcd-node2=http://172.62.0.11:2380,etcd-node3=http://172.62.0.12:2380" --initial-cluster-state new networks: etcd-cluster: ipv4_address: 172.62.0.12
[root@k8s-node1 etcd-cluster]# docker-compose -f etcd-cluster-compose.yml up -d Pulling etcd-node1 (quay.io/coreos/etcd:v3.3.1)... v3.3.1: Pulling from coreos/etcd ff3a5c916c92: Pull complete dec5fcc85a18: Pull complete 3944f16f0112: Pull complete 0b6d29b049fe: Pull complete d8c39ae91d38: Pull complete 42fcea4864ba: Pull complete Digest: sha256:454e69370d87554dcb4272833b8f07ce1b5d457caa153bda4070b76d89a1cc97 Status: Downloaded newer image for quay.io/coreos/etcd:v3.3.1 Creating etcd-node1 ... done Creating etcd-node2 ... done Creating etcd-node3 ... done
[root@k8s-node1 etcd-cluster]# docker-compose -f etcd-cluster-compose.yml ps -a Name Command State Ports ------------------------------------------------------------------------------------------------------ etcd-node1 etcd --name etcd-node1 --d ... Up 0.0.0.0:12379->2379/tcp, 0.0.0.0:12380->2380/tcp etcd-node2 etcd --name etcd-node2 --d ... Up 0.0.0.0:22379->2379/tcp, 0.0.0.0:22380->2380/tcp etcd-node3 etcd --name etcd-node3 --d ... Up 0.0.0.0:32379->2379/tcp, 0.0.0.0:32380->2380/tcp
通過etcdctl member list命令可以查詢出所有叢集節點的列表並且結果一致即為成功
[root@k8s-node1 etcd-cluster]# docker exec -it etcd-node1 /bin/sh / # etcdctl member list 8cef47d732d4acff: name=etcd-node1 peerURLs=http://172.62.0.10:2380 clientURLs=http://172.62.0.10:2379 isLeader=false c93af917b643516f: name=etcd-node3 peerURLs=http://172.62.0.12:2380 clientURLs=http://172.62.0.12:2379 isLeader=true cdee7114ad135065: name=etcd-node2 peerURLs=http://172.62.0.11:2380 clientURLs=http://172.62.0.11:2379 isLeader=false / # exit [root@k8s-node1 etcd-cluster]# docker exec -it etcd-node2 /bin/sh / # etcdctl member list 8cef47d732d4acff: name=etcd-node1 peerURLs=http://172.62.0.10:2380 clientURLs=http://172.62.0.10:2379 isLeader=false c93af917b643516f: name=etcd-node3 peerURLs=http://172.62.0.12:2380 clientURLs=http://172.62.0.12:2379 isLeader=true cdee7114ad135065: name=etcd-node2 peerURLs=http://172.62.0.11:2380 clientURLs=http://172.62.0.11:2379 isLeader=false [root@k8s-node1 etcd-cluster]# docker exec -it etcd-node3 /bin/sh / # etcdctl member list 8cef47d732d4acff: name=etcd-node1 peerURLs=http://172.62.0.10:2380 clientURLs=http://172.62.0.10:2379 isLeader=false c93af917b643516f: name=etcd-node3 peerURLs=http://172.62.0.12:2380 clientURLs=http://172.62.0.12:2379 isLeader=true cdee7114ad135065: name=etcd-node2 peerURLs=http://172.62.0.11:2380 clientURLs=http://172.62.0.11:2379 isLeader=false
新增
[root@k8s-node1 etcd-cluster]# docker-compose -f etcd-cluster-compose.yml ps -a Name Command State Ports ------------------------------------------------------------------------------------------------------ etcd-node1 etcd --name etcd-node1 --d ... Up 0.0.0.0:12379->2379/tcp, 0.0.0.0:12380->2380/tcp etcd-node2 etcd --name etcd-node2 --d ... Up 0.0.0.0:22379->2379/tcp, 0.0.0.0:22380->2380/tcp etcd-node3 etcd --name etcd-node3 --d ... Up 0.0.0.0:32379->2379/tcp, 0.0.0.0:32380->2380/tcp [root@k8s-node1 etcd-cluster]# curl -L http://127.0.0.1:12379/version {"etcdserver":"3.3.1","etcdcluster":"3.3.0"}[root@k8s-node1 etcd-cluster]# [root@k8s-node1 etcd-cluster]# curl -L http://127.0.0.1:12379/v2/keys/Alexclownfish -X PUT -d value=https://blog.alexcld.com {"action":"set","node":{"key":"/Alexclownfish","value":"https://blog.alexcld.com","modifiedIndex":19,"createdIndex":19}}
查詢
[root@k8s-node1 etcd-cluster]# curl -L http://127.0.0.1:12379/v2/keys/Alexclownfish -X GET {"action":"get","node":{"key":"/Alexclownfish","value":"https://blog.alexcld.com","modifiedIndex":19,"createdIndex":19}} [root@k8s-node1 etcd-cluster]# curl -L http://127.0.0.1:22379/v2/keys/Alexclownfish -X GET {"action":"get","node":{"key":"/Alexclownfish","value":"https://blog.alexcld.com","modifiedIndex":19,"createdIndex":19}} [root@k8s-node1 etcd-cluster]# curl -L http://127.0.0.1:32379/v2/keys/Alexclownfish -X GET {"action":"get","node":{"key":"/Alexclownfish","value":"https://blog.alexcld.com","modifiedIndex":19,"createdIndex":19}}
修改
同新建一樣
刪除
[root@k8s-node1 etcd-cluster]# curl -L http://127.0.0.1:12379/v2/keys/Alexclownfish -X DELETE {"action":"delete","node":{"key":"/Alexclownfish","modifiedIndex":20,"createdIndex":19},"prevNode":{"key":"/Alexclownfish","value":"https://blog.alexcld.com","modifiedIndex":19,"createdIndex":19}} [root@k8s-node1 etcd-cluster]# curl -L http://127.0.0.1:12379/v2/keys/Alexclownfish -X GET {"errorCode":100,"message":"Key not found","cause":"/Alexclownfish","index":20}
新增
/ # etcdctl set clownfish 1234567 1234567 / # etcdctl get clownfish 1234567
查詢
/ # etcdctl get clownfish 1234567
修改
/ # etcdctl get clownfish 1234567 / # etcdctl set clownfish 987654321ddd 987654321ddd / # etcdctl get clownfish 987654321ddd
刪除
/ # etcdctl rm clownfish PrevNode.Value: 987654321ddd / # etcdctl get clownfish Error: 100: Key not found (/clownfish) [23]
以上為個人經驗,希望能給大家一個參考,也希望大家多多支援it145.com。
相關文章
<em>Mac</em>Book项目 2009年学校开始实施<em>Mac</em>Book项目,所有师生配备一本<em>Mac</em>Book,并同步更新了校园无线网络。学校每周进行电脑技术更新,每月发送技术支持资料,极大改变了教学及学习方式。因此2011
2021-06-01 09:32:01
综合看Anker超能充系列的性价比很高,并且与不仅和iPhone12/苹果<em>Mac</em>Book很配,而且适合多设备充电需求的日常使用或差旅场景,不管是安卓还是Switch同样也能用得上它,希望这次分享能给准备购入充电器的小伙伴们有所
2021-06-01 09:31:42
除了L4WUDU与吴亦凡已经多次共事,成为了明面上的厂牌成员,吴亦凡还曾带领20XXCLUB全队参加2020年的一场音乐节,这也是20XXCLUB首次全员合照,王嗣尧Turbo、陈彦希Regi、<em>Mac</em> Ova Seas、林渝植等人全部出场。然而让
2021-06-01 09:31:34
目前应用IPFS的机构:1 谷歌<em>浏览器</em>支持IPFS分布式协议 2 万维网 (历史档案博物馆)数据库 3 火狐<em>浏览器</em>支持 IPFS分布式协议 4 EOS 等数字货币数据存储 5 美国国会图书馆,历史资料永久保存在 IPFS 6 加
2021-06-01 09:31:24
开拓者的车机是兼容苹果和<em>安卓</em>,虽然我不怎么用,但确实兼顾了我家人的很多需求:副驾的门板还配有解锁开关,有的时候老婆开车,下车的时候偶尔会忘记解锁,我在副驾驶可以自己开门:第二排设计很好,不仅配置了一个很大的
2021-06-01 09:30:48
不仅是<em>安卓</em>手机,苹果手机的降价力度也是前所未有了,iPhone12也“跳水价”了,发布价是6799元,如今已经跌至5308元,降价幅度超过1400元,最新定价确认了。iPhone12是苹果首款5G手机,同时也是全球首款5nm芯片的智能机,它
2021-06-01 09:30:45