简体   繁体   English

将数据从一个memcached服务器传输到另一个服务器

[英]Transfer data from one memcached server to another

Currently we are storing our user sessions in memcached, our web apps are running with PHP 5.3.6 and Apache 2.2.3. 目前我们将用户会话存储在memcached中,我们的Web应用程序运行PHP 5.3.6和Apache 2.2.3。

We will be replacing our memcached server, I am wondering if there is a way we can transfer the data from one memcached server to another so that the user sessions are still there. 我们将替换我们的memcached服务器,我想知道是否有一种方法可以将数据从一个memcached服务器传输到另一个服务器,以便用户会话仍在那里。 (To minimize downtime) (尽量减少停机时间)

Although I have read from the FAQ http://code.google.com/p/memcached/wiki/FAQ#How_can_you_dump_data_from_or_load_data_into_memcached ? 虽然我已阅读常见问题解答http://code.google.com/p/memcached/wiki/FAQ#How_can_you_dump_data_from_or_load_data_into_memcached that it is probably not possible to do that...but I am hoping if someone have some tools or workaround to achieve this. 它可能不可能这样做......但我希望有人有一些工具或解决方法来实现这一目标。

Thanks! 谢谢!

Best regards 最好的祝福

使用memcached-tool可以实现。

memcached-tool 10.1.2.30:11211 dump | nc 127.0.0.1 11211

Your best bet is to probably add some code into your system that, when a user visits, writes the session into both the new server and the old one, and then let them run in parallel for a while, then turn off the old server. 最好的办法是在系统中添加一些代码,当用户访问时,将会话写入新服务器和旧服务器,然后让它们并行运行一段时间,然后关闭旧服务器。 That way you can "warm up" the new server without actually depending on it, and then swap over once most of the sessions are moved over. 这样你可以“预热”新服务器而不实际依赖它,然后在大多数会话被移动后交换。

You'll still lose some sessions, but the most frequent visitors won't notice anything because their sessions will have been moved over. 您仍会丢失一些会话,但最常见的访问者不会注意到任何内容,因为他们的会话将被移动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM