使用自制程序安装Redis,但当我尝试ping Redis时,它显示这个错误:
Could not connect to Redis at 127.0.0.1:6379: Connection refused
注意: 我尝试关闭防火墙并编辑conf文件,但仍然无法ping通。 我使用的是macOS Sierra和自制版本1.1.11
使用自制程序安装Redis,但当我尝试ping Redis时,它显示这个错误:
Could not connect to Redis at 127.0.0.1:6379: Connection refused
注意: 我尝试关闭防火墙并编辑conf文件,但仍然无法ping通。 我使用的是macOS Sierra和自制版本1.1.11
当前回答
试试这个:
sudo service redis-server restart
其他回答
日期:2021年12月
这个错误有几个原因。我读了一篇文章来解决这个问题。所以我就逐一总结一下要检查什么。
1检查:Redis-Server未启动
redis-server
Also to run Redis in the background, the following command could be used.
redis-server --daemonize yes
2. 检查:防火墙限制
sudo ufw status (inactive)
sudo ufw active (for making active it might disable ssh when first time active. So enable port 22 to access ssh.)
sudo ufw allow 22
sudo ufw allow 6379
3.检查:资源使用情况
ps -aux | grep redis
4. 配置设置限制
sudo vi /etc/redis/redis.conf.
注释下面的行。
# bind 127.0.0.1 ::1
注意:恶意行为者将更难发出请求或访问您的服务器。确保您绑定到正确的IP地址网络。
希望它能帮助到别人。欲了解更多信息,请阅读下面的文章。
https://bobcares.com/blog/could-not-connect-to-redis-connection-refused/
我在这件事上耽搁了很长时间。经过多次尝试,我终于能够正确地配置它了。
产生误差的原因有很多。我试图提供原因和解决方案,以克服这种情况。确保正确安装了redis-server。
6379 Port is not allowed by ufw firewall. Solution: type following command sudo ufw allow 6379 The issue can be related to permission of redis user. May be redis user doesn't have permission of modifying necessary redis directories. The redis user should have permissions in the following directories: /var/lib/redis /var/log/redis /run/redis /etc/redis To give the owner permission to redis user, type the following commands: sudo chown -R redis:redis /var/lib/redis sudo chown -R redis:redis /var/log/redis sudo chown -R redis:redis /run/redis sudo chown -R redis:redis /etc/redis. Now restart redis-server by following command: sudo systemctl restart redis-server
希望这对某些人有所帮助。
我试图连接我的Redis运行在wsl2从vs代码运行在Windows。
我列出了对我有效的方法,以及我执行这些方法的顺序:
1) sudo ufw allow 6379
2) Update redis.conf to bind 127.0.0.1 ::1 192.168.1.7
3) sudo service redis-server restart
注意:这是我第一次在wsl2上安装Redis,而且还没有运行任何命令。
如果对你有用,请告诉我。 谢谢。
在Apple Silicon上连接Redis错误(Macbook Pro M1 - 2020年12月),你只需要知道两件事:
使用sudo运行redis-server将删除服务器启动错误
Shell % sudo redis-server
为了将其作为服务“daemonize”运行,它将允许您在后台运行
Shell % sudo redis-server—daemonize是
使用以下步骤验证: Shell % redis-cli ping
希望这能帮助所有担心缺少文档的Macbook Pro M1用户。
redis-server --daemonize yes
通过运行该命令解决了此问题。