免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2753 | 回复: 3
打印 上一主题 下一主题

[网络] 连接memcached服务器时发生超时,请问是什么原因? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-09-25 21:59 |只看该作者 |倒序浏览
刚开始学习memcached,按照流程安装完libevent和memcached之后,
先运行的服务器,如./memcached -d -u root -m 2048 -l 10.105.53.241 -p 11211,
然后telnet localhost 11211
提示错误
Trying ::1...
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
请问是什么原因?
谢谢~

论坛徽章:
4
白羊座
日期:2013-09-17 21:59:30技术图书徽章
日期:2013-10-12 22:16:03白羊座
日期:2013-10-14 11:01:40双子座
日期:2013-12-17 18:26:39
2 [报告]
发表于 2013-09-26 00:14 |只看该作者
回复 1# wansuiye604
你检查进程启动成功了吗?
印象中memcached不能以root用户启动
-l设置监听ip地址,你设的是10.105.53.241,而不是127.0.0.1


   

论坛徽章:
4
水瓶座
日期:2013-09-06 12:27:30摩羯座
日期:2013-09-28 14:07:46处女座
日期:2013-10-24 14:25:01酉鸡
日期:2014-04-07 11:54:15
3 [报告]
发表于 2013-09-26 13:19 |只看该作者
telnet localhost 11211

很明显host写错了.

论坛徽章:
4
白羊座
日期:2013-09-17 21:59:30技术图书徽章
日期:2013-10-12 22:16:03白羊座
日期:2013-10-14 11:01:40双子座
日期:2013-12-17 18:26:39
4 [报告]
发表于 2013-09-26 13:53 |只看该作者
查了下,发现记错了,不能用root启动而不使用-u切换用户,但可以使用-u指定root
  1. /* lose root privileges if we have them */
  2.     if (getuid() == 0 || geteuid() == 0) {
  3.         if (username == 0 || *username == '\0') {
  4.             fprintf(stderr, "can't run as root without the -u switch\n");
  5.             exit(EX_USAGE);
  6.         }
  7.         if ((pw = getpwnam(username)) == 0) {
  8.             fprintf(stderr, "can't find the user %s to switch to\n", username);
  9.             exit(EX_NOUSER);
  10.         }
  11.         if (setgid(pw->pw_gid) < 0 || setuid(pw->pw_uid) < 0) {
  12.             fprintf(stderr, "failed to assume identity of user %s\n", username);
  13.             exit(EX_OSERR);
  14.         }
  15.     }
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP