Installation Configuration guide for Redis databases in CentOS systems _redis

Source: Internet
Author: User
Tags redis

1, check the installation of dependent programs

Yum install gcc-c++
yum install-y tcl Yum install

2. Get installation files

wget http://download.redis.io/releases/redis-2.8.13.tar.gz

3, Extract files

TAR-XZVF redis-2.8.19.tar.gz
MV Redis-2.8.19/usr/local/redis

4, enter the catalogue

Cd/usr/local/redis

5. Compile and install

Make make
Install

6, set the configuration file path

Mkdir-p/etc/redis
CP Redis.conf/etc/redis

7, modify the configuration file

Vi/etc/redis/redis.conf

Modify only:

Daemonize Yes (No-->yes)

8, start

/usr/local/bin/redis-server/etc/redis/redis.conf

9. View Startup

Ps-ef | grep Redis 

10, using the client

REDIS-CLI
>set name David
OK
>get name
"David"

11. Close the Client

REDIS-CLI shutdown

12, Boot Configuration

echo "/usr/local/bin/redis-server/etc/redis/redis.conf &" >>/etc/rc.local

PS: Let Redis run in service mode
The following is an action step to configure Redis as a service, first copying the Utils/redis_init_script file to the/ETC/INIT.D

Cp/usr/local/redis-2.8.19/utils/redis_init_script/etc/rc.d/init.d/redis 

Copy Redis_init_script to/etc/rc.d/init.d/and easily named Redis
And then

Vi/etc/rc.d/init.d/redis 

In the second line of the document, add

# chkconfig:2345 80 90 

Then notice

Exec=/usr/local/redis/bin/redis-server  
CLIEXEC=/USR/LOCAL/REDIS/BIN/REDIS-CLI  

Since our installation directory is/usr/local/redis-2.8.19, the above two lines are changed to

Exec=/usr/local/redis-2.8.19/src/redis-server  
CLIEXEC=/USR/LOCAL/REDIS-2.8.9/SRC/REDIS-CLI  

Also pay attention to the Redis file's

$EXEC $CONF 

Increase & in the back of Conf

$EXEC $CONF & 

"&", that is, to move the service to the back of the meaning, otherwise start the service, the Redis service will occupy the front, occupy the main user interface, resulting in other commands do not execute.
You can see this line in the/etc/init.d/redis file:

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.19/redis.conf/etc/redis/6379.conf  

Once you have completed the above, you can register the service:

Chkconfig--add Redis  

and start the Redis service.

Service Redis Start  

Redis can be run by service mode.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.