Install Redis under Linux and configure

Source: Internet
Author: User
Tags install redis

The Redis official web site gives the installation steps here to summarize.

1, Download, extract and compile Redis with:

wget http://download.redis.io/releases/redis-3.2.9.tar.gztar xzf redis-3.2. 9 . TAR.GZCD Redis-3.2. 9  Make

2. Configure and start Redis.

# Backup Redis configuration file CP redis.conf Redis.conf.bak

a> Configuration Reids is a background-resident program. Open redis.conf, find daemonize, and you can see that Reids is not a background-resident by default.

default  as ' Yes ' if   in/var/run/Redis.pid when Daemonized.daemonize no
# Fix to :
Daemonize Yes

b> Configure the Redis log file path.

Stringif for logging but daemonize, logs would be sent to/dev/null  ""
# change to the following, meaning to place the log file in the Redis Setup logs/redis.log (to create a directory structure and give read and write permissions)
LogFile "Logs/redis.log"

c> Configuring Redis remote connections

Temporarily Not Configured

d> Creating a Redis user

-r-g redis-s/bin/false Redis

e> Modify the Redis directory owner to Redis:redis

Chown-r Redis:redis./

f> Starting Redis

start Redis prohibit use ROOT to start!!! -U redis src/redis-server/usr/local/redis-3.2. 9/redis.conf# redis Client connection command Redis127.0. 0.1 6379 -a password

#

g> Turn off Redis

src/redis--ANP | grep redistcp         0      0 127.0. 0.1:6379          0.0.  0.0:*               LISTEN      1132/src/redis--91132

Problems you may encounter:

1, in the execution src/redis-cli SHUTDOWN times wrong: "(Error) ERR Errors trying to SHUTDOWN. Check logs. ". Log (the log path configured above) is as follows:

# User requested shutdown ... * Saving the final RDB snapshot before exiting.# Failed opening the RDB file Dump.rdb ( in server root di r/usr/local/redis-3.2. 9  for saving:permission denied# Error trying to save the DB, can ' t exit.

Workaround:

You should check your redis.conf file to see the permissionsinchDir and Dbfilename.
If the file namedinchThe dbfilename which isLocatedinchThe path specifiedinchThe
Dir path exists and the permission isalso right. Then the problem should befixed. Hope Thiswould help someone. P.s.to Find the redis.conf file location, your can use the #ps ax| grep Redis to check.
Usually it'll be passed to the Redis-server asinput file. For the dir permissions:it should be755, forThe dbfilename, it should be644sometimes also need to use top command to check whether the User:group of
The Redis-server and the owner of Dir are consistent.
i.e. the Redis-server isRunning by Redis:redis, but the Dir isUnder Root:root.
Inch This CaseNeed to Chown redis:redis-r dir.

Install Redis under Linux and configure

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.