2020-09-07 21:07:36 +08:00
|
|
|
# How to start a master
|
|
|
|
|
|
|
|
## Requirements
|
2020-09-09 15:24:07 +08:00
|
|
|
### Start a etcdv3
|
|
|
|
```
|
|
|
|
./etcd -listen-peer-urls=http://192.168.1.10:12380 -advertise-client-urls=http://192.168.1.10:12379 -listen-client-urls http://0.0.0.0:12379,http://0.0.0.0:14001 -initial-advertise-peer-urls=http://192.168.1.10:12380
|
|
|
|
```
|
2020-09-07 21:07:36 +08:00
|
|
|
## Start from code
|
2020-09-09 15:24:07 +08:00
|
|
|
```
|
|
|
|
go run cmd/master.go
|
|
|
|
```
|
2020-09-07 21:07:36 +08:00
|
|
|
|
|
|
|
## Start with docker
|
2020-09-16 10:40:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
## What rules does master use to write data to kv storage?
|
|
|
|
1.find the root path variable ```ETCD_ROOT_PATH ```which defined in common/config.go
|
|
|
|
2.add prefix path ```segment``` if the resource is a segement
|
|
|
|
3.add prefix path ```collection``` if the resource is a collection
|
|
|
|
4.add resource uuid
|
|
|
|
|
|
|
|
### example
|
|
|
|
if master create a collection with uuid ```46e468ee-b34a-419d-85ed-80c56bfa4e90```
|
2020-09-22 15:26:38 +08:00
|
|
|
the corresponding key in etcd is $(ETCD_ROOT_PATH)/collection/46e468ee-b34a-419d-85ed-80c56bfa4e90
|
2020-11-12 11:18:23 +08:00
|
|
|
|