Cassandra
Back to current versionRestore this version

Cassandra#

Just some free format stuff for a small studying / experiment with NoSQL stuff.

Resources#

Install/config#

lxc#

auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
        address 10.0.4.10
        netmask 255.255.255.0
        network 10.0.4.0
        broadcast 10.0.4.255
        gateway 10.0.4.1
        post-up route add default gw 10.0.4.1 dev eth0
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers 213.197.28.3 213.197.30.28
        dns-search computerhok.nl

cassandra#

cssndra@ubuntu1:/opt/cassandra$ ls -l
total 248
-rw-r--r-- 1 cssndra cssndra 152928 Apr  8 19:21 CHANGES.txt
-rw-r--r-- 1 cssndra cssndra  11609 Apr  8 19:21 LICENSE.txt
-rw-r--r-- 1 cssndra cssndra  47580 Apr  8 19:21 NEWS.txt
-rw-r--r-- 1 cssndra cssndra   1820 Apr  8 19:21 NOTICE.txt
-rw-r--r-- 1 cssndra cssndra   3569 Apr  8 19:21 README.txt
drwxr-xr-x 2 cssndra cssndra   4096 May 15 21:43 bin
drwxr-xr-x 2 cssndra cssndra   4096 May 15 21:43 conf
drwxr-xr-x 2 cssndra cssndra   4096 May 15 21:43 interface
drwxr-xr-x 4 cssndra cssndra   4096 May 15 21:43 javadoc
drwxr-xr-x 3 cssndra cssndra   4096 May 15 21:43 lib
drwxr-xr-x 3 cssndra cssndra   4096 May 15 21:43 pylib
drwxr-xr-x 4 cssndra cssndra   4096 Apr  8 19:21 tools
cssndra@ubuntu1:/opt/cassandra$ ./bin/cassandra-cli Connected to: "Test Cluster" on 127.0.0.1/9160 Welcome to Cassandra CLI version 1.2.4 Type 'help;' or '?' for help. Type 'quit;' or 'exit;' to quit. [default@unknown] create keyspace DEMO with placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy' and strategy_options = {replication_factor:1}; f243abc2-57dc-32b4-9390-beac4e988c5b [default@unknown] use DEMO; Authenticated to keyspace: DEMO [default@DEMO] create column family Users with key_validation_class = 'UTF8Type' and comparator = 'UTF8Type' and default_validation_class = 'UTF8Type'; bb07d315-a824-3bbb-9b48-d759288e57b4 [default@DEMO] set Users[1234][name] = scott; Value inserted. Elapsed time: 63 msec(s). [default@DEMO] set Users[1234][password] = tiger; Value inserted. Elapsed time: 3.96 msec(s). [default@DEMO] get Users[1234]; => (column=name, value=scott, timestamp=1368679313136000) => (column=password, value=tiger, timestamp=1368679322745000) Returned 2 results. Elapsed time: 58 msec(s). [default@DEMO]

Now on the second node (ubuntu2) start the node with /opt/cassandra/bin/cassandra , and start creating the cluster. First create the proper tokens for a 4 node cluster, by using the following py :

# Number of nodes in the cluster
num_node = 4

for n in range(num_node):
    print int(2**127 / num_node * n)
And execute it :
cssndra@ubuntu1:~$ python calcToken.py 
0
42535295865117307932921825928971026432
85070591730234615865843651857942052864
127605887595351923798765477786913079296

First startup cassandra on all 4 nodes by executing from the host: ssh ubuntu@10.0.4.11 'sudo su - cssndra /opt/cassandra/bin/cassandra'

Cassandra notes/questions#

Questions#

Notes#