Cassandra Installation:
This post will help to setup a cassandra node
1. Download Cassandra from the http://cassandra.apache.org. I am installing apache-cassandra-1.2.3-bin.tar.gz
2. Unzip this file using gunzip apache-cassandra-1.2.3-bin.tar.gz
3. Untar it using tar -xvf apache-cassandra-1.2.3-bin.tar
4. Modify the cassandra.yaml file. Path of this file will be </path/to/cassandra/installation/conf>
5. In cassandra.yaml you will find the following configuration options:
initial_token:
<Generate the token value using ./token-generator tool,Explained in last>
data_file_directories (/var/lib/cassandra/data),
commitlog_directory (/var/lib/cassandra/commitlog), and
saved_caches_directory (/var/lib/cassandra/saved_caches).
seed_provider:
# Addresses of hosts that are deemed contact points.
# Cassandra nodes use this list of hosts to find each other and learn
# the topology of the ring. You must change this if you are running
# multiple nodes!
- class_name: org.apache.cassandra.locator.SimpleSeedProvider
parameters:
# seeds is actually a comma-delimited list of addresses.
# Ex: "<ip1>,<ip2>,<ip3>"
- seeds: "192.168.256.78"
listen_address: localhost
rpc_address: localhost
Make sure all data directories pre-exist and have writable permission on them
e.g: Updated cassandra.yaml file:
initial_token: 0
saved_caches_directory: /home/apache-cassandra-1.1.0/tmp/var/lib/cassandra/saved_caches
data_file_directories:
- /home/apache-cassandra-1.1.0/tmp/var/lib/cassandra/data
commitlog_directory: /home/apache-cassandra-1.1.0/tmp/var/lib/cassandra/commitlog
seeds: "192.168.256.78"
Note: seeds takes comma separated list of nodes ip
listen_address: 192.168.256.78
rpc_address: 192.168.256.78
6. By default, Cassandra will write its logs in /var/log/cassandra/.
Make sure this directory exists and has writable permission,and update log4j-server.properies file:
log4j.appender.R.File=/var/log/cassandra/system.log
Path to log4j-server.properies file will be </path/to/cassandra/installtion/conf> eg:
log4j.appender.R.File=/home/apache-cassandra-.1.0/tmp/var/log/cassandra/system.log
Token Generation: With ./token-generator tool you can generate the tokens for n nodes in cluster and then update the generated value in initial_token property of cassandra.yaml in all nodes respectively.
Path of /token-generator is </path/to/cassandra/installtion/tools/bin>
eg: Generating token for 2 nodes:
./token-generator 2
DC #1:
Node #1: 0
Node #2: 85070591730234615865843651857942052864
Now update initial_token with generated values in cluster
Start Cassandra:
Start the cassandra daemon using 'bin/cassandra -f'
The service should start in the foreground and log gratuitously to the console
If you do not want to see log on screen use it without -f option
Without using "-f " option, it will run in the background.
It will start a CassandraDaemon which can be checked using jps
Check the cluster state:
bin/nodetool -h <node_ip> ring
Stop Cassandra:
You can stop the process by killing it, using 'pkill -f CassandraDaemon'
This post will help to setup a cassandra node
1. Download Cassandra from the http://cassandra.apache.org. I am installing apache-cassandra-1.2.3-bin.tar.gz
2. Unzip this file using gunzip apache-cassandra-1.2.3-bin.tar.gz
3. Untar it using tar -xvf apache-cassandra-1.2.3-bin.tar
4. Modify the cassandra.yaml file. Path of this file will be </path/to/cassandra/installation/conf>
5. In cassandra.yaml you will find the following configuration options:
initial_token:
<Generate the token value using ./token-generator tool,Explained in last>
data_file_directories (/var/lib/cassandra/data),
commitlog_directory (/var/lib/cassandra/commitlog), and
saved_caches_directory (/var/lib/cassandra/saved_caches).
seed_provider:
# Addresses of hosts that are deemed contact points.
# Cassandra nodes use this list of hosts to find each other and learn
# the topology of the ring. You must change this if you are running
# multiple nodes!
- class_name: org.apache.cassandra.locator.SimpleSeedProvider
parameters:
# seeds is actually a comma-delimited list of addresses.
# Ex: "<ip1>,<ip2>,<ip3>"
- seeds: "192.168.256.78"
listen_address: localhost
rpc_address: localhost
Make sure all data directories pre-exist and have writable permission on them
e.g: Updated cassandra.yaml file:
initial_token: 0
saved_caches_directory: /home/apache-cassandra-1.1.0/tmp/var/lib/cassandra/saved_caches
data_file_directories:
- /home/apache-cassandra-1.1.0/tmp/var/lib/cassandra/data
commitlog_directory: /home/apache-cassandra-1.1.0/tmp/var/lib/cassandra/commitlog
seeds: "192.168.256.78"
Note: seeds takes comma separated list of nodes ip
listen_address: 192.168.256.78
rpc_address: 192.168.256.78
6. By default, Cassandra will write its logs in /var/log/cassandra/.
Make sure this directory exists and has writable permission,and update log4j-server.properies file:
log4j.appender.R.File=/var/log/cassandra/system.log
Path to log4j-server.properies file will be </path/to/cassandra/installtion/conf> eg:
log4j.appender.R.File=/home/apache-cassandra-.1.0/tmp/var/log/cassandra/system.log
Token Generation: With ./token-generator tool you can generate the tokens for n nodes in cluster and then update the generated value in initial_token property of cassandra.yaml in all nodes respectively.
Path of /token-generator is </path/to/cassandra/installtion/tools/bin>
eg: Generating token for 2 nodes:
./token-generator 2
DC #1:
Node #1: 0
Node #2: 85070591730234615865843651857942052864
Now update initial_token with generated values in cluster
Start Cassandra:
Start the cassandra daemon using 'bin/cassandra -f'
The service should start in the foreground and log gratuitously to the console
If you do not want to see log on screen use it without -f option
Without using "-f " option, it will run in the background.
It will start a CassandraDaemon which can be checked using jps
Check the cluster state:
bin/nodetool -h <node_ip> ring
Stop Cassandra:
You can stop the process by killing it, using 'pkill -f CassandraDaemon'
No comments:
Post a Comment