Memcached solves the fault of a single server.

Source: Internet
Author: User

Memcached solves the fault of a single server.

<Beitmemcached> <add key = "name1" value = "server1: port"/> <add key = "name2" value = "server1: port, server2: port, server3: port "/> </beitmemcached>

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

 

Problem:

If this memecache server fails to be configured on a single server, the cache node on the client side will not be used, affecting program running.

When multiple configurations are used, if one of them fails, When you store the data in the cache, the client will use the consistent hash algorithm to select which cache server to store based on the cached key value, if you are not lucky, you are saved to the faulty server. Sorry, writing fails.

 

Solution:

Use multiple configuration schemes to modify the client source code. If one of the servers fails, remove the problematic cache server from the client set when the cache operation fails, such as A, B, C Three memcache services. If B crashes, there will be exceptions when operating the cache. In this case, B will be removed from the sequence and only A and C will be used for the Operation;

Set a detection interval. During each cache operation, the faulty server will be detected after the interval. If the server returns to normal, it will be readded to the Cache Server collection.

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

Other solutions:

You can use memagent to configure a cluster for memcache. However, I feel that each server has to install a software. various configurations are troublesome. My method is simple and I feel very practical.

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.