1, Installation Cassandra on Windows Host
bling-jna-in-cassandra
http://jna.java.net/
http://java.net/projects/jna
http://en.wikipedia.org/wiki/Java_Native_Access

As configuration location will be read out via Environment variable CASSANDRA_HOME, so in linux or windows environment, please set CASSANDRA_HOME in running process accordingly.

2, Cluster Configuration

* tokens calculation for new adding nodes
python version [in python 3.2]

def tokens(nodes):
for x in range(nodes):
print (2**127/nodes*x)

Java version – BigInteger [stored in virtual ubuntu system]

import java.math.BigInteger;

public class PythonCal{
public static void main(String[] args){
assert(args.length==1);
int iCodes = Integer.parseInt(args[0]);
BigInteger t = BigInteger.valueOf(2).pow(127).divide(BigInteger.valueOf(iCodes));
for(int i=0; i<iCodes; i++){
System.out.println(t.multiply(BigInteger.valueOf(i)).toString(10));
}
}
}

* seeds – ip address of the initial tokens server
* listen_address and rpc_address will be filled with

3, load balance – $CASSANDAR_HOME/bin/nodetool -h -p 8080 ring
Current status

Starting NodeTool
Address Status State Load Owns Token
122378085476254521922132626725931733214
10.56.201.228 Up Normal 10.88 KB 28.07% 0
10.56.201.244 Up Normal 6.54 KB 71.93% 122378085476254521922132626725931733214

Next two steps :
1, Load balance for clusterCluster operations
Refer to Ban,Black’s presetation –

Final solution is based on development wiki – Cluster Maintenance
* $CASSANDRA_HOME\bin\nodetool -h -p
* Autobootstrap & Automatic token assginement
* $CASSANDRA_HOME\bin\nodetool -h -p loadbalance [ -> result as follow ]

Starting NodeTool
Address Status State Load Owns Token
122378085476254521922132626725931733214
10.56.201.228 Up Normal 15.27 KB 50.00% 37307493746019906056288974867989680350
10.56.201.244 Up Normal 10.9 KB 50.00% 122378085476254521922132626725931733214

Pay attention to Token of initial_tokens : 0 node

* $CASSANDRA_HOME\bin\nodetool -h -p netstat [ -> previous : streams – in/out stream for ring ]

Starting NodeTool
Mode: Normal
Not sending any streams.
Not receiving any streams.
Pool Name Active Pending Completed
Commands n/a 0 1
Responses n/a 0 2476

Regarding ring’s maintanence, refer to section – Bootstrap & node token in ring

2, Next Steps: Cassandra Clients
* Java: Hector Client API
Hector provides Java developers with features lacking in Thrift, including connection pooling, JMX integration, failover and exentsive logging.
* Python: Pycassa Client API
Pycassa is a Python client API with features such as connection pooling, SuperColumn support, and a method to map existing classes to Cassandra column families.
* PHP: Phpycassa Client API
Phpycassa is a PHP client API with features such as connection pooling, a method for counting rows, and support for secondary indexes.

Advertisements