Original link: Install\start redis under mac | Elvin
1. Description
You can use homebrew to install under mac, if you have not installed brew, please refer to
2. Installation method
Enter the following command in the mac terminal to install redis
brew install redis
3. View the path and configuration file location after installing redis
The software installed by brew is generally in usr/local/Cellar/
the path by default
The redis configuration file redis.conf
is stored in /usr/local/etc
the path
4. Configure the redis.conf file
Redis is started in the foreground by default, and the actual development is carried out in the form of a daemon process.
-
Enter the /usr/local/etc path
cd /usr/local/etc
-
Find redis.conf and open it
you come back.conf
-
Find the configuration item daemonize no in redis.conf and modify it to yes
daemonize nodaemonize yes
-
Then find bind 127.0.01 and comment it out
bind 127.0.01 -
Find requirepass and set the password to: requirepass (password)
requirepass (password)
-
Just save the modified content of redis.conf (press esc and enter: wq and press Enter to save)
5. Start the redis service command
There are two ways to start
-
Use brew to help start the software
brew services redis
-
start server
redis-server /usr/local/etc/redis.conf
6. View the redis service process command
ps axu | grep redis
7. Start the redis client
Start the redis client and connect to the local redis service;
Redis default service port number 6379
, default auth is empty;
Enter the following command to connect
redis-cli
8. Close the redis service
There are also two ways to close
-
The correct way to stop redis:
redis-cli shutdown
-
Ways to forcibly terminate redis:
sudo pkill redis-server
More knowledge is being continuously updated!!!