Install redis in centos

Source: Internet
Author: User
Tags install redis

View the current path first

# pwd
Here I am/root and go to the official redis website to find the latest redis tar package. Then I can start the operation.
# wget http://download.redis.io/releases/redis-2.8.13.tar.gz# tar zxf redis-2.8.13.tar.gz# cd redis-2.8.13# make# cd src# ll

Check whether there are any newly generated files in the src directory:

Six executable files are generated in this directory. The next job is to put part of the redis-2.8.13 directory 1.1 point to the corresponding installation directory of redis. Here I am creating the redis directory under/usr/local /.
# mkdir /usr/local/redis# mkdir /usr/local/redis/bin /usr/local/redis/conf /usr/local/redis/run# ll /usr/local/redis/

Create the preceding three directories, they are used to store executable files, configuration files, redis process files, and then copy the six executable files under the src directory to the/usr/local redis/bin/directory.
# cp redis-cli redis-check-dump redis-server redis-check-aof redis-benchmark redis-sentinel /usr/local/redis/bin 

Copy the redis configuration file redis. conf In the src directory at the same level to/usr/local/redis/CONF.

# cp  ../redis.conf /usr/local/redis/conf

Switch to the/usr/local/redis/conf directory and start configuring redis.

# cd /usr/local/redis/conf# vim redis.conf
By default, we only need to modify a few places to run redis.
1. Modify daemonizeChange daemonize to "yes", which is "no" by default, so that our redis can run in the background by using daemonize. 2. Modify pidfileChange the path to "/usr/local/redis/run/redis. PID. The default path is/var/run/redis. PID ", this can be changed or not, in fact, it doesn't matter, it is completely a matter of personal habits. There is actually only one process number in this file, which must be used after redis enables the daemon running mode. We usually need redis to run in the background as a daemon. 3. Add a log logfileSet the Log Path and file name to logfile/data/logs/redis. log. The default value is null. Make sure that all The directory must exist.Otherwise, it will fail to start redis using the current configuration. 4. Modify the working path Dir of redisDIR/data/redis/6379, which is set to the current path "./" by default. First, let's take a look at what is stored in this directory. Dump. RDB is the default name of the locally stored database. Therefore, we should modify this option, because by default, when multiple ports are enabled at the same time (for example, 6379, 6380, and 6381 ), we certainly do not want databases on other ports to overwrite our databases. Therefore, we should set this option as detailed as possible from the perspective of data security. Like the considerations in Section 3, we should also note that the "/data/redis/6379" directory exists.
Save the modification. Then start redis:
# /usr/local/redis/bin/redis-server /usr/loca/redis/conf/redis.conf

Check whether redis is started:

# telnet 127.0.0.1 6379

OK!
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.