A little doubt on membaseclient
Thanks a lot for your response.
It really helped me.
I have a little doubt on membase client.
If i have 2 servers in a cluster (server-1 and server-2)
My client code is that is written in java:
URI server = new URI("http://192.168.100.54:8091/pools");
URI server1 = new URI("http://192.168.100.145:8091/pools");
ArrayList serverList = new ArrayList();
serverList.add(server);
serverList.add(server1);
client =new MemcachedClient(serverList, "default", "");
Now if server-1(http://192.168.100.54:8091/pools) goes down ..
Do i need to change the code of client then ?
Do i need to remove the http://192.168.100.54:8091/pools from serverList in above code ?
Thanks in advance,
Nik
Thanks for your response mike.
Currently what i am facing
If there are server-1 and server -2.
I have a bucket call test which is a type of memcache bucket.
I put an object which resides on server-1.
scenario-1
============
Then if server-1 fails over and server-2 is up. Then client is giving error and code breaks of memcacheclient.
scenario-2
============
Then if server-2 fails over and server-1 is up. Then client works.
That means if a key is residing on a server -1 and that is up then client does not give any error
but if server-1 fails over then client code breaks.
Can you please give me your suggestion if I am doing any thing wrong in client code or what?
Regards,
Nik
Let me explain how failover works in Membase and it should help you with this issue.
When a server goes down it is marked as down in the Membase web UI. When a server is down all items on that server are unaccessible so this means that when your client try's to get them from Membase it will result in an error. If you look in the web ui there is a button that says failover next to the down server. Clicking this button will cause the replica items on another server (server-2 your case) to become active. This will allow the client to be able to properly service requests again. The last thing you need to do is click the rebalance button in order to get make sure data is redistributed across your cluster.
If you have done what I have described and are still having issue let me know and I will have someone try to reproduce this issue.
Mike,
I have done fail over and re balance both.
If I put an object which resides on server-1.
Then if server-1 fails over and server-2 is up. Then client is giving error and code breaks of memcacheclient
Even after fail over and rebalanced it gives me error.
THanks
You don't need to change any client code if a server goes down with the code you have. When you give the client a list of addresses it takes the first one from the lists and connects to the server to get cluster information. Included in this cluster information is a list of servers that are part of the cluster so even if you had more than 2 servers the client would be able to connect to all of them. When things change in the server your client will rely on getting information about the cluster from the first server in the list. If for some reason that first server goes down then the client will start moving through the list of URI's to see if one of those servers is active and will then begin receiving cluster information from that server. The only way this process can fail is if no servers in the list are part of the cluster any more.