In this tutorial we are going to see how to start, stop and restart the Redis service properly, which is pretty straightforward and simple to do so.
Service and server are used interchangeably.
Prerequisites
- Redis
Solution(s)
Linux
Step 1. Enable Redis service on reboot:
sudo systemctl enable redis-server
Step 2. Start Redis service:
sudo systemctl start redis-server
Step 3. Stop Redis service (the recommended way):
redis-cli shutdown
sudo systemctl stop redis-server
works too.
Step 4. Restart Redis service.
systemctl restart redis-server
macOS
macOS requires Redis server to be installed using the Homebrew package manager.
Step 1. Start Redis service:
brew services start redis
Step 2. Stop Redis service:
brew services stop redis
Step 3. Restart Redis service:
brew service restart redis
Windows
Step 1. Open Run by pressing the Windows key + R
.
Step 2. Type services.msc
and hit Enter.
Step 3. Search for the Redis service, right click it and do whatever you intend to.
Though the proper way to shutdown the Redis service on Windows is to open a terminal (CMD or PowerShell) and run the following command:
redis-cli.exe shutdown
Conclusion
To find more cool Redis commands and hacks, simply browse the Redis category. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.