跳到主要内容

Etcd

metadata fields

Example: configs/runtime_config.json

FieldRequiredDescription
endpointsYetcd server address, multiple address use ; separate
dialTimeoutNdialTimeout is the timeout for failing to establish a connection in seconds. default: 5
usernameNetcd auth username
passwordNetcd auth password
keyPrefixPathNlock key prefix in etcd, default: /layotto/
tlsCertNtls certificate path
tlsCertKeyNtls certificate key path
tlsCaNtls ca path

How to start etcd

If you want to run the etcd demo, you need to start a etcd server.

Steps:

download etcd from https://github.com/etcd-io/etcd/releases (You can also use docker.)

start:

./etcd

default listen address localhost:2379

Run layotto

cd ${project_path}/cmd/layotto
go build

If build reports an error, it can be executed in the root directory of the project go mod vendor

Execute after the compilation is successful:

./layotto start -c ../../configs/runtime_config.json

Run Demo

 cd ${project_path}/demo/lock/common/
go build -o client
./client -s "lock_demo"