无法在 rpcx 正常适用上 etcd

  1. 最近在学rpc,下了rpcx这个框架,mac环境

  2. 然后又在github下了etcd,然后用go build生成二进制运行

  3. 已经用curl验证过etcd正在运行,测试过put、get命令正常。

    curl http://127.0.0.1:2379/version
    #得到输出
    {"etcdserver":"3.5.0-pre","etcdcluster":"3.5.0"}% 
  4. 但是用rpcx连接etcd时候报错,说不是有效的etcd集群节点。我试过换成错误端口或者没开etcd服务提示请求拒绝的,所以是连接上,但就是报错了。

    etcd.go:66: ERROR: cannot create etcd path /rpcx_test: client: response is invalid json. The endpoint is probably not valid etcd cluster endpoint
    
    client: response is invalid json. The endpoint is probably not valid etcd cluster endpoint
  5. rpcx所用的代码是官方示例:

    github官方例子

    官方文档

  6. 网上找到的相似的只是没有把监听地址加进去,不适用于当前情况。

  7. 请赐教。

最佳答案

etcd的版本是3.5的,那demo也使用版本3的

https://github.com/rpcx-ecosystem/rpcx-exa...

差别在于第34行代码

r := &serverplugin.EtcdV3RegisterPlugin{

4年前 评论
cjbx (楼主) 4年前
讨论数量: 2

报错上看 /rpcx_test 这个端点有问题啊。etcd 无法识别,json 数据有问题?

4年前 评论
cjbx (楼主) 4年前

etcd的版本是3.5的,那demo也使用版本3的

https://github.com/rpcx-ecosystem/rpcx-exa...

差别在于第34行代码

r := &serverplugin.EtcdV3RegisterPlugin{

4年前 评论
cjbx (楼主) 4年前

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!