One download
Two compilation
Make in the unzip directory
Make install in the src directory of the unzip directory
Three installation
make PREFIX=/usr/local/redis install #PREFIX=/usr/local/redis can be omitted, if omitted, redis will be installed in the /usr/local/bin directory by default
Four configuration startup
1 Copy redis_init_script in the util directory of the startup script source code to the /etc/init.d/ directory
#It is said that background service habits Add a suffix d cp redis_init_script /etc/init.d/redisd
2 Copy the redis configuration file redis.conf in the decompression directory to /etc/redis/6379.conf (as required in the startup script, change the name 6379.config, you don’t need to change the name, change the conf attribute in the startup script)
#First build a content mkdir /etc/redis #Copy again, the file name is changed to 6379.conf after copying #Because there are the following two sentences in the startup script #REDISPORT=6379 #CONF="/etc/redis/${REDISPORT}.conf" cp redis.conf /etc/redis/6379.conf
After that, you can start and stop the redis service with service redisd start, service redisd stop
Five conf files Other configuration
daemonize yes #Ensure that the daemon is running in the background pidfile /usr/local/redis/redis.pid logfile /usr/local/redis/log dir /usr/local/redis/db
Six problems: noauth authentication required error when stopping the service
If redis has set a password, start the service, and then stop the service When, there will be noauth authentication required error
Modify the startup script /etc/init.d/redisd
EXEC=/usr/local/bin/redis-server CLIEXEC=/usr/local/bin/redis-cli PIDFILE=/var/run/redis_6379.pid CONF="/etc/redis/redis.conf" REDISPORT="6379" #Write the redis password here or PASSWORD="your password" PASSWORD=$(cat $CONF|grep ‘^\s*requirepass‘|awk ‘{print $2}‘|sed ‘s/"//g‘) if [-z $PASSWORD] then $CLIEXEC -p $REDISPORT shutdown else #This line added -a $PASSWORD $CLIEXEC -a $PASSWORD -p $REDISPORT shutdown fi #$CLIEXEC -a $PASSWORD -p $REDISPORT shutdown
make PREFIX=/usr/local/redis install #PREFIX=/usr/local/redis can be omitted, if omitted, redis will be installed in the /usr/local/bin directory by default
#It is said that the background service is used to add a suffix d cp redis_init_script /etc/init.d/redisd
#Create a directory first mkdir /etc/redis #Copy again, the file name is changed to 6379.conf after copying #Because there are the following two sentences in the startup script #REDISPORT=6379 #CONF="/etc/redis/${REDISPORT}.conf" cp redis.conf /etc/redis/6379.conf
daemonize yes #Ensure that the daemon is on and running in the background pidfile /usr/local/redis/redis.pid logfile /usr/local/redis/log dir /usr/local/redis/db
EXEC=/usr/local/bin/redis-server CLIEXEC=/usr/local/bin/redis-cli PIDFILE=/var/run/redis_6379.pid CONF="/etc/redis/redis.conf" REDISPORT="6379" #Write the redis password here or PASSWORD="your password" PASSWORD=$(cat $CONF|grep ‘^\s*requirepass‘|awk ‘{print $2}‘|sed ‘s/"//g‘) if [-z $PASSWORD] then $CLIEXEC -p $REDISPORT shutdown else #This line added -a $PASSWORD $CLIEXEC -a $PASSWORD -p $REDISPORT shutdown fi #$CLIEXEC -a $PASSWORD -p $REDISPORT shutdown