在mac上通过Homebrew安装redis

使用Homebrew安装redis可以减少大量的安装和配置的工作量。

安装命令 
brew install redis 
安装完成后的提示信息

To have launchd start redis at login: 
ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents 
Then to load redis now: 
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist 
Or, if you don’t want/need launchctl, you can just run: 
redis-server /usr/local/etc/redis.conf
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

开机启动redis命令 
$ ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents

使用launchctl启动redis server 
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist

使用配置文件启动redis server 
$ redis-server /usr/local/etc/redis.conf

停止redis server的自启动 
$ launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.redis.plist

redis 配置文件的位置 
/usr/local/etc/redis.conf

卸载redis和它的文件 
brewuninstallredisbrewuninstallredis rm ~/Library/LaunchAgents/homebrew.mxcl.redis.plist

测试redis server是否启动 
$ redis-cli ping

转自https://blog.csdn.net/chenshuai1993/article/details/51519384

使用brew搜索、安装redis,查看都有哪些版本的redis可以安装:
      brew search redis


用brew安装需要的redis:
      brew install redis@3.2


将redis的二进制文件的路径添加到环境变量path中:
echo 'export PATH="/usr/local/opt/redis@3.2/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile

执行上面的命令后,确定redis-cli -h可以运行。
启动redis服务:
brew services start redis@3.2

启动之后,需要能够在`brew services list`看到redis的状态为started
连接到本地的redis-server:

redis-server -h 127.0.0.1


在mac上,redis-cli会自动提示相关参数。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值