miah/chef-redis — pull request #46 by mbbernstein (2013-06-02 01:44:59+00:00)
Title: Auto discovering the actual master

Hi all,

**I've implemented this solution for auto discovering the actual master of a cluster, and setting the others as slaves of this master.**

You have to set the attribute `redis_cluster_name` with the same name for all the nodes.

The solution is simple:
1. Check if the node has the attribute `redis_cluster_name`.
2. Search for other nodes with the attribute `redis_cluster_name`
3. If any, connect to the host found with redis-cli and found the master.
4. Configure this host as slave of the master.
5. If no node is found, this node will be the master (first node).

The same thing was done for sentinel

I did a lot of testing, but it would be nice if you did too.

Thanks,
Michael