Reputation: 71
If you provide multiple hosts in cassandra.hosts for resilience, which sequence do they get selected in? How would multiple hosts work in local_quorum scenario. In case first host is unreachable, datacenter belonging to next host would be treated as local DC or what?
Thanks.
Upvotes: 1
Views: 196
Reputation: 87164
The list that you're providing to a driver is just a list of contact points for initial connection, after connection happens, driver discovers the topology of the cluster (retrieve list of all nodes, which data centers they belong to, etc.) - and then this list will be used for all operations. In many implementations this initial list of the nodes is shuffled before use - to avoid too many connections to the first node in the list, for example, when you have a lot of applications connecting to the same cluster.
For local quorum, full list of the nodes in the given data center will be used independent on how many nodes have you provided to a driver.
Regarding the last question - behaviour is different between driver versions. For example, in Java driver 3.x, the DC of first contacted node was used as the "local DC" if it wasn't provided explicitly. In Java driver 4.x this behaviour has changed, and driver requires that you provide DC explicitly (although in the last versions there was a way of restoring old behavior).
Upvotes: 1