プラットフォーム: spymemcached-2.7.3.jar、64 ビット Windows 7 OS
2 つの membase サーバー (非クラスター環境) があり、memcache からデータを設定および取得するために spymemcached Java クライアントを使用しています。2 つの membase サーバー間でレプリケーションを使用していません。
次のコードを使用して memcache にデータを設定しています。MemcachedClient のように見えますが、利用可能な場合は、最初に server1 にデータを配置/取得しようとします。server1 がダウンしている場合、MemcachedClient は server2 から put/get します。spymemcached はハッシュアルゴリズムを使用して、データを設定/取得する必要があるサーバーを決定しますか? それがどのように機能するかを説明する利用可能なドキュメントはありますか?
コード
public class Main {
public static void main(String[] args) throws IOException, URISyntaxException {
MemcachedClient client;
URI server1 = new URI("http://192.168.100.111:8091/pools");
URI server2 = new URI("http://127.0.0.1:8091/pools");
ArrayList<URI> serverList = new ArrayList<URI>();
serverList.add(server1);
serverList.add(server2);
client = new MemcachedClient(serverList, "default", "");
client.set("spoon", 50, "Hello World!");
client.shutdown(10, TimeUnit.SECONDS);
System.exit(0);
}
}