Install\start redis under mac

the cover

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.confis stored in /usr/local/etcthe 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.

  1. Enter the /usr/local/etc path

    cd /usr/local/etc

  2. Find redis.conf and open it

    you come back.conf

  3. Find the configuration item daemonize no in redis.conf and modify it to yes

    daemonize no

    daemonize yes

  4. Then find bind 127.0.01 and comment it out

    bind 127.0.01

  5. Find requirepass and set the password to: requirepass (password)

    requirepass (password)

  6. 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

  1. Use brew to help start the software

    brew services redis

  2. 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

  1. The correct way to stop redis:

    redis-cli shutdown

  2. Ways to forcibly terminate redis:

    sudo pkill redis-server


More knowledge is being continuously updated!!!


Guess you like

Origin blog.csdn.net/weixin_42464282/article/details/130989825