This is the part-I of a Cassandra No-sql Database Series, in This first part we will configure Apache Cassandra with Ubuntu 15.04, will go little bit deeply in upcoming series.
Apache Cassandra is a massive scalable NoSQL database, it is designed to handle very larg amount of data across various servers, It is a peer-to-peer architecture data base, cassandra provide a high availability data center with no point of failure, it provides very high wright and read throughput. At present it is used in numerous data centers to manage their critical data infrastructure, Modern businesses turns to NoSQL/cassandra when they require a massive performance at high scale.
Ubuntu 15.04 Desktop OS.
JNA (Java Native Access)
Install Ubuntu desktop 15.04
Install oracle-jkd 7 (java)
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
Set Oracle-java-7 up automatically, run
sudo apt-get install oracle-java7-set-default
Now, you will need to install JNA, it will improve the performance of the cassDB server.
JNA is available with github.com/twall/jna, download jna.jar.
Move JNA to appropriate folder.
Copy the jna.jar to that folder.
Create a new user ‘cassandra’:
Assign password to that newly created user ‘cassandra’, to configure apache cassandra.
Switch to “cassandra” user, and create a new folder named as “cassandra” in home directory of “cassandra”, we will download apache-cassandra into that folder of “cassandra” user:
Have a look where exactly you are, with pwd.
Now, download apache-cassandra in to that folder. of “cassandra user”
Extract the package.
tar -xvf apache-cassandra-2.1.7-bin.tar
have a look into extracted apache-Cassandra folder
Now, create a soft link of JNA, in cassandra lib folder.
ln -s /usr/share/java/jna-4.1.0.jar jna.jar
edit /etc/security/limits.conf to assign memory limit for cassandra as unlimited.
describe soft and hard memory utility limit (Red colored)
#Each line describes a limit for a user in the form: # # # #Where: # can be: # - a user name # - a group name, with @group syntax # - the wildcard *, for default entry # - the wildcard %, can be also used with %group syntax, # for maxlogin limit # - NOTE: group and wildcard limits are not applied to root. # To apply a limit to the root user, must be # the literal username root. # # can have the two values: # - "soft" for enforcing the soft limits # - "hard" for enforcing hard limits # #unixmen cassandra soft nmlock unlimited cassandra hard nmlock unlimited # can be one of the following: # - core - limits the core file size (KB) # - data - max data size (KB) # - fsize - maximum filesize (KB) # - memlock - max locked-in-memory address space (KB) # - nofile - max number of open files # - rss - max resident set size (KB) # - stack - max stack size (KB) # - cpu - max CPU time (MIN) # - nproc - max number of processes # - as - address space limit (KB) # - maxlogins - max number of logins for this user # - maxsyslogins - max number of logins on the system # - priority - the priority to run user process with # - locks - max number of file locks the user can hold # - sigpending - max number of pending signals # - msgqueue - max memory used by POSIX message queues (bytes) # - nice - max nice priority allowed to raise to values: [-20, 19] # - rtprio - max realtime priority # - chroot - change root to directory (Debian-specific) # # # #* soft core 0 #root hard core 100000
Go to conf Directory of apache-cassandra installation folder and edit cassandra.yaml to define cluster name.
Create Required Directories and assign proper access rights:
Switch to root user and Create ‘/var/lib/cassandra/’ and ‘/var/log/cassandra’ directories, define permission accordingly:
chown cassandra.cassandra /var/lib/cassandra
chown cassandra.cassandra /var/log/cassandra
Now, switch to cassandra user, go to bin director available with apache-cassandra installation directory.
Run cassandra script present in bin directory with -f option.
This ./cassandra -f, command is very time taking and lengthy process, leave it as such and open a new terminal, to run next commands.
Leave ./cassandra in background and login to ‘cassandra’ user from new terminal, go to bin of apache-casaandra installation directory, and run ./cassandra-cli, cassandria-cli is the older version, (you should switch to ‘cqlsh’ utility, we will explain uses of ‘cqlsh’ in upcoming series)
Let’s have some examples:
bin/cassandra-cli --host localhost
[default@unknown] connect localhost/9160;
9160 is the port utilized by cassandria.
Let’s try to create some keyspace, keyspace can be considered as database of mysql.
[default@unknown]create keyspace unixmen;
At last let’s have a look in cqlsh utility.