Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to add systemctl Services to redis

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces redis how to add systemctl services, the article is very detailed, has a certain reference value, interested friends must read it!

First, install redis

First, we need to download the latest version of redis from the official website.

$wget http://download.redis.io/releases/redis-4.0.11.tar.gz$ tar xzf redis-4.0.11.tar.gz$ mv redis-4.0.11 redis / / change your name $cd redis$ make

Then select the installation path

After loading, create a / etc directory and put the configuration file in it.

$mkdir etc$ mv redis.conf etc/redis.conf

Then modify the configuration file

$cd etc$ vi redis.conf

Finally, the option to change daemonize no to daemonize yes means that redis runs in the background.

Redis has been successfully installed. Test it.

/ usr/local/redis/src/redis-server / usr/local/redis/etc/redis.conf

Second, join the service

Vi / lib/systemd/system/redis.service $vi / lib/systemd/system/redis.service

Add the following

[Unit] Description=redisAfter= network.target [service] Type=forkingPIDFile=/var/run/redis_6379.pid / pay attention to ExecStart=/usr/local/redis/src/redis-server / usr/local/redis/etc/redis.conf / / pay attention to ExecReload=/bin/kill-s HUP $MAINPIDExecStop=/bin/kill-s QUIT $MAINPIDPrivateTmp= true [install] WantedBy=multi-user.target

The path in the warning section is replaced with your own installation path, and the pid path is consistent with the path in redis.conf.

Save and exit

$systemctl enable redis.service / / join boot boot $systemctl start redis / / enable redis service $systemctl status redis / / check the running status of redis

Uninstall redis:

/ / Delete the installation directory / / remove all redis-related command scripts / / remove the redis decompression folder above is all the contents of the article "how to add systemctl Services by redis". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report