Redis single-server installation and configuration

Redis download

  • Official website address: redis.io/
  • Chinese website address: www.redis.cn/
  • Download address: download. Redis. IO/releases /

Redis installation environment

Redis does not have an official Windows version, so it is recommended to install Redis on Linux. We use CentOS 7 (a series of Linux operating systems) as the installation environment

Redis installation

  • The GCC environment is required for installing C
yum install -y gcc-c++

yum install -y wget
Copy the code
  • Download and decompress the Redis source code package
Wget http://download.redis.io/releases/redis-5.0.4.tar.gz tar - ZXF redis - 5.0.4. Tar. GzCopy the code
  • To compile the Redis source code, go to the redis-x.x.x directory and run the compilation command
CD redis - 5.0.4 makeCopy the code
  • : To install Redis, use PREFIX to specify the installation path
make install PREFIX=/server/redis
Copy the code

Redis start

The front-end start

  • Start command: redis-server, run bin/redis-server directly to start the former mode

    ./redis-server

  • Close command: CTRL + C

  • Disadvantages: When the client window closes, the redis-server program ends. This method is not recommended

  • Start the legend

Back end start (daemon start)

  • Copy the redis-x.x.x/redis.conf configuration file to the bin directory of the Redis installation directory

Cp/root/redis - 5.0.4 / redis. Conf/server/redis/bin /

  • Modify the redis. Conf

vim redis.conf

# bind 127.0.0.1 # whether to enable protected mode. If yes, this will be no protected-mode noCopy the code

  • Start the service

./redis-server redis.conf

  • Close the service

./redis-cli shutdown

  • Start the legend

Other commands

  • Redis-server: starts the Redis service
  • Redis -cli: access the redis command client
  • Redis-benchmark: Tool for performance testing
  • Redis-check-aof: a tool for checking aof files
  • Redis-check-dump: a tool for checking RDB files
  • Redis-sentinel: Starts the sentinel monitoring service