mac上redis启动问题

用户在Mac上通过Homebrew尝试启动Redis服务时遇到连接失败的问题。启动命令无错误提示,但redis-cli连接显示连接被拒绝。尝试使用sudo启动服务后,问题依旧存在,同时出现输入/输出错误。在进行多次启动和停止操作后,最终通过添加sudo权限成功启动Redis,但警告Redis必须以非root用户运行。最后,用户能够成功连接到Redis服务。
摘要由CSDN通过智能技术生成

问题描述

 在mac上启动redis后,没有错误提示,但连接不上

(base) C02FRH0XMD6M:work haiping.lai$ brew services start redis
==> Tapping homebrew/services
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-services'...
remote: Enumerating objects: 1863, done.
remote: Counting objects: 100% (370/370), done.
remote: Compressing objects: 100% (124/124), done.
remote: Total 1863 (delta 272), reused 281 (delta 241), pack-reused 1493
Receiving objects: 100% (1863/1863), 518.10 KiB | 479.00 KiB/s, done.
Resolving deltas: 100% (827/827), done.
Tapped 1 command (44 files, 662.7KB).
==> Successfully started `redis` (label: homebrew.mxcl.redis)
(base) C02FRH0XMD6M:work haiping.lai$ redis-cli
Could not connect to Redis at 127.0.0.1:6379: Connection refused
not connected>
(base) C02FRH0XMD6M:work haiping.lai$ brew services start redis
Bootstrap failed: 5: Input/output error
Error: Failure while executing; `/bin/launchctl bootstrap gui/510 /Users/haiping.lai/Library/LaunchAgents/homebrew.mxcl.redis.plist` exited with 5.
(base) C02FRH0XMD6M:work haiping.lai$ lsof -i:6379
(base) C02FRH0XMD6M:work haiping.lai$ ps -ef | grep redis
  510 87280  1490   0  9:47上午 ttys002    0:00.00 grep redis

解决方法

启动时加上sudo:sudo brew services stop redis

(base) C02FRH0XMD6M:work haiping.lai$ sudo brew services stop redis
Warning: Service `redis` is not started.
(base) C02FRH0XMD6M:work haiping.lai$ redis-cli -h 127.0.0.1 -p 6379
Could not connect to Redis at 127.0.0.1:6379: Connection refused
not connected>
(base) C02FRH0XMD6M:work haiping.lai$ brew services start redis
==> Successfully started `redis` (label: homebrew.mxcl.redis)
(base) C02FRH0XMD6M:work haiping.lai$ redis-cli -h 127.0.0.1 -p 6379
Could not connect to Redis at 127.0.0.1:6379: Connection refused
not connected>
(base) C02FRH0XMD6M:work haiping.lai$ sudo brew services start redis
Warning: Taking root:admin ownership of some redis paths:
  /usr/local/Cellar/redis/6.2.6/bin
  /usr/local/Cellar/redis/6.2.6/bin/redis-server
  /usr/local/opt/redis
  /usr/local/opt/redis/bin
  /usr/local/var/homebrew/linked/redis
This will require manual removal of these paths using `sudo rm` on
brew upgrade/reinstall/uninstall.
Warning: redis must be run as non-root to start at user login!
==> Successfully started `redis` (label: homebrew.mxcl.redis)
(base) C02FRH0XMD6M:work haiping.lai$ redis-cli -h 127.0.0.1 -p 6379
127.0.0.1:6379>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值