Fork me on GitHub

Mac安装Redis

Mac安装Redis

# 安装Homebrew命令,Homebrew安装的软件会默认在/usr/local/Cellar/路径下
# /bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
# Homebrew命令安装redis
brew install redis

启动Redis

#方式一:使用brew帮助我们启动软件
brew services start redis
#方式二
redis-server /usr/local/etc/redis.conf

#执行以下命令
redis-server

#查看redis服务进程
ps axu | grep redis

redis-cli连接redis服务

redis默认端口号6379,默认auth为空,输入以下命令即可连接

redis-cli -h 127.0.0.1 -p 6379

关闭redis服务

# 正确停止Redis的方式应该是向Redis发送SHUTDOWN命令
redis-cli shutdown

# 强行终止redis
sudo pkill redis-server

redis.conf

redis默认是前台启动,如果我们想以守护进程的方式运行(后台运行),可以在redis.conf中将daemonize no,修改成yes即可。

Redis客户端可视化工具

https://github.com/RedisInsight/RedisDesktopManager/releases

posted @ 2024-04-19 14:07  秋夜雨巷  阅读(93)  评论(0编辑  收藏  举报