1. 程式人生 > 實用技巧 >brew install redis

brew install redis

mac:

1、安裝redis

brew install redis

Warning: Treating redis as a formula. For the cask, use homebrew/cask/redis

==> Downloading https://homebrew.bintray.com/bottles/openssl%401.1-1.1.1g.catali

==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/1926679569c6af5337de8

######################################################################## 100.0%

==> Downloading https://homebrew.bintray.com/bottles/redis-6.0.8.catalina.bottle

==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/d015cdb6b89904d6f81ff

######################################################################## 100.0%

Error: redis 5.0.8 is already installed

To upgrade to 6.0.8, run `brew upgrade redis`.

輸入brew upgrade redis

耐心等待,馬上就會更新到6.0.8

之前沒有更新brew,所以下載的是5.0.8版本

2、啟動redis

brew services start redis 或 redis-server/usr/local/etc/redis.conf 可以省

==> Successfully started `redis` (label: homebrew.mxcl.redis)

3、停止redis

brew services stop redis

Stopping `redis`... (might take a while)

==> Successfully stopped `redis` (label: homebrew.mxcl.redis)

4、重啟redis

brew services restart redis

重啟直接報錯:Error: undefined method `named' for #<OptionParser:0x00007fc65f26a3b8> /usr/local/Homebrew/Library/T

解決:

brew update -v

更新一下brew就可以了。應該是新了mac,然後就得更新一下brew

==> Successfully started `redis` (label: homebrew.mxcl.redis)

5、測試redis

redis-cli ping
==>PONG

6、測試一下redis-cli

% redis-cli

127.0.0.1:6379> set foo bar

OK

127.0.0.1:6379> get foo

"bar"

127.0.0.1:6379>

7、放二個免費的開源工具

https://github.com/qishibo/AnotherRedisDesktopManager

https://quick123.net/




新建連線,就可以連上本機的,然後就可以在左側看到所有的key,右側就是值。