最近在centos 7下面安装openstack进行测试。@H_404_1@
安装到memcached这一步骤时启动服务后查看服务状态报错@H_404_1@
系统内核版本:@H_404_1@
[root@openstack ~]# uname -a@H_404_1@
Linux openstack 3.10.0-514.16.1.el7.x86_64 #1 SMP Wed Apr 12 15:04:24 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux@H_404_1@
启动memcached服务并查看状态
@H_404_1@
[root@openstack sysconfig]# systemctl restart memcached@H_404_1@
[root@openstack sysconfig]# systemctl status memcached@H_404_1@
● memcached.service - memcached daemon@H_404_1@
Loaded: loaded (/usr/lib/systemd/system/memcached.service; enabled; vendor preset: disabled)@H_404_1@
Active: Failed (Result: exit-code) since Mon 2017-04-24 13:36:10 CST; 8s ago@H_404_1@
Process: 14143 ExecStart=/usr/bin/memcached -p ${PORT} -u ${USER} -m ${CACHESIZE} -c ${MAXCONN} $OPTIONS (code=exited,status=71)@H_404_1@
Main PID: 14143 (code=exited,status=71)@H_404_1@
@H_404_1@
Apr 24 13:36:10 openstack systemd[1]: Started memcached daemon.@H_404_1@
Apr 24 13:36:10 openstack systemd[1]: Starting memcached daemon...@H_404_1@
Apr 24 13:36:10 openstack memcached[14143]: Failed to listen on TCP port 11211: Address already in use@H_404_1@
Apr 24 13:36:10 openstack systemd[1]: memcached.service: main process exited,code=exited,status=71/n/a@H_404_1@
Apr 24 13:36:10 openstack systemd[1]: Unit memcached.service entered Failed state.@H_404_1@
Apr 24 13:36:10 openstack systemd[1]: memcached.service Failed.@H_404_1@
又返回去查看/etc/sysconfig/memcached配置文件@H_404_1@
[root@openstack sysconfig]# more memcached@H_404_1@
PORT="11211"@H_404_1@
USER="memcached"@H_404_1@
MAXCONN="1024"@H_404_1@
CACHESIZE="64"@H_404_1@
OPTIONS="-l 127.0.0.1,openstack"@H_404_1@
这么配置发现不行,然后去搜了相关报错内容,根据报错信息,以为是端口被占用,通过netstat -antup命令并没有发现相关端口被占用@H_404_1@
[root@openstack sysconfig]# netstat -antup@H_404_1@
Active Internet connections (servers and established)@H_404_1@
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name @H_404_1@
tcp 0 0 0.0.0.0:4369 0.0.0.0:* LISTEN 1/systemd @H_404_1@
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 862/sshd @H_404_1@
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1304/master @H_404_1@
tcp 0 0 0.0.0.0:25672 0.0.0.0:* LISTEN 12914/beam @H_404_1@
tcp 0 0 192.168.20.143:3306 0.0.0.0:* LISTEN 12517/MysqLd @H_404_1@
tcp 0 52 192.168.20.143:22 192.168.20.210:58818 ESTABLISHED 14292/sshd: root@pt@H_404_1@
tcp 0 0 127.0.0.1:42502 127.0.0.1:4369 ESTABLISHED 12914/beam @H_404_1@
tcp 0 0 127.0.0.1:4369 127.0.0.1:42502 ESTABLISHED 13000/epmd @H_404_1@
tcp 0 0 192.168.20.143:22 192.168.20.210:53631 ESTABLISHED 11895/sshd: root@pt@H_404_1@
tcp6 0 0 :::22 :::* LISTEN 862/sshd @H_404_1@
tcp6 0 0 ::1:25 :::* LISTEN 1304/master @H_404_1@
tcp6 0 0 :::5672 :::* LISTEN 12914/beam @H_404_1@
udp 0 0 127.0.0.1:323 0.0.0.0:* 634/chronyd @H_404_1@
udp6 0 0 ::1:323 :::* 634/chronyd @H_404_1@
[root@openstack sysconfig]#@H_404_1@
https://serverfault.com/questions/286381/memcached-problems-failed-to-listen-on-tcp-port-11211 @H_404_1@
大意是memcached绑定到第一个IP地址上面,127.0.0.1与localhost是冲突的,所以偿试绑定到第二块网卡的地址上面,但是我的测试环境里面并没有第二块网卡,所以我就删除了/etc/sysconfig/memcached里面的option行并保存@H_404_1@
然后重新启动服务@H_404_1@
[root@openstack sysconfig]# systemctl restart memcached@H_404_1@
[root@openstack sysconfig]# systemctl status memcached@H_404_1@
● memcached.service - memcached daemon@H_404_1@
Loaded: loaded (/usr/lib/systemd/system/memcached.service; enabled; vendor preset: disabled)@H_404_1@
Active: active (running) since Mon 2017-04-24 13:57:24 CST; 2s ago@H_404_1@
Main PID: 14485 (memcached)@H_404_1@
CGroup: /system.slice/memcached.service@H_404_1@
└─14485 /usr/bin/memcached -p 11211 -u memcached -m 64 -c 1024@H_404_1@
@H_404_1@
Apr 24 13:57:24 openstack systemd[1]: Started memcached daemon.@H_404_1@
Apr 24 13:57:24 openstack systemd[1]: Starting memcached daemon...@H_404_1@
[root@openstack sysconfig]#@H_404_1@