Mac OS安装Redis

本文详细介绍了如何在Mac上使用Homebrew安装特定版本的Redis(如redis@3.2),包括设置环境变量、配置redis.conf文件以守护进程方式运行、启动和停止服务的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

 ## 通过brew搜索redis

brew search redis

Ac-MacBook-Pro:vhost steven$ brew search redis

==> Formulae

hiredis                                           redis@3.2                                         homebrew/linuxbrew-core/redis-leveldb

redis                                             redis@4.0                                         homebrew/linuxbrew-core/redis@3.2

redis-leveldb                                     homebrew/linuxbrew-core/redis                     homebrew/linuxbrew-core/redis@4.0

 

## 安装redis@3.2

brew install redis@3.2

 

## 安装完成的提示

redis@3.2 is keg-only, which means it was not symlinked into /usr/local,

because this is an alternate version of another formula.

If you need to have redis@3.2 first in your PATH run:

  echo 'export PATH="/usr/local/opt/redis@3.2/bin:$PATH"' >> ~/.bash_profile

To have launchd start redis@3.2 now and restart at login:

  brew services start redis@3.2

Or, if you don't want/need a background service you can just run:

  /usr/local/opt/redis@3.2/bin/redis-server /usr/local/etc/redis.conf

 

##设置环境变量

echo 'export PATH="/usr/local/opt/redis@3.2/bin:$PATH"' >> ~/.bash_profile

##使设置生效

source ~/.bash_profile

 

##redis.conf的daemonize为yes,以守护进程的方式启动

vi /usr/local/ect/redis.conf

## 启动redis服务

brew services start redis@3.2 

## 停止redis服务

brew services stop redis@3.2 

## 杀写进程

sudo pkill redis-server

 

转载:https://www.jianshu.com/p/e1e5717049e8

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值