Retrieve data from 2 memcached instances from different instances

52 views
Skip to first unread message

Deep Parekh

unread,
Jan 27, 2013, 8:50:24 AM1/27/13
to spymem...@googlegroups.com
Hi,
   I had created two memcached instances in two different servers. I am storing data in one server through spymemcached using :
client = new MemcachedClient(new InetSocketAddress("127.0.0.1",11211));
.
.
.
public Future<Boolean> addToMemCache(String key, int timeOut, Object val) {
        Future<Boolean> future = client.set(key, timeOut, val);
        return future;
    }
.
.
.
.
Then I am trying to retrieve that data from another memcached which is in another physical server using....

client = new MemcachedClient(new InetSocketAddress("IP of that pc",11211));

and then
.
.
.
public Object getMemcachedValue(String key) {
        return client.get(key);
    }


But I am getting error in retrieving the data.
Please help me how can I get the data?


Thank YOu.

Mike Wiederhold

unread,
Jan 28, 2013, 3:38:31 PM1/28/13
to spymem...@googlegroups.com
Are you expecting that memcached is replicating your data between both servers? I ask because memcached doesn't support doing that. If you put the data into one server you can't expect it to be there on the other one. Please let me know if I misunderstood the question.
Message has been deleted

Deep Parekh

unread,
Jan 29, 2013, 6:07:01 AM1/29/13
to spymem...@googlegroups.com
I want to replicate some data in two memcached instances manually. I know memcached is distributed in nature and by its nature it doesn't support doing this.. But for my project some data needs to be replicated in more then one memcached servers. Is it possible? if you can tell me how, I will be thankful. Thank You.

Mike Wiederhold

unread,
Jan 29, 2013, 2:15:54 PM1/29/13
to spymem...@googlegroups.com
You can take a look at repcache which is a data replication feature that you can add on top of memcached. Another option would be to use Couchbase. With Couchbase you also get added persistence for you data along with replication and failover options.

- Mike

Deep Parekh

unread,
Jan 31, 2013, 6:21:06 AM1/31/13
to spymem...@googlegroups.com
Thank You Very much.
Reply all
Reply to author
Forward
0 new messages