Take Service-center as an example, reference to ServiceCenter Quick Start
Requirements, Golang version 1.11+
# Get Service-center Syncer source code from github $ git clone https://github.com/apache/servicecomb-service-center.git $GOPATH/src/github.com/apache/servicecomb-service-center $cd $GOPATH/src/github.com/apache/servicecomb-service-center # Set "go mod" compile env $ GO111MODULE=on go mod download $ GO111MODULE=on go mod vendor # Build it $ cd syncer $ go build
sc-addr
Service center address, which is the service registry address. Cluster mode is supported, and multiple addresses are separated by commas.
Example --sc-addr http://10.0.0.10:30100,http://10.0.0.11:30100
bind
P2P address of Syncer for communication with other Syner members in P2P networks by Gossip.
Example --bind 10.0.0.10:30190
rpc-addr
Address of Syncer for data transmission, used to synchronize microservices data between Syncers.
Example --rpc-addr 10.0.0.10:30191
join
The address of any member of the P2P network, to enable itself join the specified P2P network, ignore this parameter when starting the first syncer on a P2P network.
Example --join 10.0.0.10:30191
Suppose there are 2 Service centers, each of them with a Service-center cluster for microservices discovery and registry, as following,
Servicecenter | Local address |
---|---|
http://10.0.0.10:30100 | 10.0.0.10 |
http://10.0.0.11:30100 | 10.0.0.11 |
Start Service-center Syncer to enable communication between 2 service centers,
Start Sycner 10.0.0.10 host
$ ./syncer daemon --sc-addr http://10.0.0.10:30100 --bind 10.0.0.10:30190 --rpc-addr 10.0.0.10:30191
Start Syncer on 10.0.0.11 host and join into 10.0.0.10 gossip pool
$ ./syncer daemon --sc-addr http://10.0.0.11:30100 --bind 10.0.0.11:30190 --rpc-addr 10.0.0.11:30191 --join 10.0.0.10:30191
Verification
30 seconds after registering a microservice to one of the Service-centers, the information about it can be get from the other one.
Syncer is in developing progress, reference to TODO to get more developing features. Supported features are listed as follows,