下载:

https://github.com/etcd-io/etcd/releases/tag/v3.3.13

tar -zxvf   etcd-v3.3.13-linux-amd64.tar.gz

启动:

./etcd --listen-client-urls 'http://0.0.0.0:2379' --advertise-client-urls 'http://0.0.0.0:2379'

[root@localhost etcd-v3.3.13-linux-amd64]# ./etcd --listen-client-urls 'http://0.0.0.0:2379' --advertise-client-urls 'htt p://0.0.0.0:2379'
-- ::40.261923 I | etcdmain: etcd Version: 3.3.
-- ::40.262093 I | etcdmain: Git SHA: 98d3084
-- ::40.262107 I | etcdmain: Go Version: go1.10.8
-- ::40.262128 I | etcdmain: Go OS/Arch: linux/amd64
-- ::40.262144 I | etcdmain: setting maximum number of CPUs to , total number of available CPUs is
-- ::40.262176 W | etcdmain: no data-dir provided, using default data-dir ./default.etcd
-- ::40.263503 I | embed: listening for peers on http://localhost:2380
-- ::40.264070 I | embed: listening for client requests on 0.0.0.0:
-- ::40.273565 I | etcdserver: name = default
-- ::40.273598 I | etcdserver: data dir = default.etcd
-- ::40.273607 I | etcdserver: member dir = default.etcd/member
-- ::40.273613 I | etcdserver: heartbeat = 100ms
-- ::40.273618 I | etcdserver: election = 1000ms
-- ::40.273624 I | etcdserver: snapshot count =
-- ::40.273638 I | etcdserver: advertise client URLs = http://0.0.0.0:2379
-- ::40.273646 I | etcdserver: initial advertise peer URLs = http://localhost:2380
-- ::40.273657 I | etcdserver: initial cluster = default=http://localhost:2380
-- ::40.276843 I | etcdserver: starting member 8e9e05c52164694d in cluster cdf818194e3a8c32
-- ::40.276890 I | raft: 8e9e05c52164694d became follower at term
-- ::40.276911 I | raft: newRaft 8e9e05c52164694d [peers: [], term: , commit: , applied: , lastindex: , lastterm: ]
-- ::40.276919 I | raft: 8e9e05c52164694d became follower at term
-- ::40.281968 W | auth: simple token is not cryptographically signed
-- ::40.287898 I | etcdserver: starting server... [version: 3.3., cluster version: to_be_decided]
-- ::40.292469 I | etcdserver: 8e9e05c52164694d as single-node; fast-forwarding ticks (election ticks )
-- ::40.293629 I | etcdserver/membership: added member 8e9e05c52164694d [http://localhost:2380] to cluster cdf818194e3a8c32
-- ::40.378709 I | raft: 8e9e05c52164694d is starting a new election at term
-- ::40.378779 I | raft: 8e9e05c52164694d became candidate at term
-- ::40.378823 I | raft: 8e9e05c52164694d received MsgVoteResp from 8e9e05c52164694d at term
-- ::40.378855 I | raft: 8e9e05c52164694d became leader at term
-- ::40.378876 I | raft: raft.node: 8e9e05c52164694d elected leader 8e9e05c52164694d at term
-- ::40.399670 I | etcdserver: published {Name:default ClientURLs:[http://0.0.0.0:2379]} to cluster cdf818194e3a8c32
-- ::40.401716 E | etcdmain: forgot to set Type=notify in systemd service file?
-- ::40.401893 I | etcdserver: setting up the initial cluster version to 3.3
-- ::40.403708 N | etcdserver/membership: set the initial cluster version to 3.3
-- ::40.403871 I | etcdserver/api: enabled capabilities for version 3.3
-- ::40.403922 I | embed: ready to serve client requests
-- ::40.406114 N | embed: serving insecure client requests on [::]:, this is strongly discouraged!

nohup ./etcd --listen-client-urls 'http://0.0.0.0:2379' --advertise-client-urls 'http://0.0.0.0:2379' &

[root@localhost etcd-v3.3.13-linux-amd64]# ./etcdctl

[root@localhost etcd-v3.3.13-linux-amd64]# ./etcdctl
NAME:
etcdctl - A simple command line client for etcd. WARNING:
Environment variable ETCDCTL_API is not set; defaults to etcdctl v2.
Set environment variable ETCDCTL_API= to use v3 API or ETCDCTL_API= to use v2 API. USAGE:
etcdctl [global options] command [command options] [arguments...] VERSION:
3.3. COMMANDS:
backup backup an etcd directory
cluster-health check the health of the etcd cluster
mk make a new key with a given value
mkdir make a new directory
rm remove a key or a directory
rmdir removes the key if it is an empty directory or a key-value pair
get retrieve the value of a key
ls retrieve a directory
set set the value of a key
setdir create a new directory or update an existing directory TTL
update update an existing key with a given value
updatedir update an existing directory
watch watch a key for changes
exec-watch watch a key for changes and exec an executable
member member add, remove and list subcommands
user user add, grant and revoke subcommands
role role add, grant and revoke subcommands
auth overall auth controls
help, h Shows a list of commands or help for one command GLOBAL OPTIONS:
--debug output cURL commands which can be used to reproduce the request
--no-sync don't synchronize cluster information before sending request
--output simple, -o simple output response in the given format (simple, `extended` or `json`) (default: "simple")
--discovery-srv value, -D value domain name to query for SRV records describing cluster endpoints
--insecure-discovery accept insecure SRV records describing cluster endpoints
--peers value, -C value DEPRECATED - "--endpoints" should be used instead
--endpoint value DEPRECATED - "--endpoints" should be used instead
--endpoints value a comma-delimited list of machine addresses in the cluster (default: "http://127.0.0.1:2379,http://127.0.0.1:4001")
--cert-file value identify HTTPS client using this SSL certificate file
--key-file value identify HTTPS client using this SSL key file
--ca-file value verify certificates of HTTPS-enabled servers using this CA bundle
--username value, -u value provide username[:password] and prompt if password is not supplied.
--timeout value connection timeout per request (default: 2s)
--total-timeout value timeout for the command execution (except watch) (default: 5s)
--help, -h show help
--version, -v print the version
ETCDCTL_API=3

[root@localhost etcd-v3.3.13-linux-amd64]# ETCDCTL_API= ./etcdctl
NAME:
etcdctl - A simple command line client for etcd3. USAGE:
etcdctl VERSION:
3.3. API VERSION:
3.3 COMMANDS:
get Gets the key or a range of keys
put Puts the given key into the store
del Removes the specified key or range of keys [key, range_end)
txn Txn processes all the requests in one transaction
compaction Compacts the event history in etcd
alarm disarm Disarms all alarms
alarm list Lists all alarms
defrag Defragments the storage of the etcd members with given endpoints
endpoint health Checks the healthiness of endpoints specified in `--endpoints` flag
endpoint status Prints out the status of endpoints specified in `--endpoints` flag
endpoint hashkv Prints the KV history hash for each endpoint in --endpoints
move-leader Transfers leadership to another etcd cluster member.
watch Watches events stream on keys or prefixes
version Prints the version of etcdctl
lease grant Creates leases
lease revoke Revokes leases
lease timetolive Get lease information
lease list List all active leases
lease keep-alive Keeps leases alive (renew)
member add Adds a member into the cluster
member remove Removes a member from the cluster
member update Updates a member in the cluster
member list Lists all members in the cluster
snapshot save Stores an etcd node backend snapshot to a given file
snapshot restore Restores an etcd member snapshot to an etcd directory
snapshot status Gets backend snapshot status of a given file
make-mirror Makes a mirror at the destination etcd cluster
migrate Migrates keys in a v2 store to a mvcc store
lock Acquires a named lock
elect Observes and participates in leader election
auth enable Enables authentication
auth disable Disables authentication
user add Adds a new user
user delete Deletes a user
user get Gets detailed information of a user
user list Lists all users
user passwd Changes password of user
user grant-role Grants a role to a user
user revoke-role Revokes a role from a user
role add Adds a new role
role delete Deletes a role
role get Gets detailed information of a role
role list Lists all roles
role grant-permission Grants a key to a role
role revoke-permission Revokes a key from a role
check perf Check the performance of the etcd cluster
help Help about any command OPTIONS:
--cacert="" verify certificates of TLS-enabled secure servers using this CA bundle
--cert="" identify secure client using this TLS certificate file
--command-timeout=5s timeout for short running command (excluding dial timeout)
--debug[=false] enable client-side debug logging
--dial-timeout=2s dial timeout for client connections
-d, --discovery-srv="" domain name to query for SRV records describing cluster endpoints
--endpoints=[127.0.0.1:] gRPC endpoints
-h, --help[=false] help for etcdctl
--hex[=false] print byte strings as hex encoded strings
--insecure-discovery[=true] accept insecure SRV records describing cluster endpoints
--insecure-skip-tls-verify[=false] skip server certificate verification
--insecure-transport[=true] disable transport security for client connections
--keepalive-time=2s keepalive time for client connections
--keepalive-timeout=6s keepalive timeout for client connections
--key="" identify secure client using this TLS key file
--user="" username[:password] for authentication (prompt if password is not supplied)
-w, --write-out="simple" set the output format (fields, json, protobuf, simple, table)

get put简单操作

[root@localhost etcd-v3.3.13-linux-amd64]# ETCDCTL_API= ./etcdctl  put "name" "sunlong"
OK
[root@localhost etcd-v3.3.13-linux-amd64]# ETCDCTL_API= ./etcdctl delete "name" "sunlong"
Error: unknown command "delete" for "etcdctl"
Run 'etcdctl --help' for usage.
Error: unknown command "delete" for "etcdctl"
[root@localhost etcd-v3.3.13-linux-amd64]# ETCDCTL_API= ./etcdctl del "name" "sunlong" [root@localhost etcd-v3.3.13-linux-amd64]#
[root@localhost etcd-v3.3.13-linux-amd64]# ETCDCTL_API= ./etcdctl  get "name"
name
sunlong
[root@localhost etcd-v3.3.13-linux-amd64]# ETCDCTL_API= ./etcdctl get "name"
name
sunlong
[root@localhost etcd-v3.3.13-linux-amd64]# ETCDCTL_API= ./etcdctl get "name"

[root@localhost etcd-v3.3.13-linux-amd64]# ETCDCTL_API=3 ./etcdctl  get -h

NAME:
get - Gets the key or a range of keys USAGE:
etcdctl get [options] <key> [range_end] OPTIONS:
--consistency="l" Linearizable(l) or Serializable(s)
--from-key[=false] Get keys that are greater than or equal to the given key using byte compare
--keys-only[=false] Get only the keys
--limit= Maximum number of results
--order="" Order of results; ASCEND or DESCEND (ASCEND by default)
--prefix[=false] Get keys with matching prefix
--print-value-only[=false] Only write values when using the "simple" output format
--rev= Specify the kv revision
--sort-by="" Sort target; CREATE, KEY, MODIFY, VALUE, or VERSION GLOBAL OPTIONS:
--cacert="" verify certificates of TLS-enabled secure servers using this CA bundle
--cert="" identify secure client using this TLS certificate file
--command-timeout=5s timeout for short running command (excluding dial timeout)
--debug[=false] enable client-side debug logging
--dial-timeout=2s dial timeout for client connections
-d, --discovery-srv="" domain name to query for SRV records describing cluster endpoints
--endpoints=[127.0.0.1:] gRPC endpoints
--hex[=false] print byte strings as hex encoded strings
--insecure-discovery[=true] accept insecure SRV records describing cluster endpoints
--insecure-skip-tls-verify[=false] skip server certificate verification
--insecure-transport[=true] disable transport security for client connections
--keepalive-time=2s keepalive time for client connections
--keepalive-timeout=6s keepalive timeout for client connections
--key="" identify secure client using this TLS key file
--user="" username[:password] for authentication (prompt if password is not supplied)
-w, --write-out="simple" set the output format (fields, json, protobuf, simple, table) [root@localhost etcd-v3.3.13-linux-amd64]#
[root@localhost etcd-v3.3.13-linux-amd64]# ETCDCTL_API= ./etcdctl  put "/cron/jobs/job1"  "{...job1}"
OK
[root@localhost etcd-v3.3.13-linux-amd64]# ETCDCTL_API= ./etcdctl put "/cron/jobs/job2" "{...job2}"
OK
[root@localhost etcd-v3.3.13-linux-amd64]# ETCDCTL_API= ./etcdctl  get "/cron/jobs/" --prefix
/cron/jobs/job1
{...job1}
/cron/jobs/job2
{...job2}
  ETCDCTL_API=3 ./etcdctl  watch "/cron/jobs/" --prefix

[root@localhost etcd-v3.3.13-linux-amd64]# ETCDCTL_API= ./etcdctl  put "/cron/jobs/job2"  "{...job2...111}"
OK
[root@localhost etcd-v3.3.13-linux-amd64]# ETCDCTL_API= ./etcdctl del "/cron/jobs/job2"
[root@localhost etcd-v3.3.13-linux-amd64]# ETCDCTL_API= ./etcdctl  watch "/cron/jobs/" --prefix
PUT
/cron/jobs/job2
{...job2...}
DELETE
/cron/jobs/job2
 

etcd使用的更多相关文章

  1. 一次基于etcd的分布式锁自动延时失败问题的排查

    今天在测试基于etcd的分布式锁过程中,在测试获取锁后,释放之前超出TTL时长的情况下自动延长TTL这部分功能,在延长指定key的TTL时总是返回404错误信息,在对目标KEY更新TTL时目标KEY已 ...

  2. etcd:用于服务发现的键值存储系统

    etcd是一个高可用的键值存储系统,主要用于共享配置和服务发现.etcd是由CoreOS开发并维护的,灵感来自于 ZooKeeper 和 Doozer,它使用Go语言编写,并通过Raft一致性算法处理 ...

  3. Centos7下Etcd集群搭建

    一.简介 "A highly-available key value store for shared configuration and service discovery." ...

  4. 通过docker-machine和etcd部署docker swarm集群

    本片文章介绍一下 使用docker-machine 搭建docker swarm 集群:docker swarm是docker 官方搭建的容器集群编排工具:容器编排,就是可以使你像使用一太机器一样来使 ...

  5. etcd第三集

    简单说下golang的etcd接口例子.etcd api有v2(http+json)和v3(grpc)两个版本,目前大家都用v2,所以... v2: https://github.com/coreos ...

  6. etcd第二集

    参考文章:https://github.com/coreos/etcd/blob/master/Documentation/v2/api.mdhttp://www.cnblogs.com/zhengr ...

  7. etcd第一集

    网站:https://github.com/coreos/etcd 一些观点:https://yq.aliyun.com/articles/11035 1.etcd是键值存储仓库,配置共享和服务发现2 ...

  8. etcd命令说明 etcd Version: 3.0.15

    etcd Version: 3.0.15Git SHA: fc00305Go Version: go1.6.3Go OS/Arch: linux/amd64 https://github.com/co ...

  9. etcd api 接口

    etcd api接口 基本操作api: https://github.com/coreos/etcd/blob/6acb3d67fbe131b3b2d5d010e00ec80182be4628/Doc ...

  10. Key/Value存储系统etcd的特性

    etcd 是一个高可用的Key/Value存储系统,和其他KV存储系统不同的是,它的灵感来自于 ZooKeeper 和 Doozer,主要用于分享配置和服务发现.利用 etcd 的特性,应用程序可以在 ...

随机推荐

  1. vue 使用QRcode生成二维码或在线生成二维码

    参考:https://blog.csdn.net/zhuswy/article/details/80267748 1.安装qrcode.js npm install qrcodejs2 --save ...

  2. elasticsearch 中文API 基于查询的删除(九)

    基于查询的删除API 基于查询的删除API允许开发者基于查询删除一个或者多个索引.一个或者多个类型.下面是一个例子. import static org.elasticsearch.index.que ...

  3. PHP简单实现“相关文章推荐”功能的方法(此方法不是自创)

    1, 所用的函数:int similar_text ( string $first, string $second[, float $percent] ) 利用similar_text将这些文章标题同 ...

  4. Server 主机屋云服务器 宝塔面板 部署nginx反向代理的vue项目

    图文记录云服务器上部署需要nginx反向代理的vue项目: 一.先登录并购买云服务器,根据自己需求购买,此处不详细介绍: 二.登录后如下图,点击进入云服务器界面: 三.在云服务器界面点击管理,进入管理 ...

  5. 巧用 position:absolute

    1.跟随性 下面这种方法更加简便以及更方便维护, 例如“西部世界”,由于不用将父元素设为position:relative,position:absolute的位置也就不用根据文字多少而重新进行top ...

  6. Yaf--个人封装yaf的框架+swoole+elasticsearch(Window+linux版)

    这是基于c写底层的yaf框架集成PDO+predis+读写分离+composer+全局异常处理+多模块开发+Log日志记录简单容易上手的框架 注意:window版没有swoole和Smarty主要用作 ...

  7. 转:LPC2214的PLL与定时器设置

    原地址:http://blog.sina.com.cn/s/blog_4419d72d0100mu7h.html LPC2214的PLL与定时器设置 http://www.dpj365.cn/bbs/ ...

  8. Ceisum官方教程3 -- 空间数据可视化

    原文地址:https://cesiumjs.org/tutorials/Visualizing-Spatial-Data/ 这篇教程教你如何使用Cesium的Entity API去绘制空间数据,如点, ...

  9. c++使用优先队列时自定义优先出队顺序(和sort)

    优先队列也是一种先进先出的数据结构,元素从队尾入队,从队头出队,但是优先队列相较一般队列多了一个判断优先级的功能,在当前队列中,优先级最高的元素将被第一个删除. 先看一下优先队列的定义 templat ...

  10. 如何将本地项目上传到Git 版本库

    1.(先进入项目文件夹)通过命令 git init 把这个目录变成git可以管理的仓库 git init 2.把文件添加到版本库中,使用命令 git add .添加到暂存区里面去,不要忘记后面的小数点 ...