redis installation details

Disclaimer: This article is a blogger original article, follow the CC 4.0 by-sa copyright agreement, reproduced, please attach the original source link and this statement.
Article Source: https://blog.csdn.net/weixin_39270764/article/details/82018670

1.cd command to your download folder

2. Enter the command to download redis 

wget http://download.redis.io/releases/redis-4.0.8.tar.gz

3. Extract the downloaded installation package

tar xzvf redis-4.0.8.tar.gz

4. Go to the unpack folder good

cd redis-4.0.8

5. Compile

make

6. Go to the src folder

cd src

7. Specify the installation directory, use this address is on the line, easy to forget the chaos set

make install PREFIX=/usr/local/redis

8.cd to the installation directory

cd ../

9. Create a directory to store configuration files in the installation position of redis

mkdir /usr/local/redis/etc

10. put the configuration file you just created directory

mv redis.conf /usr/local/redis/etc

11. Configure redis start for the background (vi command will not be Baidu, the basic is how to search, how to modify and how to save)

vi /usr/local/redis/etc/redis.conf

Search daemonize no change daemonize yes under 12.vi interface

          1.  

            grep -n daemonize /usr/local/redis/etc/redis.conf find out where the line 

                          136:daemonize no
                152:# When the server runs non daemonized, no pid file is created if none is
                     153:# specified in the configuration. When the server is daemonized, the pid file
                          170:# output for logging but daemonize, logs will be sent to /dev/null

            vim +136 /usr/local/redis/etc/redis.conf jump to that line editing 

  1. Cursor movement corresponding to position i by
  2.  
    Delete no
  3.  
    Enter yes
  4. Add a password field, the purpose is to link to python  

         requirepass weiwei1234..

  5.  
    esc
  6.  
    :wq
  7.  
    enter

13. redis added to the boot

  1.  
    we /etc/rc.local
  2.  
    / / Add content in it: / usr / local / Redis / bin / Redis -server /usr/local/redis/etc/redis.conf

14. Start redis

/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf 

15. Start redis client

/usr/local/redis/bin/redis-cli

16. Enter ping pong receive the connection is successful

Other commonly used commands

  1.  
    redis pkill  // stop redis
  2.  
     
  3.  
    Uninstall redis:
  4.  
    -rf RM / usr / local / Redis // delete the installation directory
  5.  
     
  6.  
    -rf RM / usr / bin / redis- * // delete all associated command scripts redis

 

Guess you like

Origin www.cnblogs.com/AbnerLc/p/11410028.html