Ubuntu 16.04 set up Redis for boot auto start service

Source: Internet
Author: User

Following previous article http://www.cnblogs.com/EasonJim/p/7599941.html after installing Redis, assume that the file is already installed in the/usr/local/redis directory. Let's say I installed a version of redis-4.0.2.

1. Configure Service Scripts

There is a redis_init_script file under Redis-4.0.2/utils, this is Sysvinit's service script.

sudo cp UTILS/REDIS_INIT_SCRIPT/ETC/INIT.D/REDISD

As the system boot service name (ending in D is the self-starting service, it is customary).

Open the startup directory for file modification files

sudo VIM/ETC/INIT.D/REDISD
redisport=6379EXEC=/usr/local/redis/bin/redis-servercliexec=/usr/local/redis /bin/redis-clipidfile=/var/run/redis_${redisport}. pidconf= "/etc/redis/${redisport}.conf"

2. Configuration files

In the source root directory has a redis.conf configuration file, copy and modify the name, note that the name and the above/etc/redis/${redisport}.conf configuration corresponds.

mkdir /etc/redissudo cp redis. conf/etc/redis/6379.conf

Open the file to modify the contents as follows:

# Set the background to run  daemonize Yes#/var/log/redis/redis-server. Log   # Set Persistent file storage path dir

Note: Several of the above directories are not available and need to be created after the folder

mkdir /var/log/mkdir /var/lib/redis

3. Using UPDATE-RC.D Registration Service

#+x/etc/init.d/REDISD# Registration service sudo update-rc. D/ETD/INIT.D/REDISD defaults

4, the service commonly used commands

#start  # shutdown Service sudo service REDISD stop  # Restart services: sudo service REDISD restart  

5. Troubleshooting

The services set above do not necessarily start normally, you can usually run with/ETC/INIT.D/REDISD start and then go inside the/var/log/redis/directory to see the log to troubleshoot errors, which is the path to the service script settings.

Reference:

http://blog.csdn.net/softwave/article/details/53838194

Ubuntu 16.04 set up Redis for boot auto start service

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.