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 set redis to enable self-startup on Linux

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces "how to set redis on Linux". In daily operation, I believe that many people have doubts about how to set redis on Linux. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubt of "how to set redis on Linux". Next, please follow the editor to study!

Self-booting of redis in centos7

Create a redis.service file in the system service directory

Vi / etc/systemd/system/redis.service

Write the following:

[Unit]

Description=redis-server

After=network.target

[Service]

Type=forking

ExecStart=/usr/local/redis/bin/redis-server / usr/local/redis/bin/redis.conf (fill in the path where your redis configuration file is located)

PrivateTmp=true

[Install]

WantedBy=multi-user.target

Test and add self-boot

Shut down redis-server first

Systemctl stop redis.service

Turn on redis-server

Systemctl start redis.service # if the service is on, using this command will fail to start.

Successfully start the service and add the service to boot

Systemctl enable redis.service # be careful not to be followed by spaces

Reboot # restart

View service running status: systemctl status redis.service

All commands

Systemctl start redis.service # start the redis service

Systemctl enable redis.service # set Boot self-boot

Systemctl disable redis.service # stop booting self-starting

Systemctl status redis.service # View the current status of the service

Systemctl restart redis.service # restart the service

Systemctl list-units-type=service # View all started services

Note: the above method applies not only to redis, but also to other service deployments.

At this point, the study on "how to set redis on Linux to start self-startup" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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

Development

Wechat

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

12
Report