问题
The standard and premium pricing tiers of Azure Redis Cache provide master/slave replication:
Standard—A replicated cache in a two-node primary/secondary configuration managed by Microsoft, with a high-availability SLA.
But the Azure portal provides connection details (hostname, port, key) for only a single redis instance. Is there a way to connect to connect to the slave process in a replica?
回答1:
Since the Azure Redis service manages replication and automatic failover on your behalf, it is useful not to make any assumptions about which node is Master as that could change on a failover. Hence the service exposes only one endpoint and ensures that any requests to that endpoint hit the correct Master. It is technically possible to connect to Master or Slave, but Azure doesn't expose it and it requires checks on the client side to ensure that the node is indeed Master or Slave.
If you turn on clustering, the Redis cluster protocol is used. Under this protocol, you can run a cluster nodes command and it should return get a list of Master and slave nodes and the ports that each of these are listening on.
回答2:
The Redis service manages replication and failover, for high availability. This is not something exposed to you. That is, you cannot connect directly to the slave/secondary.
来源:https://stackoverflow.com/questions/46952010/how-to-connect-to-slave-instance-of-an-azure-redis-cache