Configuring vBuckets & Enyim Client
We have completed our first pass integration of Membase with a simple architecture where each application server has a small, stand-alone Membase instance to use for its objects. It's been great, but now we need to plan for the next step, which will require us to deal with 10x the data and introduce redundancy/fail-over.
So I have taken three machines and done a clean installation of 1.7.1.1. I have allocated 512 MB of RAM on each machine and joined all three into a cluster. I am trying to reproduce Dustin Sallings' demonstration configuration.
http://dustin.github.com/2010/06/29/memcached-vbuckets.html
servers = ['server1:11211', 'server2:11211', 'server3:11211']
vbuckets = [0, 0, 1, 1, 2, 2]
server_for_key(key) = servers[vbuckets[hash(key) % vbuckets.length]]
What Dustin does not share, however, is exactly how he configured these buckets on the cluster/nodes using the web console. Specifically, what kind of buckets do I create? Do they need to be on different ports? Do they need to have special names?
Can anyone help me out here? Even just a good document on the subject.
TIA
Tony
Best practice is to give it multiple URLs for the cluster, just in case there is a failure mode where a set of clients and the server go down.
I've not re-read the code recently, but I believe if it can 'bootstrap' off of one URL, it'll add all of the other nodes in the cluster to it's list of places from which to get cluster configuration updates. It's only if the client goes down that it'd need to look back to the configuration.
Again, I'd have to re-read the code, but I think that's the behavior.
In any event, it's a best practice to have multiple URIs in your config.
I'm glad you find the replication cool! We really tried to make it easy and compatible with existing Enyim.
In what may or may not be a related question, as I continue to try hacking through this, I am trying the following...
I created one, big "default" bucket and it appears from the bucket status that I have 1024 vBuckets auto-magically created for me with a bunch of replication going on. This is cool. I started plowing a bunch of 900KB objects in there and it seems to work in general.
I am now trying to re-work my client code. I am using the Enyim C# code. I was using the MemcachedClient, and I am now changing over to the MembaseClient. I have a configuration that looks like so:
private readonly MembaseClientConfiguration _config = new MembaseClientConfiguration(); _config.Urls.Add(new Uri("http://localhost:8091/pools/default")); _config.Urls.Add(new Uri("http://TEST1-WEB1:8091/pools/default")); _config.Urls.Add(new Uri("http://TEST1-DP1:8091/pools/default")); _config.KeyTransformer = new TigerHashKeyTransformer(); MembaseClient _membaseClient = new MembaseClient(_config);The interesting note is that, if I browse to one of those URLs, I get a JSON structure that tells me about all of the nodes in the entire cluster. So, this question is this: if I am using a cluster, when I configure the client, should I only be handing it one URL, or all URLs? If I only give it one URL, and that particular node of the cluster fails, is the client smart enough to try the others based on the configuration it received from the cluster?