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]
export ETCDCTL_API=3
v2 and v3 are stored separately