Ring AutoDiscovery

已查看 36 次
跳至第一个未读帖子

Russell Bradberry

未读,
2012年10月19日 12:27:512012/10/19
收件人 hel...@googlegroups.com
So I added a first pass at auto-discovery in a branch conveniently called "auto-discover".  Please have a look at the code, and be gentle as it is just a rough pass at the general idea.  The general idea is that you will first add to the connection options "autoDiscover: true" Then you can either add a "whitelist" or "blacklist" set of rules.  Please note that you still need to add "hosts" as these are going to be the seed nodes.  If no rules are added then the driver will connect to all available hosts.  Whitelist and blacklist rules are specified as an array of objects. Each object int he array specifies a datacenter, a list of racks and/or a list of hosts.  If a list of hosts is specified, datacenter and rack are ignored.  If a rack is specified a datacenter must be specified as well. If a datacenter is specified without racks or hosts, then the entire datacenter will match.

Here is an example of blacklisting a datacenter:

{  
  hosts:['10.10.10.10'],  
  keyspace:'test',  
  autoDiscover:true, 
  blacklist:[{'datacenter':'Analytics' } ] 
}

Here is an example of whitelisting specific racks:

{  
  hosts:['10.10.10.10'],  
  keyspace:'test',  
  autoDiscover:true, 
  whitelist:[{'datacenter':'Cassandra', 'racks':['rack1', 'rack2']} ] 
}

Here is an example ofwhitelisting specific hosts:

{  
  hosts:['10.10.10.10'],  
keyspace:'test',
autoDiscover:true,
whitelist
:[{'hosts':['10.10.10.1', '10.10.10.2']} ] 
}

This seemed to me to be the simplest way to specify rules.  Other options could include token ranges, but I'm not sure how helpful that would actually be.  The discovery takes place in the "monitorConnections" method so that it periodically will pull host information and add/remove connections where applicable.

Let me know what you think.

-Russ

Calvin French-Owen

未读,
2012年10月19日 13:36:562012/10/19
收件人 Russell Bradberry、hel...@googlegroups.com
Nice work, Russ! This seems like a good first pass.

The API looks good to me. I agree that blacklisting hosts by token seems less useful. If I'm using the RandomPartitioner, then I care much more about which hosts I'm connecting to based upon their rack/datacenter location rather than which part of the token space they own. 

Astyanax has the most advanced pool configuration options that I've seen (if you want to borrow ideas from them), but they are a bit heavy-weight compared to the rest of helenus right now. The whitelist/blacklist seems like a simple and easy to use approach.

-Calvin


--
 
 

Russell Bradberry

未读,
2012年10月20日 11:58:092012/10/20
收件人 hel...@googlegroups.com
I'm not really sure how to go about testing it, without a complex test environment consisting of multiple nodes.  Any ideas?

Calvin French-Owen

未读,
2012年10月20日 14:31:412012/10/20
收件人 Russell Bradberry、hel...@googlegroups.com
I've been using ccm to set up a ring of multiple nodes all running off the same machine. It works really well in terms of allowing you to bring nodes up and down and it's simple to configure. You can use it to add datacenter aware nodes as well.

I haven't set up any automated testing with it (other than running the existing tests against my own CCM cluster), but that would be a nice thing we could build in future versions of helenus. We could have 'make test' first spin up a CCM cluster, then run the tests on it.


--
 
 

回复全部
回复作者
转发
0 个新帖子