When B goes down you have no failover memcache. That's OK, because you don't *need* it anyway - it's just a helper to take load off your database. If B fails your app goes directly to the database for its data until the cache server B is back up. When the server comes back up, it starts to build it's cache again from scratch.
<br><br>This is not high availability stuff here -- there's no redundancy or failover. But that's OK, because it's just an optimization layer - it isn't the database. As to the hashing, I think it just takes a checksum of the query and does a mod(memcache_server_count). That way the same query is cached on the same memcached every time.
<br><br>- Bash<br><br>-- <br><a href="http://bashcoder.com">http://bashcoder.com</a><br><br><div><span class="gmail_quote">On 10/31/06, <b class="gmail_sendername">howard chen</b> <<a href="mailto:howachen@gmail.com">howachen@gmail.com
</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">On 11/1/06, Andrew Pile <<a href="mailto:andrew@connectedventures.com">
andrew@connectedventures.com</a>> wrote:<br>> That is NOT how it works. The data is not stored evenly on all<br>> servers, it is hashed and sent to one server.<br>><br>> On Oct 31, 2006, at 11:26 AM, Jehiah Czebotar wrote:
<br>><br>> >> so, correct me if i am wrong...<br>> >><br>> >> 1. on each memcached server, i start the memcached deamon as they are<br>> >> separetely server, they don't know each other,
e.g.<br>> >> ./memcached -d -m 2048 -l <a href="http://10.0.0.40">10.0.0.40</a> -p 11211<br>> >><br>> >> 2. during connection from client, add all the servers...<br>> >> e.g.<br>> >>
<br>> >> $memcache = new Memcache;<br>> >> $memcache->addServer('memcache_host', 11211);<br>> >> $memcache->addServer('memcache_host2', 11211);<br>> >><br>> >> 3. the memcached objects will be stored evenly on all these server,
<br>> >> and i can get it using Memcache::get , without specifying the server<br>> >> host<br>> >><br>> ><br>> > correct: that is exactly it.<br>> ><br>> > (just make sure the memory you are configuring memcached to use (2048)
<br>> > is not larger than the actuall free RAM on your machines)<br>> ><br>> > --<br>> > Jehiah<br>><br>><br><br>yes, this is the point, how does hashing work?<br><br>e.g.<br><br>originally three servers, A, B, C
<br><br>an object is hashed to server B<br><br>but server B was downed, and it will hashed to server C when receive<br>another request ? what will happen if server B up again?<br></blockquote></div><br><br>