ProxyPool启动出现错误:redis.exceptions.ConnectionError: Error 111 connecting to 127.0.0.1:6379. Connection refused.
可能与您的问题没有直接关系,但是我遇到了同样的错误,结果发现我的系统上未安装redis-server软件包,或者是没有启动。
解决方法是sudo apt-get install redis-server
。别忘了开始您的服务sudo service redis-server start
,您可以使用该命令sudo service redis-server {start|stop|restart|force-reload|status}
作为参考
也有可能是Redis出了问题,查看一下状态:
sudo service redis status
没运行就启动一下:
sudo service redis start
如果报错
● redis.service - LSB: starts Redis
Loaded: loaded (/etc/init.d/redis; generated)
Active: failed (Result: exit-code) since Thu 2021-04-15 21:08:53 CST; 14s ago
Docs: man:systemd-sysv-generator(8)
Process: 20260 ExecStart=/etc/init.d/redis start (code=exited, status=1/FAILURE)
Apr 15 21:08:53 iZ2zeakg8zcsgqnx1q3txsZ systemd[1]: Starting LSB: starts Redis...
Apr 15 21:08:53 iZ2zeakg8zcsgqnx1q3txsZ redis[20260]: Redis is not running, buy pid file is exits /www/server/redis/redis.pid
Apr 15 21:08:53 iZ2zeakg8zcsgqnx1q3txsZ systemd[1]: redis.service: Control process exited, code=exited status=1
Apr 15 21:08:53 iZ2zeakg8zcsgqnx1q3txsZ systemd[1]: redis.service: Failed with result 'exit-code'.
Apr 15 21:08:53 iZ2zeakg8zcsgqnx1q3txsZ systemd[1]: Failed to start LSB: starts Redis.
原因可能是redis 没有正常关闭,redis.pid文件残留。
解决办法:
[root@localhost ]# vi /etc/init.d/redis
搜索【Redis is not running, buy pid file is exits】
大概在38行
34 redis_start(){
35 if [ -f "/www/server/redis/redis.pid" ]; then
36 ps -p $(cat ${PIDFILE}) > /dev/null 2>&1
37 if [ $? -ne "0" ]; then
38 echo Redis is not running, buy pid file is exits ${PIDFILE}
39
40 exit 1
41 else
42 echo "redis is running! ($(cat ${PIDFILE}))"
43 exit 0
44 fi
45 fi
46 echo "Starting redis server..."
47 sudo -u redis $EXEC $CONF
48 echo ${REDIS_PORT} > /www/server/redis/start.pl
49 echo "Starting redis success!"
50 }
在39行加入(exit 1之前 )
rm -rf /www/server/redis/redis.pid && service redis restart && service redis status
然后sudo service redis restart
试试查看效果