Memcached troubleshoot a single server failure problem

Source: Internet
Author: User
Tags memcached

< beitmemcached >    <  key= "name1"  value= "Server1:port"/>    < Key = "name2"  value= "Server1:port,server2:port,server3:   Port "/></beitmemcached>

The client I use is beitmemcached, the configuration file can be in two ways, such as the above code, with a single configuration and multiple configurations

Problem:

When using a single server configuration, if this Memecache server hangs, then the client side of the cache node can not be used, affecting the operation of the program

When using multiple configurations, if one of them hangs up and you cache, the client will choose which cache server to store in accordance with your cached key value, and if you have bad luck, just save it to the problematic server, sorry, the write failed.

Solution:

Use more than one configuration scheme, modify the client source code, if one of the server hangs, when the cache operation fails, the problematic cache server to reject the client collection, such as the A,b,c three memcache services, if B hangs, in the operation of the cache, there will be an exception, This time the B is removed from the sequence, using only a,c to operate;

Set a detection interval, and each time the cache is manipulated, the problematic server is detected after the interval, and if the server returns to normal, it is re-added to the cache server collection.

How to use:

 Public memcachedclient getclient ()        {            var mc = memcachedclient.getinstance ("name2"true);             return MC;        }

Just add a true parameter when you get the client instance.

: Http://pan.baidu.com/s/1eQtOO6Y

Other solutions:

Can use Memagent to configure the Memcache cluster, but I feel that each server to install a software, a variety of configuration is more troublesome, my method is relatively simple, I feel is very practical.

Memcached troubleshoot a single server failure problem

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.