zoukankan      html  css  js  c++  java
  • ETCD的常用命令

    Note that any key that was created using the v2 API will not be able to be queried via the v3 API. A v3 API etcdctl get of a v2 key will exit with 0 and no key data, this is the expected behaviour.

    export ETCDCTL_API=3

    etcdctl version

    1、etcdctl put foo bar

    2、etcdctl put foo1 bar1 --lease=1234abcd(创建的租约ID)

    3、etcdctl get foo

    4、etcdctl get foo --hex

    5、$ etcdctl get --prefix foo

         foo bar

         foo1 bar1

         foo2 bar2

         foo3 bar3

    6、etcdctl get --prefix --limit=2 foo

    7、版本,每次修订KEY,都会全局版本加一

    Suppose an etcd cluster already has the following keys:

    foo = bar         # revision = 2
    foo1 = bar1       # revision = 3
    foo = bar_new     # revision = 4
    foo1 = bar1_new   # revision = 5

    Here are an example to access the past versions of keys:

    $ etcdctl get --prefix foo # access the most recent versions of keys
    foo
    bar_new
    foo1
    bar1_new
    
    $ etcdctl get --prefix --rev=4 foo # access the versions of keys at revision 4
    foo
    bar_new
    foo1
    bar1
    
    $ etcdctl get --prefix --rev=3 foo # access the versions of keys at revision 3
    foo
    bar
    foo1
    bar1
    
    $ etcdctl get --prefix --rev=2 foo # access the versions of keys at revision 2
    foo
    bar
    
    $ etcdctl get --prefix --rev=1 foo # access the versions of keys at revision 1

    8、读取》=KEY

    Suppose an etcd cluster already has the following keys:

    a = 123
    b = 456
    z = 789

       Here is the command to read keys which are greater than or equal to the byte value of key b :

    $ etcdctl get --from-key b
    b
    456
    z
    789

    9、etcdctl  del foo1 foo9--范围删除
    10、$ etcdctl del --prev-kv zoo

    Here is the command to delete key zoo with the deleted key value pair returned

    1   # one key is deleted
    zoo # deleted key
    val # the value of the deleted key

    11、$ etcdctl del --from-key b

            Here is the command to delete keys which are greater than or equal to the byte value of key b :

       2 # two keys are deleted
     
    
    





  • 相关阅读:
    029- 位运算符
    028- 三目运算符
    027- 字符串链接运算符
    026- 布尔运算符
    lucene 结合数据库做搜索
    JDK 1.8判断集合种的元素是否存在相同
    Springboot 集成jpa使用
    json 的使用 Java对象转json
    Java 短信发送
    1 eclipse 离线安装activiti插件
  • 原文地址:https://www.cnblogs.com/justart/p/11670202.html
Copyright © 2011-2022 走看看