编程开源技术交流,分享技术与知识

网站首页 > 开源技术 正文

Mac电脑使用brew安装Redis(mac m1安装redis)

wxchong 2024-07-08 23:33:20 开源技术 17 ℃ 0 评论

搜索redis可用版本

brew search redis

> brew search redis

Warning: Error searching on GitHub: GitHub API Error: Requires authentication

The GitHub credentials in the macOS keychain may be invalid.

Clear them with:

printf "protocol=https\nhost=github.com\n" | git credential-osxkeychain erase

Create a GitHub personal access token:

https://github.com/settings/tokens/new?scopes=gist,repo,workflow&description=Homebrew

echo 'export HOMEBREW_GITHUB_API_TOKEN=your_token_here' >> ~/.zshrc

==> Formulae

hiredis redis ? redis@3.2 redis@6.2 redo

iredis redis-leveldb redis@4.0 redir

==> Casks

another-redis-desktop-manager redis-pro

jpadilla-redis redisinsight

medis

直接安装最新版本

brew install redis

常用命令

启动redis,这种启动方式关闭终端窗口之后,服务仍在后台运行

brew services start redis

查看本地运行的服务列表

brew services list

连接本地的Redis,简单操作并退出连接

redis-cli -h 127.0.0.1

> redis-cli -h 127.0.0.1

127.0.0.1:6379> set a 1

OK

127.0.0.1:6379> keys a

1) "a"

127.0.0.1:6379> get a

"1"

127.0.0.1:6379> del a

(integer) 1

127.0.0.1:6379> exit

使用指定配置文件启动服务

redis-server /opt/homebrew/etc/redis.conf

测试redis server服务是否启动

redis-cli ping

Tags:

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表