Failover redis with Consul DNS

how does Consul resolve the new redis master ip address after the old redis master get takedown , i have set up consul and redis sentinel can u guide me through the setup , My expectation is when i do dig, the consul will resolve to only one IP address (master). When the master is down and redis sentinel selects the new master. The consul will resolve to new redis master IP address.

service {
name = “r-6379-redis-test”
tags = [“slave-test-6379”]
address = “”
port = 6379
check {
args = [“sh”, “-c”, “/etc/consul.d/shell_script/ 6379”]
interval = “10s”
} this is what i added on my consul.hcl file how do i go about this
and on my shell script #!/bin/bash

Replace with your actual Redis Sentinel info

SENTINEL_HOST=“” # IP address of Sentinel instance on Server 1
SENTINEL_PORT=“26379” # Sentinel port (default)

Query Redis Sentinel to check if the instance is master

REDIS_ROLE=$(redis-cli -h $SENTINEL_HOST -p $SENTINEL_PORT SENTINEL get-master-addr-by-name $MAS>

if [[ “$REDIS_ROLE” == “nil” ]]; then

Redis instance is not master, return non-zero exit code

exit 1

Redis instance is master, return zero exit code

exit 0