1. etcdctl 命令

1.1. etcdctl --help

$ etcdctl --help
NAME:
        etcdctl - A simple command line client for etcd3.

USAGE:
        etcdctl [flags]

VERSION:
        3.4.14

API VERSION:
        3.4


COMMANDS:
        alarm disarm            Disarms all alarms
        alarm list              Lists all alarms
        auth disable            Disables authentication
        auth enable             Enables authentication
        check datascale         Check the memory usage of holding data for different workloads on a given server endpoint.
        check perf              Check the performance of the etcd cluster
        compaction              Compacts the event history in etcd
        defrag                  Defragments the storage of the etcd members with given endpoints
        del                     Removes the specified key or range of keys [key, range_end)
        elect                   Observes and participates in leader election
        endpoint hashkv         Prints the KV history hash for each endpoint in --endpoints
        endpoint health         Checks the healthiness of endpoints specified in `--endpoints` flag
        endpoint status         Prints out the status of endpoints specified in `--endpoints` flag
        get                     Gets the key or a range of keys
        help                    Help about any command
        lease grant             Creates leases
        lease keep-alive        Keeps leases alive (renew)
        lease list              List all active leases
        lease revoke            Revokes leases
        lease timetolive        Get lease information
        lock                    Acquires a named lock
        make-mirror             Makes a mirror at the destination etcd cluster
        member add              Adds a member into the cluster
        member list             Lists all members in the cluster
        member promote          Promotes a non-voting member in the cluster
        member remove           Removes a member from the cluster
        member update           Updates a member in the cluster
        migrate                 Migrates keys in a v2 store to a mvcc store
        move-leader             Transfers leadership to another etcd cluster member.
        put                     Puts the given key into the store
        role add                Adds a new role
        role delete             Deletes a role
        role get                Gets detailed information of a role
        role grant-permission   Grants a key to a role
        role list               Lists all roles
        role revoke-permission  Revokes a key from a role
        snapshot restore        Restores an etcd member snapshot to an etcd directory
        snapshot save           Stores an etcd node backend snapshot to a given file
        snapshot status         Gets backend snapshot status of a given file
        txn                     Txn processes all the requests in one transaction
        user add                Adds a new user
        user delete             Deletes a user
        user get                Gets detailed information of a user
        user grant-role         Grants a role to a user
        user list               Lists all users
        user passwd             Changes password of user
        user revoke-role        Revokes a role from a user
        version                 Prints the version of etcdctl
        watch                   Watches events stream on keys or prefixes

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
      --discovery-srv-name=""                   service name to query when using DNS discovery
      --endpoints=[127.0.0.1:2379]              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 (CAUTION: this option should be enabled only for testing purposes)
      --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
      --password=""                             password for authentication (if this option is used, --user option shouldn't include password)
      --user=""                                 username[:password] for authentication (prompt if password is not supplied)
  -w, --write-out="simple"                      set the output format (fields, json, protobuf, simple, table)

1.2. 参数说明

1.2.1. OPTIONS

选项 默认 描述
--cacert="" - 指定 TLS 连接的 CA 证书
--cert="" - 指定 TLS 连接的客户端证书
--command-timeout= 5s 短时间运行命令超时(不包括 dial 超时)
--debug= false 开启客户端调试日志输出
--dial-timeout= 2s dial timeout for client connections
-d, --discovery-srv="" - 指定使用 DNS SRV 发现的域名地址的 endpoints
--discovery-srv-name="" - 指定使用 DNS 发现的服务名称
--endpoints= [127.0.0.1:2379] gRPC endpoints
-h, --help= false etcdctl 的帮忙信息
--hex= false 以16进制编码输出
--insecure-discovery= true 接受不安全的 SRV 记录的 endpoint
--insecure-skip-tls-verify= false 跳过服务器证书验证(注意:此选项只能用于测试目的)
--insecure-transport= true 禁用不安全的客户端连接
--keepalive-time= 2s 客户端连接保持时长
--keepalive-timeout= 6s 客户端连接超时时长
--key="" - 指定 TLS 连接的客户端私钥
--password="" - 用于身份验证的密码(如果使用此选项,--user选项不应包括密码)
--user="" - 用于身份验证的用户名[:密码](如果未提供密码,则提示输入)
-w, --write-out= simple 设置输出格式(fields、json、protobuf、simple、table)

1.2.2. COMMANDS

COMMAND 描述
alarm disarm 清除所有告警
alarm list 查看所有告警信息
auth disable 关闭 RBAC 认证功能
auth enable 启用 RBAC 认证功能
check datascale 检查集群服务器上不同工作负载的数据的内存使用情况
check perf 测试 etcd 集群的性能是否满足基本要求
compaction 压缩历史数据
defrag 清理指定 endpoint 的碎片数据
del 删除指定的 key 数据
elect Observes and participates in leader election
endpoint hashkv 查看 `--endpoints` 指定成员的 endpoint 的 hash 值
endpoint health 查看 `--endpoints` 指定成员的健康状态
endpoint status 查看 `--endpoints` 指定成员的状态信息
get 查看一个指定的 key 的信息 或 一个范围的 keys 所有信息
help 任意 command 的帮助相关的信息
lease grant Creates leases
lease keep-alive Keeps leases alive (renew)
lease list List all active leases
lease revoke Revokes leases
lease timetolive Get lease information
lock Acquires a named lock
make-mirror Makes a mirror at the destination etcd cluster
member add 在集群中新增一个成员
member list 显示集群中成员列表
member promote 提升群集中的无投票权成员
member remove 从集群中移除一个成员
member update 更新集群中的一个成员
migrate Migrates keys in a v2 store to a mvcc store
move-leader 将 leader 移交给其他 etcd 集群成员
put 写入一条指定 key 的数据
role add 新增一个角色
role delete 删除一个角色
role get 获取一个角色的详细信息
role grant-permission 授权一个 key 的权限给指定的角色
role list 显示所有角色
role revoke-permission 从角色中移除一个的key的权限
snapshot restore 恢复一个 etcd 成员的快照数据到一个目录中。
snapshot save 转存储一个 etcd 成员的备份数据到一个文件
snapshot status 查看一个备份快照文件的状态
txn Txn processes all the requests in one transaction
user add 新增一个用户
user delete 删除一个用户
user get 获取一个用户的详细信息
user grant-role 将用户关联到一个角色
user list 显示所有用户
user passwd 修改用户的密码
user revoke-role 解除用户和角色的关联
version 查看 etcdctl 的版本
watch 实时监听并显示 key 或 前缀 值的变化,并输出到终端
Copyright © 温玉 2021 | 浙ICP备2020032454号 all right reserved,powered by Gitbook该文件修订时间: 2023-10-26 17:23:11

results matching ""

    No results matching ""