CentOS Installation Redis

Source: Internet
Author: User
Tags redis download

1 go to redis download website

https://redis.io/downloadcan see how to download

2 Download Reids installation package

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

3 Unpacking the ZIP package

tar xzf redis-4.0.11.tar.gz

4 Installing GCC dependencies

yum install gcc

5 Jump to Redis unzip directory

cd redis-4.0.11

6 Performing the installation

make
make install

7 Start

redis-server

8 starting Redis by initializing scripts

The

has an initialization script file named Redis_init_script in the Utils folder in the Redis source directory. You need to configure how Redis is run and persisted, where the log files are stored
First copy the initialization script to the/ETC/INIT.D directory, the file name is the Redis_ port number, where the port number indicates the port number that you want Redis to listen to, and the client connects to the Redis
1. Create a folder/etc/redis (a Redis profile);/var/redis/port number (persistent file for Redis)
2. Modify the configuration file first the profile template (redis-4.0.2/ redis.conf) to the/etc/redis directory, named after the port number (such as "6379.conf"), and then edit some of the parameters in the following table.

parameters description
daemonize yes
pidfile /var/run/redis_ port number. PID set the PID file location for Redis
port port number set up Redis snooping Port number
dir /var/ redis/Port number

3. Now use the following command to start and close Redis
/etc/init.d/redis_6379 start
/etc/init.d/redis_6379 stop
4. Let Redis start automatically with the system, which also requires a simple modification of the Redis initialization script to execute the command:
vim /etc/init.d/redis_6379
5. Open the Redis initialization script file at the head of the fourth line, append the following two sentences
# chkconfig: 2345 90 10
# description: Redis is a persistent key-value database
6. After the addition is complete, you can add Redis to the system startup by following the commands below.
chkconfig redis_6379 on
7. After the above operation, you can also use the following command to start and close Redis directly, as follows
service redis_6379 start
service redis_6379 stop
After the above deployment operation, the system restarts, Redis will automatically start with the system, and the above steps are also configured for Redis persistence, the next time you start the system or Redis, there is no loss of cached data benefits.

9 Stop Redis

redis-cli SHUTDOWN

CentOS Installation Redis

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.