Redis安装及使用说明¶
Redis¶
官网:https://redis.io
一、Mac安装使用 Redis¶
官网帮助:https://redis.io/docs/install/install-redis/
1、Prerequisites
brew --version
2、安装
brew install redis
控制台输出结果
==> Downloading https://download.redis.io/releases/redis-6.0.9.tar.gz
######################################################################## 100.0%
==> make install PREFIX=/usr/local/Cellar/redis/6.0.9 CC=clang BUILD_TLS=yes
==> Caveats
To have launchd 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:
redis-server /usr/local/etc/redis.conf
==> Summary
3、Starting and stopping Redis in the foreground
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.
4、以服务的形式启动 Redis
you can also use launchd to start the process in the background:
// 启动:
brew services start redis
// 检查状态:
brew services info redis
// 停止:
brew services stop redis
二、Install Redis from Source¶
1、Downloading the source files
wget https://download.redis.io/redis-stable.tar.gz
2、Compiling Redis
To compile Redis, first the tarball, change to the root directory, and then run make:
tar -xzvf redis-stable.tar.gz
cd redis-stable
make
If the compile succeeds, you'll find several Redis binaries in the src directory, including:
redis-server: the Redis Server itself
redis-cli is the command line interface utility to talk with Redis.
3、 安装
To install these binaries in /usr/local/bin, run:
sudo make install
4、前台启动
Starting and stopping Redis in the foreground
redis-server