Installation of Redis under Windows and Linux systems

1. Redis installation

1. Windows system installation

  1. Download the installation package, link: https://pan.baidu.com/s/13A1mDApAct31bYyRXOfaNg?pwd=l7kq
    Extraction code:l7kq
  2. decompress

2. Linux system installation

  1. Download the installation package https://download.redis.io/releases/, or my Baidu network disk also has:
    link: https://pan.baidu.com/s/1Z0LGJewCnVQidZLbTixPzQ?pwd=qxlv
    extraction code:qxlv
  2. Upload the installation package to the Linux system, I use finalshellupload
    insert image description here
  3. Unzip the installation packagetar -zxvf redis-4.0.0.tar.gz -C /usr/local
  4. Install compilation dependenciesyum install gcc-c++
  5. Compile redis, enter the decompressed redis directory, and execute the command to compile:make
  6. Enter its src directory and execute:make install

2. Start and connect

1. Windows system

  1. Start: Click redis-server.exe, or enter the redis directory from the command line, and execute redis-server
  2. Connection: Click redis-cli.exe, or command line to enter the redis directory, execute redis-cli

2. Linux system

  • Start the service: go to the src directory of redis and execute the command: ./redis-server. After installation, the service runs in the foreground by default, and there is a file in the same level directory as redis and src when configuring the background operation redis.config. Change the parameters in it daemonizeto yes
  • Connection: Go to the src directory of redis and execute the command:./redis-cli

3. Modify permissions

1. Windows system

  1. Modify password: open redis.windows.configthe file, find it requirepass foobared, uncomment it, and replace foobared with your password. Or connect to redis, enter the command: config set requirepass 1234, the modification is successful when OK appears, and enter the command when connecting to redis later: redis-cli -a 密码.
  2. Open connection permission: redis.windows.configfound in the file bind 127.0.0.1, just comment it out.

2. Linux system

  1. Change password: redis.confFind requirepass foobaredit in the file, uncomment it, and replace foobared with your password. First turn off all services and then restart the service, and then pass the command: redis-cli -a 密码connect
  2. Open connection permission: Found in the configuration file: bind 127.0.0.1, comment it out, because no comment means the default local connection. Restart the service, if you still can’t connect, it may be that the port is not open, open port 6379: firewall-cmd --zone=public --add-port=6379/tcp --permanent, refresh: firewall-cmd --reload, you can pass: firewall-cmd --zone=public --list-portscheck whether the port is opened successfully, and now other servers can connect to this redis.

Guess you like

Origin blog.csdn.net/chenxingxingxing/article/details/125052997