Redis database installation configuration under Linux system

Source: Internet
Author: User
Tags log log mkdir redis

1. Download and install

The code is as follows Copy Code
wget http://download.redis.io/redis-stable.tar.gz
Tar xvzf redis-stable.tar.gz
CD redis-stable
Make
Make Test
Make install (Administrator privileges, add sudo)

Redis-server and REDIS-CLI will automatically be placed in the/usr/local/bin/directory.

2, the better installation configuration mode

1) Create Redis folder

sudo mkdir/etc/redis

The code is as follows Copy Code
sudo mkdir/var/redis


2 Copy the startup script to the/ETC/INIT.D directory

The code is as follows Copy Code
sudo cp utils/redis_init_script/etc/init.d/redis_6379


3) Modify the startup script

Make sure that the Redis_port is the port you need to open, and that the subsequent PID files and configuration files will depend on it

The code is as follows Copy Code
sudo vim/etc/init.d/redis_6379


4 Create a Redis working directory

The code is as follows Copy Code
sudo mkdir/var/redis/6379


5 Copy the Redis configuration file to the/etc/redis directory and modify or confirm the parameters

The code is as follows Copy Code
sudo cp redis.conf/etc/redis/6379.conf
#设置daemonize为true
#设置pidfile为/var/run/redis_6379.pid
#设置loglevel
#设置logfile为/var/log/redis_6379.log
#设置dir为/var/redis/6379


6 Use the following command to set up a new init script

The code is as follows Copy Code
sudo update-rc.d redis_6379 defaults


Sudo:update-rc.d:command not found error may occur under CentOS, and you need to use Chkconfig instead

7) Start Redis

The code is as follows Copy Code
sudo/etc/init.d/redis_6379 start


8) Confirm whether OK

Use the REDIS-CLI Save command to dump the data into a file to see if there are any Dump.rdb files under/var/redis/6379/and log log redis_6379.log generated under/var/log.

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.