Tuesday 10 December 2013

DataStax Hybrid Cluster SetUp

This post will set up a hybrid cluster of datastax. Hybrid means one node is for cassandra and another is for solr.

Here i will show the configuration for one cassandra and one solr node .... But in the same way you can add the configuration for 'N' number of nodes

DSE-3.1.0 Multi node Hybrid cluster setup:

Here, we will set up a two node cluster in which first node will be cassandra node and second will be of solr node.

Lets us say, node which will be of cassandra node has ip - ip1 and node of solr node has ip - ip2

Cassandra node : ip1
Solr node : ip2

Prerequisites:

DSE-3.1.0 tar
Download the Tar:
1. Dse tar can be downloaded from : http://downloads.datastax.com/enterprise/dse-3.1.0-bin.tar.gz
Or you can use wget command to download this:
wget http://<user_name>:<password>@downloads.datastax.com/enterprise/dse-3.1.0-bin.tar.gz
For this you must be registered with this site.

Configuration Steps:
1.      Place the tar in same locations on all nodes in the cluster.
            Location in this cluster : /home/softwares/ dse-3.1.0
2.      Extract the dse-3.1.0-bin.tar.gz on all nodes.

 Configuration matrix:
 For cassandra node ip1

File : cassandra.yaml
Location of File: DSE{installation directory/resources/cassandra/conf}    
Property/Value:

num_tokens                           1
initial_token                          -9223372036854775808


data_file_directories             Path/to/dseinstallation/resources/                                                                           cassandra/tmp/var/lib/cassandra/data

commitlog_directory            Path/to/dseinstallation/resources/
                                              cassandra/tmp/var/lib/cassandra/commitlog

saved_caches_directory       Path/to/dseinstallation/resources/
                                              cassandra/tmp/var/lib/cassandra/saved_caches

seed_provider                           ip1
listen_address                           ip1
rpc_address                              ip1
read_request_timeout_in_ms    50000
range_request_timeout_in_ms   50000
write_request_timeout_in_ms    50000
request_timeout_in_ms              50000

File: log4j-server.properties
Location Of File:   DSE{installation directory/resources/cassandra/conf}
Property/Value:

log4j.appender.R.File:            Path/to/dseinstallation/resources/
                                               cassandra/tmp/var/log/cassandra/system.log

log4j.appender.V.File             Path/to/dseinstallation/resources/
                                               cassandra/tmp/var/log/cassandra/solrvalidation.log

For Solr node ip2

File : cassandra.yaml
Location of File: DSE{installation directory/resources/cassandra/conf}    
Property/Value:

num_tokens                           1
initial_token                          -6148914691236517206

data_file_directories             Path/to/dseinstallation/resources/                                                                         cassandra/tmp/var/lib/cassandra/data

commitlog_directory             Path/to/dseinstallation/resources/
                                              cassandra/tmp/var/lib/cassandra/commitlog

saved_caches_directory        Path/to/dseinstallation/resources/
                                              cassandra/tmp/var/lib/cassandra/saved_caches

seed_provider                           ip1
listen_address                           ip2
rpc_address                              ip2
read_request_timeout_in_ms    50000
range_request_timeout_in_ms   50000
write_request_timeout_in_ms    50000
request_timeout_in_ms              50000

File: log4j-server.properties
Location Of File:   DSE{installation directory/resources/cassandra/conf}
Property/Value:

log4j.appender.R.File:           Path/to/dseinstallation/resources/
                                               cassandra/tmp/var/log/cassandra/system.log

log4j.appender.V.File             Path/to/dseinstallation/resources/
                                               cassandra/tmp/var/log/cassandra/solrvalidation.log


Note:
·        Path pointing to the following properties should pre-exist
                                    data_file_directories
                                    commitlog_directory
                                    saved_caches_directory

·        It is good to mention the log directory to check where all the logs will be created. As mentioned in the above log4j-server.properties file. Path should pre-exist also

·       Token Generation Utility  To calculate tokens use below command:

python -c 'print [str(((2**64 / number_of_tokens) * i) - 2**63) for i in range(number_of_tokens)]'

For example, to generate tokens for 6 nodes:

python -c 'print [str(((2**64 / 6) * i) - 2**63) for i in range(6)]'


['-9223372036854775808', '-6148914691236517206', '-3074457345618258604', '-2',

 '3074457345618258600', '6148914691236517202']

It displays the token for each node

Now update the generated token value in initial_token property in cassandra.yaml

Start the cluster:
Start the cassandra node on ip1       Path/to/dseinstallation/bin/dse cassandra

Start Solr on ip2                              Path/to/dseinstallation/bin/dse cassandra -s

Check that your cluster is up and running:

            Packaged installs: Path/to/dseinstallation/bin/nodetool status

Now you can access solr server at http://ip2:8983/solr/#/