linux安装etcd可视化工具,linux下安装使用etcd

一、简介

:API (gRPC)

TLS

:10000

:Raft

etcdGoRaft

二、安装

1.方法1$curl -L https://github.com/coreos/etcd/releases/download/v3.3.2/etcd-v3.3.2-linux-amd64.tar.gz -o etcd-v3.3.2-linux-amd64.tar.gz #解压后是一些文档和两个二进制文件etcd和etcdctl。etcd是server端,etcdctl是客户端。 $tar zxf etcd-v3.3.2-linux-amd64.tar.gz #将解压后的etcd和etcdctl移动到$GOPATH/bin目录下,可以直接使用etcd和etcdctl命令 $mv etcd-v3.3.2-linux-amd64/etcd* /$GOPATH/bin

2.2$ mkdir -p $GOPATH/src/github.com/coreos $ cd !$ $ git clone https://github.com/coreos/etcd.git $ cd etcd $ ./build $ ./bin/etcd

三、启动$ ./etcd (或直接使用etcd)

etcd localhost:2379

etcdctl

# API3$ export ETCDCTL_API=3 $ ./etcdctl put foo bar OK $ ./etcdctl get foo bar

四、本地多成员集群

goreman

goremanhttps://segmentfault.com/a/1190000003778084$ go get github.com/mattn/goreman

Procfilehttps://github.com/coreos/etcd/blob/master/Procfile$ goreman -f Procfile start

注1goGo

注2ProcfileetcdgitubProcfile

bin/etcd etcd

# Use goreman to run `go get github.com/mattn/goreman` etcd1: etcd --name infra1 --listen-client-urls http://127.0.0.1:2379 --advertise-client-urls http://127.0.0.1:2379 --listen-peer-urls http://127.0.0.1:12380 --initial-advertise-peer-urls http://127.0.0.1:12380 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=http://127.0.0.1:12380,infra2=http://127.0.0.1:22380,infra3=http://127.0.0.1:32380' --initial-cluster-state new --enable-pprof etcd2: etcd --name infra2 --listen-client-urls http://127.0.0.1:22379 --advertise-client-urls http://127.0.0.1:22379 --listen-peer-urls http://127.0.0.1:22380 --initial-advertise-peer-urls http://127.0.0.1:22380 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=http://127.0.0.1:12380,infra2=http://127.0.0.1:22380,infra3=http://127.0.0.1:32380' --initial-cluster-state new --enable-pprof etcd3: etcd --name infra3 --listen-client-urls http://127.0.0.1:32379 --advertise-client-urls http://127.0.0.1:32379 --listen-peer-urls http://127.0.0.1:32380 --initial-advertise-peer-urls http://127.0.0.1:32380 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=http://127.0.0.1:12380,infra2=http://127.0.0.1:22380,infra3=http://127.0.0.1:32380' --initial-cluster-state new --enable-pprof # in future, use proxy to listen on 2379 #proxy: bin/etcd --name infra-proxy1 --proxy=on --listen-client-urls http://127.0.0.1:2378 --initial-cluster 'infra1=http://127.0.0.1:12380,infra2=http://127.0.0.1:22380,infra3=http://127.0.0.1:32380' --enable-pprof

$ export ETCDCTL_API=3 $ etcdctl --write-out=table --endpoints=localhost:2379 member list

1529153243410257.png

$ etcdctl --endpoints=localhost:2379 put foo bar

1529153247536942.png

可以从其他节点获取:$etcdctl --endpoints=localhost:22379 get foo

1529153250481014.png

key$etcdctl --endpoints=localhost:22379 del foo

1529153253293678.png

key value

$ goreman run stop etcd2

$ etcdctl --endpoints=localhost:2379 get foo foo bar

$ etcdctl --endpoints=localhost:22379 get foo

1529153256398824.png

$ goreman run restart etcd2 $ etcdctl --endpoints=localhost:22379 get foo foo bar

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值