-
Notifications
You must be signed in to change notification settings - Fork 3
Token assignment
Cassandra requires you to place replicas in different racks to achieve the fault tolerance in case there is a rack outage. To achieve a even distribution of data you might need to alternate the nodes in the cluster into different racks. To understand how Cassandra decides the replicas to replicate you might want to read NetworkTopologyStrategy
Priam is a peer-to-peer co-process which tries not to hold any state in itself. To store the membership information Priam uses a external system, an external system can be SimpleDB or even another Cassandra instance. When Priam comes for the first time it will try to achieve a lock on a token. Once it achieves a lock it will set the token in cassandra.yaml and start Cassandra in bootstrapping mode. When a node goes down and a replacing node comes online Priam will replace the nodes token by setting -Dcassandra.replace_token=. By default we provide support for SimpleDB for storing the metadata and use the AWS API to query membership.
Logic: To achieve an even distribution, Priam calculates the number of possible nodes in the cluster and splits the ring into equal pieces. Once the number of splits are calculated Priam tries to get a lock on the token based on its location. Priam avoids placing the nodes in the same rack next to each other in the key ring.
AWS: We need to create one autoscaler per zone. In AWS the autoscaler will try to spin a instance in a zone and if it is not able to create the instance it will try to create one in the other zone. Once the other zone becomes available it will try to rebalance the zones by randomly terminating the instance in zones. Hence the work around is to create one autoscaler per zone. Note: Priam requires at least 2 zones in the current implementation to create a comprehensive seed list.
Interface IMembership: getRacMembership lists all the instance ID in a rack where we are querying from. getRacMembershipSize number of instances in this rack getRacCount total amount of racks in the cluster addACL ACL changes needed to achieve communication between the nodes.