Get the App
SLTechnology News&Howtos  ›  Development  › 

How to set redis to enable self-startup on Linux

Shulou Source: shulou.com Published: 2022-06-01 00:37:50 09月26日 Update

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!

Tags: Services learning status commands files more help practical successful and then not only content notes location articles methods methods theories directories knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi MariaDB Shulou Information Redmi Shulou Tech Info