rpcxio / rpcx-etcd

etcd plugin for rpcx
Apache License 2.0
29 stars 24 forks source link

rpcx 使用etcd作为注册中心,客户端无法连接failed to call: dial tcp [::1]:8972: connectex: No connection could be made because the target machine actively refused it. #34

Closed yongliangZhang closed 4 months ago

yongliangZhang commented 4 months ago

rpcx 版本:v1.8.31 rpcx-etcd 版本:v0.4.0

客户端连接代码: `flag.Parse() d, _ := etcdclient.NewEtcdV3Discovery(basePath, "Arith", []string{etcdAddr}, true, nil) xclient := client.NewXClient("Arith", client.Failover, client.RoundRobin, d, client.DefaultOption) defer xclient.Close() args := &example.Args{ A: 10, B: 20, }

for {
    reply := &common.Reply{}
    err := xclient.Call(context.Background(), "Mul", args, reply)
    if err != nil {
        log.Printf("failed to call: %v\n", err)
        time.Sleep(5 * time.Second)
        continue
    }

    log.Printf("%d * %d = %d", args.A, args.B, reply.C)

    time.Sleep(5 * time.Second)
}`

启动错误信息: ``2024/07/02 14:02:17 failed to call: dial tcp [::1]:8972: connectex: No connection could be made because the target machine actively refused it.

smallnest commented 4 months ago

日志已经说了。 本地 8972端口连不上 [::1]:8972

image