Install Redis on macOS
  01BFOGI7NzGp 2023年11月24日 43 0

 

Use Homebrew to install and start Redis on macOS

This guide shows you how to install Redis on macOS using Homebrew. Homebrew is the easiest way to install Redis on macOS. If you'd prefer to build Redis from the source files on macOS, see Installing Redis from Source.

Prerequisites

First, make sure you have Homebrew installed. From the terminal, run:

brew --version

If this command fails, you'll need to follow the Homebrew installation instructions.

Installation

From the terminal, run:

brew install redis

This will install Redis on your system.

==> Caveats
==> redis
To start redis now and restart at login:
  brew services start redis
Or, if you don't want/need a background service you can just run:
  /usr/local/opt/redis/bin/redis-server /usr/local/etc/redis.conf

 

Starting and stopping Redis in the foreground

To test your Redis installation, you can run the redis-server executable from the command line:

redis-server

If successful, you'll see the startup logs for Redis, and Redis will be running in the foreground.

To stop Redis, enter Ctrl-C.

Starting and stopping Redis using launchd

As an alternative to running Redis in the foreground, you can also use launchd to start the process in the background:

brew services start redis

This launches Redis and restarts it at login. You can check the status of a launchd managed Redis by running the following:

brew services info redis

If the service is running, you'll see output like the following:

redis (homebrew.mxcl.redis)
Running: ✔
Loaded: ✔
User: miranda
PID: 67975

To stop the service, run:

brew services stop redis

Connect to Redis

Once Redis is running, you can test it by running redis-cli:

redis-cli

This will open the Redis REPL. Try running some commands:

127.0.0.1:6379> lpush demos redis-macOS-demo
OK
127.0.0.1:6379> rpop demos
"redis-macOS-demo"

Next steps

Once you have a running Redis instance, you may want to:

  • Try the Redis CLI tutorial
  • Connect using one of the Redis clients

https://redis.io/docs/getting-started/installation/install-redis-on-mac-os/

 



【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月24日 0

暂无评论

推荐阅读
01BFOGI7NzGp