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

Redis detailed steps for customizing the systemctl Management Service

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

Share

Shulou(Shulou.com)06/01 Report--

Today, the editor shares with you the detailed steps of redis custom systemctl management service, which many people don't know very well. Today, in order to let you know more, the editor summarizes the following contents. Let's look down together. I'm sure you'll get something.

1. Preparatory work

Compile and install redis (my installation directory / usr/loacl/tool)

Move redis-server and redis-cli to the environment variables directory (/ usr/loacl/bin); give execute permission

Cp redis.conf to the configuration directory (/ etc/redis/redis.conf) or make a soft connection; (I choose the former)

Note: for corresponding directories and permissions, see other requirements

two。 Create a systemctl service

When you use service to manage a service, you create a script file in the / etc/init.d/ directory to manage the start and stop of the service. Similarly, in systemctl, the file directory is different. Create a script file redis.service in the / lib/systemd/system directory, which contains the following contents:

[Unit] Description=RedisAfter= network.target [service] Type=forkingExecStart=/usr/local/bin/redis-server / etc/redis/redis.confExecReload=/usr/local/bin/redis-server-s reloadExecStop=/usr/local/bin/redis-server-s stopPrivateTmp= truth [install] WantedBy=multi-user.target

[Unit] indicates that this is basic information.

Description is the description

After starts after that service, usually after the network service starts.

[Service] indicates that this is the service information

ExecStart is the command to start the service

ExecReload is the instruction to restart the service

ExecStop is the order to stop the service

[Install] indicates that this is installation related information.

How does WantedBy start: multi-user.target indicates that this service needs to be run automatically when the system is started in multi-user mode (the default runlevel).

3. Refresh configuration

The systemctl just configured needs to be refreshed before it can take effect.

$systemctl daemon-reload

4. Set up power-on usage

Set the redis service to power on

$systemctl enable redis.service

The detailed steps of redis custom systemctl management service are shared here, of course, not only the above and everyone's analysis methods, but the editor can ensure its accuracy is absolutely no problem. I hope that the above content can have a certain reference value for everyone, and can be put into practice. If you like this article, you might as well share it for more people to see.

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