c2_etcd

package
v0.0.0-...-63b2ac5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2019 License: GPL-2.0 Imports: 7 Imported by: 0

README

心得注意事项:

通过命令终端使用

通过命令行终端使用,需要设置环境变量来切换etcdctl版本

$ >export ETCDCTL_API=3

查看key列表时: 需要设置prefix 参数为true, 如:

    etcdctl get --prefix=true --keys-only "/"

get命令帮助

/ # etcdctl get --help
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=0                         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=0                           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:2379]              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)


Documentation

Index

Constants

View Source
const (
	CONST_etcdServer = "etcd_s1:2379"
)

Variables

This section is empty.

Functions

func ExecEtc

func ExecEtc(config *clientv3.Config, f func(client clientv3.Client, ctx context.Context))

下面的demo case 标准执行模板

func GetEtcdCluster

func GetEtcdCluster() []string

func GetEtcdContext

func GetEtcdContext() (context.Context, func())

func GetEtcdOne

func GetEtcdOne() []string

func Main

func Main()

Types

type ClusterConfig

type ClusterConfig struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL