在开发过程中,需要本地进行安装Redis进行测试,记录了下MacOS环境下安装Redis,以及设置密码。 Brew 安装 $ brew install redis 启动服务 # 启动服务brew s
在开发过程中,需要本地进行安装Redis进行测试,记录了下MacOS环境下安装Redis,以及设置密码。
$ brew install redis
# 启动服务brew services start redis# 关闭服务brew services stop redis# 重启服务brew services restart redis# 查看 redis 服务进程ps axu | grep redis# redis默认端口号6379,默认 auth 为空,输入以下命令即可连接redis-cli -h 127.0.0.1 -p 6379
重启服务后密码会失效
$ config set requirepass 123456
需要修改配置 redis.conf
# 查看 brew 安装 redis 的配置文件地址$ brew list redis/opt/homebrew/Cellar/redis/7.0.11/.bottle/etc/ (2 files)/opt/homebrew/Cellar/redis/7.0.11/bin/redis-benchmark/opt/homebrew/Cellar/redis/7.0.11/bin/redis-check-aof/opt/homebrew/Cellar/redis/7.0.11/bin/redis-check-rdb/opt/homebrew/Cellar/redis/7.0.11/bin/redis-cli/opt/homebrew/Cellar/redis/7.0.11/bin/redis-sentinel/opt/homebrew/Cellar/redis/7.0.11/bin/redis-server/opt/homebrew/Cellar/redis/7.0.11/homebrew.mxcl.redis.plist/opt/homebrew/Cellar/redis/7.0.11/homebrew.redis.service# 进入目录$ cd /opt/homebrew/Cellar/redis/7.0.11# 查看 redis 配置文件位置$ cat homebrew.mxcl.redis.plist<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "Http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0">...<array><string>/opt/homebrew/opt/redis/bin/redis-server</string><string>/opt/homebrew/etc/redis.conf</string></array>...</plist># 编辑 /opt/homebrew/etc/redis.conf$ vim /opt/homebrew/etc/redis.conf# 查找 「#requirepass foobared」 进行修改requirepass 123456# 重启 redis 服务$ brew services restart redis
# 查询密码$ config get requirepass# 验证密码127.0.0.1:6379> auth 123456
来源地址:https://blog.csdn.net/John_rush/article/details/132385171
--结束END--
本文标题: MacOS 安装Redis并设置密码
本文链接: https://www.lsjlt.com/news/423309.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-01-21
2023-10-28
2023-10-28
2023-10-27
2023-10-27
2023-10-27
2023-10-27
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0