标题: redis无法连接 [打印本页] 作者: worldtongfb 时间: 2018-4-27 12:41 标题: redis无法连接 centos7 使用addons安装redis 安装完成后 php显示超时进入/usr/local/redis/bin redis-cli 卡住 没反应
service redis restart 和service redis stop都是卡在Stopping Redis server... 然后没反应
kill之后 重新启动正常 但是连接还是超时,开了远程连接显示操作超时
log是正常的
4740:M 27 Apr 12:28:20.653 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
4740:M 27 Apr 12:28:20.653 # Server started, Redis version 3.2.8
4740:M 27 Apr 12:28:20.653 * DB loaded from disk: 0.000 seconds
4740:M 27 Apr 12:28:20.653 * The server is now ready to accept connections on port 6379
有一次出现绑定端口时有占用 kill之后重启就没了
反复试了几次
偶尔会出现
[root@jdu4e00u53f7 etc]# service redis restart
/var/run/redis.pid does not exist, process is not running
Starting Redis server... done
1245 ./addons.sh install redis
Add to auto startup...
Add redis service at system startup...
Restarting php-fpm......
Gracefully shutting down php-fpm . done
Starting php-fpm done
/var/run/redis.pid exists, process is already running or crashed
====== Redis install completed ======
Redis installed successfully, enjoy it!
访问 timeout
1247 service redis status
Redis server is running.
停止卡住了
service redis stop
Stopping Redis server...
强行停止
service redis kill
force kill redis server...
done
修改log
vi /usr/local/redis/etc/redis.conf 改成允许远程连接
启动
service redis start
Starting Redis server... done
还是超时 查看日志
11593:M 27 Apr 12:51:34.292 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
11593:M 27 Apr 12:51:34.292 # Server started, Redis version 3.2.8
11593:M 27 Apr 12:51:34.292 * DB loaded from disk: 0.000 seconds
11593:M 27 Apr 12:51:34.292 * The server is now ready to accept connections on port 6379
netstat -atunlp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 11593/redis-server
端口和进程都对
重启
service redis restart
Stopping Redis server...
netstat -atunlp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 11593/redis-server
也不太懂到底啥问题 就是觉得怎么装上了不好使 卸载了反而好使了 太神奇了吧作者: licess 时间: 2018-4-27 13:43
WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
这个的话编辑 /etc/sysctl.conf 加上 一行 net.core.somaxconn = 2048 然后执行 sysctl -p 就行