使用自制程序安装Redis,但当我尝试ping Redis时,它显示这个错误:

Could not connect to Redis at 127.0.0.1:6379: Connection refused

注意: 我尝试关闭防火墙并编辑conf文件,但仍然无法ping通。 我使用的是macOS Sierra和自制版本1.1.11


当前回答

Mac版Redis:

1-酿造安装redis 2-酿造服务启动redis 3- redis-cli ping

$ brew services start redis 
$ brew services stop redis
$ brew services restart redis

午餐自动启动选项:

$ ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents
# autostart activate
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
# autostart deactivate
$ launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.redis.plist

Redis conf默认路径:/usr/local/etc/redis.conf

其他回答

在我的情况下,它是包含一些字符的密码,如',修改后,服务器启动没有问题。

安装完redis后,从终端输入:

redis-server

Redis-Server将启动

试试这个:

sudo service redis-server restart

我使用的是Ubuntu 18.04 我刚刚在CMD中输入了这个命令 Sudo systemctl start redis-server 现在它正在发挥作用。所以我认为我的redis服务器没有启动,为什么它显示我的错误 无法连接到Redis 127.0.0.1:6379:连接被拒绝。

实际上,你需要在安装后运行“redis-server &”来启动服务,当你只运行“redis-server”时,服务以非分离模式运行。强调“&”