{"id":15162054,"url":"https://github.com/wwcd/grpc-lb","last_synced_at":"2025-10-24T22:32:22.841Z","repository":{"id":48697031,"uuid":"123261506","full_name":"wwcd/grpc-lb","owner":"wwcd","description":"Example for grpc-lb with etcd","archived":false,"fork":false,"pushed_at":"2020-12-16T05:10:54.000Z","size":3620,"stargazers_count":167,"open_issues_count":3,"forks_count":43,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-09-29T10:47:34.907Z","etag":null,"topics":["etcd","golang","grpc","grpc-lb"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wwcd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-28T09:25:04.000Z","updated_at":"2024-08-16T07:08:35.000Z","dependencies_parsed_at":"2022-08-31T09:10:35.368Z","dependency_job_id":null,"html_url":"https://github.com/wwcd/grpc-lb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wwcd%2Fgrpc-lb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wwcd%2Fgrpc-lb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wwcd%2Fgrpc-lb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wwcd%2Fgrpc-lb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wwcd","download_url":"https://codeload.github.com/wwcd/grpc-lb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219867520,"owners_count":16555889,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["etcd","golang","grpc","grpc-lb"],"created_at":"2024-09-27T01:04:33.056Z","updated_at":"2025-10-24T22:32:22.028Z","avatar_url":"https://github.com/wwcd.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n[![Build Status](https://travis-ci.org/wwcd/grpc-lb.svg?branch=master)](https://travis-ci.org/wwcd/grpc-lb)\n\n# 说明\n\n[gRPC服务发现\u0026负载均衡](https://segmentfault.com/a/1190000008672912)中的例子, 修订如下\n\n- register中重复PUT, watch时没有释放导致的内存泄漏\n- 退出时不能正常unregister\n- 接收到etcd的delete事件时，未删除数据[#1](https://github.com/wwcd/grpc-lb/issues/1)\n- 使用resolver包替换naming包，此包状态已变为Deprecated\n- 增加[grpc-gateway](https://github.com/grpc-ecosystem/grpc-gateway)例子\n\n# 测试\n\n## 启动ETCD\n\n\t# https://coreos.com/etcd/docs/latest/op-guide/container.html#docker\n\n\texport NODE1=192.168.1.21\n\n\tdocker volume create --name etcd-data\n\texport DATA_DIR=\"etcd-data\"\n\n\tREGISTRY=quay.io/coreos/etcd\n\t# available from v3.2.5\n\t# REGISTRY=gcr.io/etcd-development/etcd\n\n\tdocker run -d\\\n\t  -p 2379:2379 \\\n\t  -p 2380:2380 \\\n\t  --volume=${DATA_DIR}:/etcd-data \\\n\t  --name etcd ${REGISTRY}:latest \\\n\t  /usr/local/bin/etcd \\\n\t  --data-dir=/etcd-data --name node1 \\\n\t  --initial-advertise-peer-urls http://${NODE1}:2380 --listen-peer-urls http://0.0.0.0:2380 \\\n\t  --advertise-client-urls http://${NODE1}:2379 --listen-client-urls http://0.0.0.0:2379 \\\n\t  --initial-cluster node1=http://${NODE1}:2380\n\n## 启动测试程序\n\n    *注: golang1.11以上版本进行测试*\n\n    # 分别启动服务端\n    go run -mod vendor cmd/svr/svr.go -port 50001\n    go run -mod vendor cmd/svr/svr.go -port 50002\n    go run -mod vendor cmd/svr/svr.go -port 50003\n\n    # 启动客户端\n    go run -mod vendor cmd/cli/cli.go\n\n\n    # 启动grpc-gateway代理，提供HTTP-RESTful服务\n    go run -mod vendor cmd/gw/gw.go\n    curl -X POST http://localhost:60001/hello -d '{\"name\": \"fromGW\"}'\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwwcd%2Fgrpc-lb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwwcd%2Fgrpc-lb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwwcd%2Fgrpc-lb/lists"}