I am trying to setup a google TCP internal Load Balancer. Instance group behind this lb consists of redis-server processes listening on port 6379. Out of these redis instances, only one of them is master.
Problem: Add a TCP health check to detect the redis master and make lb divert all traffic to redis master only.
Added a TCP Health Check for the port 6379.
In order to send the command
role to redis-server process and parse the response, I am using the optional params provided in the health check. Please check the screenshot here.
Result: Health check is failing for all. If I remove the optional request/response params, health check starts passing for all.
- Connected to lb using netcat and issued the command
role, it sends the response starting with
*3(for master) and
*5(for slave) as expected.
- Logged into instance and stopped redis-server process. Started listening on port 6379 using
nc -l -p 6379to check what exactly is being received at the instance's side in the health check. It does receive
- After step 2, restarted redis-server and ran
MONITORcommand in redis-cli, to watch log of commands received by this process. Here there is no log of
role. This means, instance is receiving the data(
role\r\n) over tcp but is not received by the process redis-cli(as per
MONITORcommand) or something else is happening. Please help.