Check if Redis is running on Linux.
Two methods can be used to check if Redis has started.
- To check if Redis is running, open the terminal and enter the following command.
redis-cli ping
If Redis is running, it will return “pong”; if Redis is not running, it will return “Could not connect to Redis at 127.0.0.1:6379: Connection refused”.
- To utilize system service commands: type the following command in the terminal to verify if the Redis service is running.
For systems using Systemd (like Ubuntu 16.04+):
sudo systemctl is-active redis
If Redis is running, it will return “active”; if Redis is not running, it will return “inactive”.
For SysVinit systems (such as Ubuntu 14.04 and earlier versions):
sudo service redis status
If Redis is running, it will return “redis-server is running”; if Redis is not running, it will return “redis-server is not running”.