CENTOS7 Installation Configuration Redis

Source: Internet
Author: User
Tags redis version
The first step: Download the Redis installation package

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

To download which version can copy the above link delete redis-* part of the content, you can view all the Redis version of the installation package
Step Two: Unpack the installation package

TAR-ZXVF redis-4.0.9.tar.gz-c/usr/local/

Unzip the compressed package to the specified directory

Step three: Install GCC dependencies

First through gcc-v whether there is GCC installed, if not installed, execute command sudo yum install-y gcc

Fourth step: CD to Redis decompression directory, and execute

cd/usr/local/redis-4.0.9/here the catalogue is adjusted according to the downloaded Redis version and decompression path

Fifth Step: Compile the installation

Make MALLOC=LIBC

Add the files in the/USR/LOCAL/REDIS-4.0.9/SRC directory to the/usr/local/bin directory

CD src && make install

Sixth step: test whether the installation was successful

cd/usr/local/redis-4.0.9/src/

./redis-server


If the above information is displayed, the installation is successful, CTRL + C closes the window

Seventh Step: Configure Redis

Start the process in a later way:

1. Modify/usr/local/redis-4.0.9/redis.conf:daemonize No to change the value to Yes save exit

2. Specify redis.conf file startup:./redis-server/usr/local/redis-4.0.6/redis.conf

To set the Redis remote connection:

1. Because the Redis default allows local connections, we will change bind 127.0.0.1 to bind 0.0.0.0 in redis.conf or comment on the line

2. In addition, Aliyun ECS has a security group that finds and adds rules to allow 6379-port access

To set the Redis connection password:

Search the Requirepass line in redis.conf and add the configuration at the appropriate location

Requirepass YourPassword

Perform/usr/local/bin/redis-server/usr/local/redis-4.0.6/redis.conf update configuration after Setup completes

Eighth step: Set up startup

As the above we performed the Redis process started through the Ps-aux | grep Redis View Redis process and kill with kill-9 process ID


1, in the/ETC directory under the new Redis directory

Mkdir/etc/redis

2, copy the/usr/local/redis-4.0.9/redis.conf file to the/etc/redis directory, and named 6379.conf

Cp/usr/local/redis-4.0.9/redis.conf/etc/redis/6379.conf

3, the Redis of the launch of a copy of the script into the/ETC/INIT.D directory

Cp/usr/local/redis-4.0.9/utils/redis_init_script/etc/init.d/redisd

4, set the Redis boot from start

First switch to the/ETC/INIT.D directory

Then execute the self-command chkconfig REDISD on

If the service REDISD does not support Chkconfig solution is displayed:

Using Vim to edit the REDISD file, add the following two lines of comments to the first line and save the exit

# chkconfig:2345 90 10

# Description:redis is a persistent key-value database

Annotation means that the Redis service must be started or closed under Run level 2,3,4,5, the priority of the boot is 90, and the priority of the shutdown is 10.

Perform the power-on self command again chkconfig REDISD on, this time should be able to succeed

It is now possible to start and close the Redis directly in the form of service

Start: Service REDISD start

OFF: Service REDISD stop

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.