一、安装
1.进入官网
2. 点击release版本链接
或者直接点击这个链接地址
3. 点击下载
4. 解压出如下目录
5. 进入目录,启动服务
java0904@weigongdeMacBook-Pro ~ % cd /Users/java0904/Downloads/etcd-v3.5.1-darwin-amd64
java0904@weigongdeMacBook-Pro etcd-v3.5.1-darwin-amd64 % ll
total 153960
drwxr-xr-x@ 12 java0904 staff 384 10 18 11:28 ./
drwx------@ 200 java0904 staff 6400 10 18 11:25 ../
drwxr-xr-x@ 4 java0904 staff 128 10 15 22:21 Documentation/
-rw-r--r--@ 1 java0904 staff 42066 10 15 22:21 README-etcdctl.md
-rw-r--r--@ 1 java0904 staff 7359 10 15 22:21 README-etcdutl.md
-rw-r--r--@ 1 java0904 staff 9394 10 15 22:21 README.md
-rw-r--r--@ 1 java0904 staff 7896 10 15 22:21 READMEv2-etcdctl.md
drwx------ 3 java0904 staff 96 10 18 11:28 default.etcd/
-rwxr-xr-x@ 1 java0904 staff 32118928 10 15 22:21 etcd*
-rwxr-xr-x@ 1 java0904 staff 24603248 10 15 22:21 etcdctl*
-rwxr-xr-x@ 1 java0904 staff 22013168 10 15 22:21 etcdutl*
-rw------- 1 java0904 staff 12041 10 18 13:15 nohup.out
java0904@weigongdeMacBook-Pro etcd-v3.5.1-darwin-amd64 % nohup ./etcd &
[1] 97368
java0904@weigongdeMacBook-Pro etcd-v3.5.1-darwin-amd64 % appending output to nohup.out
二、使用
1. put
./etcdctl put name cloud
OK
2.get
./etcdctl get name
name
cloud
3. del
./etcdctl del name
1
4. watch
./etcdctl watch name
PUT
name
cloud
DELETE
name
PUT
name
cloud
DELETE
name
5. lease
./etcdctl lease grant 120
lease 694d7c91d5e3fc0c granted with TTL(120s)
java0904@weigongdeMacBook-Pro etcd-v3.5.1-darwin-amd64 % ./etcdctl put name cloud --lease="694d7c91d5e3fc0c"
OK