1

I run etcd by this command (no more other configuration)

./etcd-v3.2.12-linux-amd64/etcd

package main

import (
    "context"
    "fmt"
    "github.com/coreos/etcd/clientv3"
)

func main() {
    cli, err := clientv3.New(clientv3.Config{
        Endpoints: []string{"http://127.0.0.1:2379"},
    })
    if err != nil {
        fmt.Println(err)
        return
    }
    _, err = cli.Put(context.TODO(), "abc", "123")
    if err != nil {
        fmt.Println(err)
        return
    }
    fmt.Println("put succ")
}

./etcd-v3.2.12-linux-amd64/etcdctl get abc
Error:  100: Key not found (/abc) [6]

more details more details more details more details more details more details more details more details more details more details more details more details more details more details more detailsmore details more details more details more details more details more details more details more details more details more details more details more details more details more details more details

4

1 回答 1

1

出口 ETCDCTL_API=3

v2 和 v3 分开存放

于 2018-01-05T06:20:55.407 回答