1. After downloading redis-2.8.9.tar.gz from the official website, the Redis is extracted under the/usr/local, the directory is redis-2.8.9, and then the method of Redis can be installed according to the official website.
2. Perform src/redis-server in the redis-2.8.9 directory after installation
Then execute the SRC/REDIS-CLI in another shell window to run correctly.
But we obviously want to start the operation as a service.
3. Here is the procedure to configure Redis as a service, first copy the Utils/redis_init_script file to/etc/init.d
Cp/usr/local/redis-2.8.9/utils/redis_init_script/etc/rc.d/init.d/redis
Copy Redis_init_script to/etc/rc.d/init.d/and easily name Redis
Then Vi/etc/rc.d/init.d/redis
Add in the second line of the document
# chkconfig:2345 80 90
Then notice
Exec=/usr/local/redis/bin/redis-server
Cliexec=/usr/local/redis/bin/redis-cli
Because our installation directory is/usr/local/redis-2.8.9, the above two lines are changed to
Exec=/usr/local/redis-2.8.9/src/redis-server
Cliexec=/usr/local/redis-2.8.9/src/redis-cli
Also pay attention to the Redis file's
$EXEC $CONF
Here, add & at the back of Conf
$EXEC $CONF &
"&", that is, to move the service back to the meaning of running, otherwise when the service is started, the Redis service will occupy the foreground, occupying the main user interface, resulting in other commands can not be executed.
4. You can see that in the/etc/init.d/redis file, there is a line:
conf= "/etc/redis/${redisport}.conf"
The Redis configuration file is then copied to the/etc/redis/
Mkdir/etc/redis
Cp/usr/local/redis-2.8.9/redis.conf/etc/redis/6379.conf
5. After completing the above operation, you can register the service:
Chkconfig--add Redis
Then start the Redis service
Service Redis Start
Redis can be run as service mode
Let Redis run as a service under centos6.x