Part I Redis Installation (reprint section)
First, installation
wget http://download.redis.io/redis-stable.tar.gz
Tar xvzf redis-stable.tar.gz
CD redis-stable
Make
Second, installation frequently encountered problems
The first 3 steps should be no problem, the main problem is that when you execute make, an exception occurs.
Exception One:
MAKE[2]: Cc:command not found
Exception reason: GCC is not installed
Solution: Yum Install gcc-c++
Exception Two:
Zmalloc.h:51:31:error:jemalloc/jemalloc.h:no such file or directory
Exception reason: Some compiler dependencies or original compilation legacy problems
Solution: Make Distclean. Clean it up and make it again.
After make is successful, make test is required. An exception occurred in make test.
Exception One:
Couldn ' t execute "tclsh8.5": No such file or directory
Exception reason: Tcl not installed
Solution: Yum install-y tcl.
After make succeeds, there are some more executables in the SRC directory: Redis-server,redis-cli and so on.
During the convenient period, the CP command is copied to the USR directory for operation.
CP redis-server/usr/local/bin/
CP redis-cli/usr/local/bin/
Then create a new directory, store the configuration file
Mkdir/etc/redis
Mkdir/var/redis
Mkdir/var/redis/log
Mkdir/var/redis/run
mkdir/var/redis/6379
Locate the profile template in the Redis solution directory and copy it to the following location.
CP redis.conf/etc/redis/6379.conf
Modify with the VI command
Daemonize Yes
Pidfile/var/redis/run/redis_6379.pid
Logfile/var/redis/log/redis_6379.log
dir/var/redis/6379
Finally, run Redis:
$ redis-server /etc/redis/6379.conf
Part Ii. To set up a boot startup script using Redis startup scripts
The
recommends that you start the Redis service in a production environment using startup scripting. Startup script redis_init_script
located in the /in Redis utils/
directory.
#大致浏览下该启动脚本, it is found that Redis habitually uses the port name of the listener as the configuration file, and we follow this convention later. #redis服务器监听的端口REDISPORT=6379#服务端所处位置, which is stored by default with '/usr/local/bin/redis-server ' after make install ' If you do not install it, you need to modify the path. EXEC=/usr/local/bin/redis-server# client location cliexec=/usr/local/bin/redis- Modify section corresponds to Previous Pidfile=/var/redis/run/redis_${redisport}.pid#配置文件位置, need to modify conf=" /etc/redis/${redisport}.conf"
Configuring the Environment
1. According to the startup script requirements, copy the modified configuration file to the specified directory with the name of the port. Need to use root user.
MKDIR/ETC/REDISCP redis.conf/etc/redis/6379.conf
2. Copy the startup script to the/ETC/INIT.D directory, this example names the startup script REDISD (usually ending with D as the background self-starting service).
CP REDIS_INIT_SCRIPT/ETC/INIT.D/REDISD
3. Set to boot from boot
The direct configuration here is to turn on self-booting chkconfig redisd on
to report an error: service redisd does not support chkconfig
#!/bin/sh# chkconfig: 2345 # Add this sentence and comment out # Description: Redis is a persistent Key-value database#
Set it again to succeed.
#设置为开机自启动服务器chkconfig REDISD on# Open Service services REDISD start# shut down services service REDISD stop
Reference Blog Address:
Http://www.tuicool.com/articles/aQbQ3u
Http://www.cnblogs.com/haoxinyue/p/3620648.html
Linux (CentOS)--redis installation