Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

On the documentation, they advice the monitor command. But it has a 50% performance penalty for the whole system, and how should I do that ? Whatching the ouput using SSH until I don't see anything ?

Let's say I have 3 servers: 1 with a redis master, 1 with a redis slave, and one with my website querying the redis master.

How can I, from my website server, make cleany the decision to fallback to the slave by sending the SLAVEOF NO ONE command ?

My first step would be to put some kind of timeout check with a simple ping, just to be sure the server is online. But for redis specifically, I have no clue.

share|improve this question
    
Are you using the production builds, or would a release candidate be acceptable? Sentinel addresses these problems very well, but won't be stable for a while. –  Tim Post Oct 3 '12 at 23:53
    
I'll try with the stable realease for now please. –  e-satis Oct 4 '12 at 6:51

1 Answer 1

You could connect from the checking node using the redis API and send the redis command called "ping".

That would tell you if it is responding. However you would also want to be sure you are talking to a master, so I would recommend runnig the info command to get that information. If they both fail then the node is offline.

However, I would also advise you don't always assume the same node is master on every connection attempt. By using info from both you can be more sure of talking to the master when you want to.

Part of this means being prepared for a see-saw of who is up and who is not.

Or, depending on your usage you could consider twemproxy by the fine folks at twitter. Or a software load balancer such as balance.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.