TagCloud

Friday, December 28, 2012

cassandra installation script

cassandra 1.1.18 설치 ( CentOS 6.3 x64 )
주: 현재 Cassandra 1.1.18 버젼은 Java 1.6 을 권장하며, Java 1.7 은 권장하지 않음

1. cassandra download , tar
- wget http://mirror.apache-kr.org/cassandra/1.1.8/apache-cassandra-1.1.8-bin.tar.gz
- tar -xvzf apache-cassandra-1.1.8-bin.tar.gz
- mv apache-cassandra-1.1.8 /srv/cassandra
2. make & configure directory path ( log )
- mkdir /srv/cassandra/log
- vi /srv/cassandra/conf/log4j-server.properties
   log4j.appender.R.File=/srv/cassandra/log/system.log
3. make & configure directory path ( cassandra.yaml - data, commitog, saved_caches)
- mkdir /srv/cassandra/data
- mkdir /srv/cassandra/commitlog
- mkdir /srv/cassandra/saved_caches
- vi /srv/cassandra/conf/cassandra.yaml
data_file_directories:
    - /srv/cassandra/data
commitlog_directory: /srv/cassandra/commitlog
saved_caches_directory: /srv/cassandra/saved_caches
4-1. configure cluster (Optional) (refer : http://www.datastax.com/docs/1.1/initialize/cluster_init#cluster-init )
- vi /srv/cassandra/conf/cassandra.yaml  에서 설정 ( cluster_name 등 )
4-2. Configure Memory Usage (Optional)
- vi /srv/cassandra/conf/cassandra-env.sh
#MAX_HEAP_SIZE="4G"
#HEAP_NEWSIZE="800M"
5. user and group add (Optional)
- chown -Rf luvu /srv/cassandra
- chgrp -Rf luvu /srv/cassandra
5. start server
- /srv/cassandra/bin/cassandra # foreground option : -f
6. start client
- /srv/cassandra/bin/cassandra-cli
- [default@unknown] connect localhost/9160;
7. stop server
- vi /srv/cassandra/bin/stop-server # reference
8. firewall ( refer : http://www.datastax.com/docs/1.1/references/firewall_ref#firewall-ref )
iptables -I INPUT -p tcp --dport 9160 -j ACCEPT
service iptables save
service iptables restart
ETC.
commitlog flush : /srv/cassandra/bin/nodetool -h localhost flush 
commitlog flush : /srv/cassandra/bin/nodetool -h localhost drain (Drain the node (stop accepting writes and flush all column families)

Next Step :
- Cluster Setting

Reference :
http://www.datastax.com/docs/1.1/install/install_bintar
http://wiki.apache.org/cassandra/