Tuesday, 5 December 2017

Configuring Cassandra 

If you have installed cassandra on one node then basically you don't need to do any configuration for one node installation.  But its good to know what configuration are available and how can you use them according to your requirement.

Finding location of main configuration file :-

Main file for configuration of cassandra database is cassandra.yaml .  The location of  cassandra.yaml file can be different based on that how installation was performed. 

- For tarbal installation configuration files lies as below

 if you have extracted cassandra tar binaries files at '/home/cassandra/'   then config files will be at below location /home/cassandra/apache-cassandra-3.5/conf


- Installation done through package manager (apt-get, yum etc..)

  location : /etc/cassandra/
node1:~$ls -ltr /etc/cassandra/cassandra.yaml
-rw-r--r-- 1 root root 49332 Nov 29 16:02 /etc/cassandra/cassandra.yaml

Installation of Cassandra database 


Installation from Debian packages


Add the Apache repository of Cassandra to /etc/apt/sources.list.d/cassandra.sources.list

echo "deb http://www.apache.org/dist/cassandra/debian 36x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list


  • Add the Apache Cassandra repository keys:
curl https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add -

Screenshot :-






  • Update the repositories:
sudo apt-get update

  • Install Cassandra:
sudo apt-get install cassandra   ( if you are installing non-root user)
apt-get install cassandra     ( if you are installing as root user ) 
root :~$apt-get install cassandra

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  ca-certificates-java fontconfig-config fonts-dejavu-core java-common libavahi-client3 libavahi-common-data libavahi-common3
  libcups2 libfontconfig1 libjpeg-turbo8 libjpeg8 liblcms2-2 libnspr4 libnss3 libnss3-nssdb libopts25 libpcsclite1
  libpython-stdlib libpython2.7-minimal libpython2.7-stdlib libxi6 libxrender1 libxtst6 ntp openjdk-8-jre-headless python
  python-minimal python2.7 python2.7-minimal x11-common
Suggested packages:
  cassandra-tools default-jre cups-common liblcms2-utils pcscd ntp-doc libnss-mdns fonts-dejavu-extra fonts-ipafont-gothic
  fonts-ipafont-mincho fonts-wqy-microhei fonts-wqy-zenhei fonts-indic python-doc python-tk python2.7-doc binutils binfmt-support
The following NEW packages will be installed:
  ca-certificates-java cassandra fontconfig-config fonts-dejavu-core java-common libavahi-client3 libavahi-common-data
  libavahi-common3 libcups2 libfontconfig1 libjpeg-turbo8 libjpeg8 liblcms2-2 libnspr4 libnss3 libnss3-nssdb libopts25
  libpcsclite1 libpython-stdlib libpython2.7-minimal libpython2.7-stdlib libxi6 libxrender1 libxtst6 ntp openjdk-8-jre-headless
  python python-minimal python2.7 python2.7-minimal x11-common
0 upgraded, 31 newly installed, 0 to remove and 15 not upgraded.
Need to get 62.9 MB of archives.
After this operation, 167 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
....
....
..... (output truncated)

update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/orbd to provide /usr/bin/orbd (orbd) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/servertool to provide /usr/bin/servertool (servertool) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/tnameserv to provide /usr/bin/tnameserv (tnameserv) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jexec to provide /usr/bin/jexec (jexec) in auto mode
Setting up cassandra (3.6) ...
Adding group `cassandra' (GID 117) ...
Done.
vm.max_map_count = 1048575
net.ipv4.tcp_keepalive_time = 300
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Processing triggers for systemd (229-4ubuntu21) ...
Processing triggers for ureadahead (0.100.0-19) ...



  • Once cassandra is installed using debian package manager it adds a new user cassadra in host. 

       root :~$tail /etc/passwd | grep cass

       cassandra:x:113:117:Cassandra database,,,:/var/lib/cassandra:/bin/false




  • Check for Cassandra binaries :-


        root :~$which cassandra
        /usr/sbin/cassandra



  • Check cqlsh (client to connect with cassandra) 


       root :~$which cqlsh

       /usr/bin/cqlsh