(Redis): Install Redis, service startup, client connection and basic configuration in linux environment

table of Contents

Redis installation in linux environment

Redis basic environment settings

Redis service start

Redis client connection

Redis server configuration

practice

Redis installation in linux environment

Redis basic environment settings

  • Create soft link
ln -s 原始目录名 快速访问目录名
  • Create a configuration file management directory
mkdir conf
mkdir config
  • Create data file management directory
mkdir data

Redis service start

  • Start with default configuration
redis-server
redis-server –-port 6379
redis-server –-port 6380 ……
  • Specify the configuration file to start
redis-server redis.conf
redis-server redis-6379.conf
redis-server redis-6380.conf ……
redis-server conf/redis-6379.conf
redis-server config/redis-6380.conf ……

Redis client connection

  • Default connection
redis-cli
  • Connect to the specified server
redis-cli -h 127.0.0.1
redis-cli –port 6379
redis-cli -h 127.0.0.1 –port 6379

Redis server configuration

basic configuration
  • daemonize yes
    • Start as a daemon process. Using this startup method, redis will exist as a service, and the log will no longer be printed to the command window
  • port 6***
    • Set the current service startup port number
  • dir "/custom directory/redis/data"
    • Set the save location of the current service file, including log files, persistent files (explained in detail later), etc.
  • logfile "6***.log“
    • Set the log file name for easy reference

practice

  • To start multiple redis servers, you need to set different ports to start

  • Connect to the specified port server

  • View redis configuration file

  • Configure

  • Start the server through the configuration file

  • Create a conf file directory, move the previous custom configuration file to this directory, and create a configuration file again for configuration

  • Set 6380 configuration file

  • start up

  • Connect for testing

  • View log

Guess you like

Origin blog.csdn.net/baidu_41388533/article/details/108930922