wansuiye604 发表于 2013-09-25 21:59

连接memcached服务器时发生超时,请问是什么原因?

刚开始学习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
请问是什么原因?
谢谢~

井蛙夏虫 发表于 2013-09-26 00:14

回复 1# wansuiye604
你检查进程启动成功了吗?
印象中memcached不能以root用户启动
-l设置监听ip地址,你设的是10.105.53.241,而不是127.0.0.1


   

linux_c_py_php 发表于 2013-09-26 13:19

telnet localhost 11211

很明显host写错了.

井蛙夏虫 发表于 2013-09-26 13:53

查了下,发现记错了,不能用root启动而不使用-u切换用户,但可以使用-u指定root/* lose root privileges if we have them */
    if (getuid() == 0 || geteuid() == 0) {
      if (username == 0 || *username == '\0') {
            fprintf(stderr, "can't run as root without the -u switch\n");
            exit(EX_USAGE);
      }
      if ((pw = getpwnam(username)) == 0) {
            fprintf(stderr, "can't find the user %s to switch to\n", username);
            exit(EX_NOUSER);
      }
      if (setgid(pw->pw_gid) < 0 || setuid(pw->pw_uid) < 0) {
            fprintf(stderr, "failed to assume identity of user %s\n", username);
            exit(EX_OSERR);
      }
    }
页: [1]
查看完整版本: 连接memcached服务器时发生超时,请问是什么原因?