ZooKeeper 3.4.12 C客户端无法连接到Solaris11计算机上的ZooKeeper服务器

时间:2018-08-08 10:19:47

标签: c apache-zookeeper solaris

我在Solaris 11计算机上编译了ZooKeeper 3.4.12 C客户端,并尝试通过cli.sh对其进行测试。这是我在cli.c中更改的示例代码。每当我运行./cli_mt文件时,它总是抛出以下错误

  

2018-08-08 09:49:44,437:18000(0x2):ZOO_ERROR @ handle_socket_error_msg @ 1670:套接字[10.272.80.184:4831] zk retcode = -4,errno = 0(错误0):connect()通话失败。

有人遇到同样的问题吗?


cli.c文件

int main(int argc, char **argv) 
{
#ifndef THREADED
    fd_set rfds, wfds, efds;
    int processed = 0;
#endif
    char p[2048];
#ifdef YCA  
    char *cert = 0;
    char appId[64];
#endif
    char buffer[4096];
    int bufoff;
    struct Stat stat;
    int buflen = sizeof(buffer);
    int rc;
    verbose = 0;

    zoo_set_debug_level(ZOO_LOG_LEVEL_WARN);
    zoo_deterministic_conn_order(1); // enable deterministic order
    hostPort = argv[1];
    printf("\n%s\n", "Lets connect");
    zh = zookeeper_init("sld06hzt:4831", watcher, 30000, &myid, 0, 0);
    if (!zh) {
        printf("\n%d\n", errno);
        return errno;
    }
    strcpy(p,"sadmin:ldap");
    zoo_add_auth(zh, "digest", p,strlen(p), 0, 0);
    rc = zoo_get(zh, "/test", 0, buffer, &buflen, &stat);
    if (rc) {
        printf("\n%s\n", buffer);
    }
    zookeeper_close(zh);
    return 2;
}

关于, 阿什维尼。

0 个答案:

没有答案