使用自制程序安装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
当前回答
实际上,你需要在安装后运行“redis-server &”来启动服务,当你只运行“redis-server”时,服务以非分离模式运行。强调“&”
其他回答
这是连接你的redis的更好方式。
首先,像这样检查redis服务器的ip地址。
Ps -ef | grep redis
结果是“redis 1184 10 0 ....”172. . x.x.x /usr/bin/redis-server: 6379
然后你可以像这样用-h(主机名)选项连接到redis。
Redis-cli -h 172.x.x.x
我在这件事上耽搁了很长时间。经过多次尝试,我终于能够正确地配置它了。
产生误差的原因有很多。我试图提供原因和解决方案,以克服这种情况。确保正确安装了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.conf文件如下:
bind 127.0.0.1 ::1
bind 192.168.1.7
当,它真的需要这样(一行):
bind 127.0.0.1 ::1 192.168.1.7
安装完redis后,从终端输入:
redis-server
Redis-Server将启动
在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用户。