After creting a new Redis client, is there a way to check the status of the connection?
As a way to ensure that the Sentinel is in a healthy state, a status check after instantiation would be ideal.
After creting a new Redis client, is there a way to check the status of the connection?
As a way to ensure that the Sentinel is in a healthy state, a status check after instantiation would be ideal.
4
Answers
I think it depends on the client you use.
For example, the radix client (https://github.com/mediocregopher/radix) support a function to monitor for checking the connection (error, reused, created and so on.)
Some client libraries offer a
Ping()
method that executes Redis’PING
command to check the status of the connection:If you use go-redis client for connecting to redis then you can try the following to check if redis is connected properly.