C/C++ 调用libhiredisAPI接口报错(error) MOVED 12345 ip:port, 怎么解决?
时间: 2019-05-13来源:博客园
前景提要
C/C++ 调用libhiredisAPI接口报错(error) MOVED 12345 ip:port, 怎么解决?
0 悬赏园豆: 10 [待解决问题] 这是集群中的一个节点, 连接之后直接调用发送命令, 然后就报错
MOVED 12539 192.168.6.251:19002 char *hostname = "192.168.6.251"; int port = 19003; struct timeval timeout = { 1, 500000 }; // 1.5 seconds //c = redisConnect(hostname, port); redisContext *con = redisConnectWithTimeout(hostname, port, timeout); if (con == NULL || con->err) { if (con) { printf("Connection error: %s\n", con->errstr); redisFree(con); } else { printf("Connection error: can't allocate redis context\n"); } return -1; } redisReply *reply = (redisReply *)redisCommand(con,"set key hello"); printf("Set return: %s\n", reply->str); freeReplyObject(reply); freeRedis(con); Redis C/C++ 灰狼哥 | 初学一级 | 园豆: 194
提问于:2019-05-13 19:43 显示帮助
使用"Ctrl+Enter"可进行快捷提交,评论支持部分 Markdown 语法:[link](http://example.com) _italic_ **bold** `code`。
< > 分享
分享您的问题

清除回答草稿
您需要 登录 以后才能回答,未注册用户请先 注册 。

科技资讯:

科技学院:

科技百科:

科技书籍:

网站大全:

软件大全:

热门排行