Discovery is a based service that is production-ready and primarily used at Bilibili for locating services for the purpose of load balancing and failover of middle-tier servers.
Quick Start
env
go1.12.x (and later)
build
cd $GOPATH/src
git clone https://github.com/bilibili/discovery.git
cd discovery/cmd/discovery
go build或者:go install github.com/bilibili/discovery/cmd/discovery@latestrun
discovery -conf discovery.toml -alsologtostderr-alsologtostderr is glog's flag,means print into stderr. If you hope print into file, can use -log.dir="/tmp". view glog doc.
Configuration
You can view the comments in cmd/discovery/discovery.toml to understand the meaning of the config.
Client
Intro/Arch/Practice
root@racknerd-7b97d8:~# which discovery
/root/go1.18.1.linux-amd64/go/gopath/bin/discovery
root@racknerd-7b97d8:~# discovery -h
Usage of discovery:
-appid string
appid is global unique application id, register by service tree. or use APP_ID env variable.
-conf string
default config path
-deploy.color string
deploy.color is the identification of different experimental group.
-deploy.env string
deploy env. or use DEPLOY_ENV env variable, value: dev/fat1/uat/pre/prod etc. (default "dev")
-discovery.nodes string
discovery.nodes is seed nodes. value: 127.0.0.1:7171,127.0.0.2:7171 etc.
-http string
listen http dsn, or use HTTP env variable. (default "tcp://0.0.0.0:8000/?timeout=1s")
-http.perf string
listen http perf dsn, or use HTTP_PERF env variable.
-log.agent string
log agent dsn, or use LOG_AGENT env variable.
-log.dir string
log file `path, or use LOG_DIR env variable.
-log.filter value
log field for sensitive message, or use LOG_FILTER env variable, format: field1,field2.
-log.module value
log verbose for specified module, or use LOG_MODULE env variable, format: file=1,file2=2.
-log.noagent
force disable log agent print log to stderr, or use LOG_NO_AGENT
-log.stdout
log enable stdout or not, or use LOG_STDOUT env variable.
-log.v int
log verbose level, or use LOG_V env variable.
-region string
avaliable region. or use REGION env variable, value: sh etc. (default "region01")
-trace string
trace report dsn, or use TRACE env. (default "unixgram:///var/run/dapper-collect/dapper-collect.sock")
-zone string
avaliable zone. or use ZONE env variable, value: sh001/sh002 etc. (default "zone01")
root@racknerd-7b97d8:~#
No comments:
Post a Comment