CENTOS 7下failed to listen on TCP port 11211: Address already in use

前端之家收集整理的这篇文章主要介绍了CENTOS 7下failed to listen on TCP port 11211: Address already in use前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

最近在centos 7下面安装openstack进行测试。

安装到memcached这一步骤时启动服务后查看服务状态报错

系统内核版本:

[root@openstack ~]# uname -a

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

启动memcached服务并查看状态

[root@openstack sysconfig]# systemctl restart memcached

[root@openstack sysconfig]# systemctl status memcached

● memcached.service - memcached daemon

Loaded: loaded (/usr/lib/systemd/system/memcached.service; enabled; vendor preset: disabled)

Active: Failed (Result: exit-code) since Mon 2017-04-24 13:36:10 CST; 8s ago

Process: 14143 ExecStart=/usr/bin/memcached -p ${PORT} -u ${USER} -m ${CACHESIZE} -c ${MAXCONN} $OPTIONS (code=exited,status=71)

Main PID: 14143 (code=exited,status=71)


Apr 24 13:36:10 openstack systemd[1]: Started memcached daemon.

Apr 24 13:36:10 openstack systemd[1]: Starting memcached daemon...

Apr 24 13:36:10 openstack memcached[14143]: Failed to listen on TCP port 11211: Address already in use

Apr 24 13:36:10 openstack systemd[1]: memcached.service: main process exited,code=exited,status=71/n/a

Apr 24 13:36:10 openstack systemd[1]: Unit memcached.service entered Failed state.

Apr 24 13:36:10 openstack systemd[1]: memcached.service Failed.

又返回去查看/etc/sysconfig/memcached配置文件

[root@openstack sysconfig]# more memcached

PORT="11211"

USER="memcached"

MAXCONN="1024"

CACHESIZE="64"

OPTIONS="-l 127.0.0.1,openstack"

这么配置发现不行,然后去搜了相关报错内容,根据报错信息,以为是端口被占用,通过netstat -antup命令并没有发现相关端口被占用

[root@openstack sysconfig]# netstat -antup

Active Internet connections (servers and established)

Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name

tcp 0 0 0.0.0.0:4369 0.0.0.0:* LISTEN 1/systemd

tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 862/sshd

tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1304/master

tcp 0 0 0.0.0.0:25672 0.0.0.0:* LISTEN 12914/beam

tcp 0 0 192.168.20.143:3306 0.0.0.0:* LISTEN 12517/MysqLd

tcp 0 52 192.168.20.143:22 192.168.20.210:58818 ESTABLISHED 14292/sshd: root@pt

tcp 0 0 127.0.0.1:42502 127.0.0.1:4369 ESTABLISHED 12914/beam

tcp 0 0 127.0.0.1:4369 127.0.0.1:42502 ESTABLISHED 13000/epmd

tcp 0 0 192.168.20.143:22 192.168.20.210:53631 ESTABLISHED 11895/sshd: root@pt

tcp6 0 0 :::22 :::* LISTEN 862/sshd

tcp6 0 0 ::1:25 :::* LISTEN 1304/master

tcp6 0 0 :::5672 :::* LISTEN 12914/beam

udp 0 0 127.0.0.1:323 0.0.0.0:* 634/chronyd

udp6 0 0 ::1:323 :::* 634/chronyd

[root@openstack sysconfig]#

通过搜索到相关的解决方案,原文地址:

https://serverfault.com/questions/286381/memcached-problems-failed-to-listen-on-tcp-port-11211

大意是memcached绑定到第一个IP地址上面,127.0.0.1与localhost是冲突的,所以偿试绑定到第二块网卡的地址上面,但是我的测试环境里面并没有第二块网卡,所以我就删除了/etc/sysconfig/memcached里面的option行并保存

然后重新启动服务

[root@openstack sysconfig]# systemctl restart memcached

[root@openstack sysconfig]# systemctl status memcached

● memcached.service - memcached daemon

Loaded: loaded (/usr/lib/systemd/system/memcached.service; enabled; vendor preset: disabled)

Active: active (running) since Mon 2017-04-24 13:57:24 CST; 2s ago

Main PID: 14485 (memcached)

CGroup: /system.slice/memcached.service

└─14485 /usr/bin/memcached -p 11211 -u memcached -m 64 -c 1024


Apr 24 13:57:24 openstack systemd[1]: Started memcached daemon.

Apr 24 13:57:24 openstack systemd[1]: Starting memcached daemon...

[root@openstack sysconfig]#

这样就解决了这个问题

能不能通过添加另一块网卡解决这个问题我还没有测试。

原文链接:https://www.f2er.com/centos/377840.html

猜你在找的CentOS相关文章