首页 > 其他 > 详细

etcdctl的使用

时间:2019-05-29 23:35:59      阅读:436      评论:0      收藏:0      [点我收藏+]

etcdctl是一个提供简洁命令的etcd客户端,使用etcdctl可以直接和etcd服务打交道,对etcd中的键值对进行增删改查。

安装etcdctl

下载etcdctl工具

下载地址:etcdctl工具

解压安装

tar -xzvf etcd-xxx-linux-amd64.tar.gz
cd etcd-xxx-linux-amd64
cp etcdctl /usr/local/bin/

测试是否安装成功

$ etcdctl -h
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=3 to use v3 API or ETCDCTL_API=2 to use v2 API.

USAGE:
  etcdctl [global options] command [command options] [arguments...]

VERSION:
  3.3.10

常用etcdl命令

使用etcdctl v3版本,需要设置环境变量ETCDCTL_API=3

使用方法:export ETCDCTL_API=3或在etcdctl命令前加ETCDCTL_API=3

命令说明
etcdctl --endpoints=$ENDPOINTS put foo "Hello World" 将{key:foo, value: Hello World!}的键值对写入etcd
etcdctl --endpoints=$ENDPOINTS get foo 查找etcd key为foo对应的value
etcdctl --endpoints=$ENDPOINTS delete foo 删除key为foo的键值对

etcdctl的使用

原文:https://www.cnblogs.com/Moon-Light-Dream/p/10946619.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!