etcd下载链接:
https://github.com/etcd-io/etcd/releases
安装
下载etcdv3包
1
2复制代码
|
cd /usr/local/src/
wget https://github.com/coreos/etcd/releases/download/v3.2.15/etcd-v3.2.15-linux-amd64.tar.gz复制代码
|
注:etcd版本号不一样。
解压
1
2复制代码
|
tar -zxvf etcd-v3.2.15-linux-amd64.tar.gzmv
etcd-v3.2.15-linux-amd64 etcd复制代码
|
添加v3环境变量
将代码路径加入环境变量中,并使用etcdv3的api接口
1
2
3复制代码
|
vim /etc/profileexport
PATH=/usr/local/src/etcd:$PATHexport
ETCDCTL_API=3复制代码
|
生效 source /etc/profile
简易启动local standlone cluster
参考:coreos.com/etcd/docs/l…
切换到:/usr/local/src/etc 目录直接启动etcd服务进程
1
2
3
4
5
6
7
8
9复制代码
|
[email protected]:/usr/local/src/etcd
19228
[email protected]:/usr/local/src/etcd
2018-03-07 13:40:16.719217 I | etcdmain: Git SHA: 1b3ac99e8
2018-03-07 13:40:16.719235 I | etcdmain: Go Version: go1.8.5
2018-03-07 13:40:16.719244 I | etcdmain: Go OS/Arch: linux/amd64
2018-03-07 13:40:16.719254 I | etcdmain: setting maximum number of CPUs to 4, total number of available CPUs is 4
2018-03-07 13:40:16.719274 W | etcdmain: no data-dir provided, using default data-dir ./default.etcd
2018-03-07 13:40:16.719422 N | etcdmain: the server is already initialized as复制代码
|
判别是否启动成功
查看 2379 和 2380 两个端口服务都已经启动成功
etcdctl操作etcd存储
额外说明:etcdctl get “” –from-key 是查看所有数据