Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

增加Nacos命名服务 #1922

Merged
merged 1 commit into from
Sep 16, 2022
Merged

增加Nacos命名服务 #1922

merged 1 commit into from
Sep 16, 2022

Conversation

yyweii
Copy link
Contributor

@yyweii yyweii commented Sep 9, 2022

因公司需要,添加了NacosNamingService类。使用openapi访问nacos服务,逻辑和Consul差不多。
如果有合入计划,我会补充一下文档。

@serverglen
Copy link
Contributor

建议补充下相关单测

src/brpc/periodic_naming_service.cpp Outdated Show resolved Hide resolved
src/brpc/periodic_naming_service.h Outdated Show resolved Hide resolved
src/brpc/policy/nacos_naming_service.cpp Outdated Show resolved Hide resolved
src/brpc/policy/nacos_naming_service.cpp Outdated Show resolved Hide resolved
src/brpc/policy/nacos_naming_service.h Outdated Show resolved Hide resolved
src/brpc/policy/nacos_naming_service.cpp Outdated Show resolved Hide resolved
@yyweii yyweii force-pushed the github-weiyy-nacos branch 3 times, most recently from 723d5c0 to 008d10a Compare September 12, 2022 05:20
@wwbmmm
Copy link
Contributor

wwbmmm commented Sep 13, 2022

@yyweii 代码没什么问题了,可以补充一下文档和单测吗

@yyweii
Copy link
Contributor Author

yyweii commented Sep 13, 2022

建议补充下相关单测

已加

@yyweii
Copy link
Contributor Author

yyweii commented Sep 13, 2022

@yyweii 代码没什么问题了,可以补充一下文档和单测吗

单测加好了。文档明天加上

@yyweii
Copy link
Contributor Author

yyweii commented Sep 14, 2022

@yyweii 代码没什么问题了,可以补充一下文档和单测吗

文档已加

@wwbmmm wwbmmm merged commit 7a8b49b into apache:master Sep 16, 2022
@yyweii yyweii deleted the github-weiyy-nacos branch September 16, 2022 14:58
@thorneliu
Copy link
Contributor

thorneliu commented Sep 21, 2022

Hi guys,

FYI. 我这里基于nacos-cli 实现了另外一个版本的 nacos naming service:
thorneliu@2cf39b6

基于这个patch, client可以:

std::string nacosurl("nacos://serverAddress/namespace/groupName/serviceName/clusterId");
channel.Init(nacosurl.c_str(), FLAGS_load_balancer.c_str(), &options)

这个naming service是通过nacos cpp sdk订阅nacos服务的服务实例变化来更新servernodes的;
不好的地方在于这个实现引入了第三方库的依赖

@yyweii @serverglen

@yyweii
Copy link
Contributor Author

yyweii commented Sep 24, 2022

Hi guys,

FYI. 我这里基于nacos-cli 实现了另外一个版本的 nacos naming service: thorneliu@2cf39b6

基于这个patch, client可以:

std::string nacosurl("nacos://serverAddress/namespace/groupName/serviceName/clusterId");
channel.Init(nacosurl.c_str(), FLAGS_load_balancer.c_str(), &options)

这个naming service是通过nacos cpp sdk订阅nacos服务的服务实例变化来更新servernodes的; 不好的地方在于这个实现引入了第三方库的依赖

@yyweii @serverglen

我本来也是用的sdk,但是只用来注册服务、获取和监听配置。后来我发现sdk代码bug太多了,最终还是基于http接口重新写了一个库。brpc里面的naming service一直是直接调用http接口的。
以后的sdk代码很有可能会改成grpc协议。nacos官网还没有grpc协议的文档。据介绍使用了grpc的双向流,目前brpc没有支持。

@thorneliu
Copy link
Contributor

thorneliu commented Sep 26, 2022

Hi guys,
FYI. 我这里基于nacos-cli 实现了另外一个版本的 nacos naming service: thorneliu@2cf39b6
基于这个patch, client可以:

std::string nacosurl("nacos://serverAddress/namespace/groupName/serviceName/clusterId");
channel.Init(nacosurl.c_str(), FLAGS_load_balancer.c_str(), &options)

这个naming service是通过nacos cpp sdk订阅nacos服务的服务实例变化来更新servernodes的; 不好的地方在于这个实现引入了第三方库的依赖
@yyweii @serverglen

我本来也是用的sdk,但是只用来注册服务、获取和监听配置。后来我发现sdk代码bug太多了,最终还是基于http接口重新写了一个库。brpc里面的naming service一直是直接调用http接口的。 以后的sdk代码很有可能会改成grpc协议。nacos官网还没有grpc协议的文档。据介绍使用了grpc的双向流,目前brpc没有支持。

Hmm,经测试这个nacos sdk确实很多bug。我现在也用你的方案来实现了,Respect!

guodongxiaren added a commit to guodongxiaren/incubator-brpc that referenced this pull request Nov 21, 2022
* enable brpc use rdma

* Fix override issue in pb 3.21

* fix rpc_replay can't send request equably (apache#1910)

* fix rpc_replay can't send request equably

* 类型修改

* fix coredump cause by uri like 'host:port/hotspots/growth_non_responsive?console=abc' (apache#1278)

* expose logging::PrintLog

* Support -escape_log

* Fix thrift_message pb override issue

* Chore: rework Bazel build system

* remove white space from default value of bvar_dump_tabs

* Update oncall.md

* Fix not to abort when checking the errorno with unicode string (apache#1142)

* fix a typo in grpc protocol (apache#1924)

* fix a typo in grpc protocol

* ERESPONSE->EREQUEST

Co-authored-by: 薛传宇 <xuechuanyu@cmss.chinamobile.com>

* [user-cases] add Apache Doris user case

* add nacos naming service (apache#1922)

* [document] Add vcpkg instruction step (apache#1925)

* http response uses brpc error code (apache#1927)

* http response uses brpc error code

* add gflag for using http error code

* add unit test of http error code

* Update Oncall record

* Fix bvar compile error (apache#1937)

* Fix bug butex_wait failed with timeout (apache#1917)

* Fix bug butex_wait failed with timeout

Co-authored-by: XiguoHu <huxiguo@baidu.com>

* fix issues in FlatMap

* Update release_cn.md

* brpc在BaikalDB中的应用

* Update getting_started.md

* fix(rpc_replay) continue when failed to init channel (apache#1938)

* fix(rpc_replay) continue when failed to init channel

* check supported_connection_type

* check supported_connection_type

* check supported_connection_type

* fix lint

* Update cases.md (apache#1944)

* fix rpc_press.md (apache#1942)

Signed-off-by: fan <yfan3763@gmail.com>

Signed-off-by: fan <yfan3763@gmail.com>

* fix typo in json2pb doc (apache#1939)

* Update oncall.md (apache#1949)

* Update release_cn.md

* Update RELEASE_VERSION

* Update CMakeLists.txt

* Update brpc.spec

* Update release_cn.md

* Update release_cn.md

* Update release_cn.md

* add pull_request_template.md (apache#1952)

Signed-off-by: fan <yfan3763@gmail.com>

Signed-off-by: fan <yfan3763@gmail.com>

* Fix the linkage errors caused by duplicate symbols (apache#1936)

* Fix "sched_to itself" error when buidling by Clang on Linux aarch64 (apache#1950)

* docs: fix some typos

Signed-off-by: cui fliter <imcusg@gmail.com>

* Fix source file mode

* rpm: support RHEL9

* Update oncall.md

* Update newcommitter.md

* fix arena cleared early when parse redis message

* community: Update oncall.md (apache#1960)

Co-authored-by: lei.li <lei.li@clickzetta.com>

* Reduce UT log output

* Update release_cn.md

* Update release_cn.md

Update brpc's brief introduction in Announce mail.

* Update release_cn.md

* Macos workflow (#10)

* fix typo

* delete bazel from mac workflow

* fix exceptation value for mac ut

* delete test

* Create ci_linux.yml

* Update ci_linux.yml

* Update ci_linux.yml

* Update ci_linux.yml

* Update ci_linux.yml

* Update ci_linux.yml

* Update ci_linux.yml

* Update ci_linux.yml

* Update ci_linux.yml

* Update ci_linux.yml

* Update ci_linux.yml

Signed-off-by: fan <yfan3763@gmail.com>
Signed-off-by: cui fliter <imcusg@gmail.com>
Co-authored-by: Tuvie <lizhaogeng1989@gmail.com>
Co-authored-by: wwbmmm <wwbmmm@163.com>
Co-authored-by: bumingchun <bumingchun@126.com>
Co-authored-by: Yingchun Lai <acelyc1112009@gmail.com>
Co-authored-by: gejun.0 <gejun.0@bytedance.com>
Co-authored-by: Jiashun Zhu <zhujiashun2010@gmail.com>
Co-authored-by: Shuai Zhang <zhangshuai.ustc@gmail.com>
Co-authored-by: yyweii <thymene@gmail.com>
Co-authored-by: tobe <tobeg3oogle@gmail.com>
Co-authored-by: bbbezxcy <bbezxcy@qq.com>
Co-authored-by: 薛传宇 <xuechuanyu@cmss.chinamobile.com>
Co-authored-by: morningman <morningman@163.com>
Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>
Co-authored-by: Tanzhongyi(Jerry Tan) <jerrytan@apache.org>
Co-authored-by: chenBright <chenguangming@bigo.sg>
Co-authored-by: lei he <lhestz@163.com>
Co-authored-by: Chengx <chengxiang085@gmail.com>
Co-authored-by: HU <uestc.hugo@gmail.com>
Co-authored-by: XiguoHu <huxiguo@baidu.com>
Co-authored-by: Tao Liu <liutao04@baidu.com>
Co-authored-by: day253 <9634619+day253@users.noreply.github.com>
Co-authored-by: ds <ehds@qq.com>
Co-authored-by: fan <75058860+fansehep@users.noreply.github.com>
Co-authored-by: serverglen <serverglen@gmail.com>
Co-authored-by: Adonis Ling <adonis0147@gmail.com>
Co-authored-by: cui fliter <imcusg@gmail.com>
Co-authored-by: Xiaofeng Wang <wasphin@gmail.com>
Co-authored-by: jiumei <jiumei@xiaohongshu.com>
Co-authored-by: LorinLee <lorinlee1996@gmail.com>
Co-authored-by: lei.li <lei.li@clickzetta.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants