• Call us: 1(704) - 858 - 0065
  • Email us: dmngaya@dmnbigdata.com
  • Working Hours: 8am - 6pm

Setup-Cassandra Cluster Open Source on Centos 6.7

Setup-Cassandra Cluster Open Source on Centos 6.7

I am going to use utility called csshx which allow me to type on multiple machine concurrently, you can see how to install it on this web site: http://www.unixmen.com/how-to-manage-multiple-ssh-sessions-using-cluster-ssh-and-pac-manager/

IN MY EXAMPLE, I AM SETTING UP 4 VIRTUALBOX CENTOS 6.7 MACHINE:

[php]
Machine:                            IP Address:
base                                192.168.56.71
dn1                                 192.168.56.72
dn2                                 192.168.56.73
dn3                                 192.168.56.74
[/php]

SEE BELOW THE WINDOWS OF ALL MY MACHINES:

1) SETUP FIREWALL: WE HAVE TO VERIFY THESE PORTS OPEN AND AVAILABLE

How to Configure Ubuntu’s Built-In Firewall:

http://www.howtogeek.com/115116/how-to-configure-ubuntus-built-in-firewall/

How to Configure Centos ’s Built-In Firewall:

http://msvaljek.blogspot.com/2015/01/setting-up-cassandra-cluster-in-virtual.html

2) USER RESOURCE LIMITS:

view the current limits using the ulimit -a command. DataStax recommends making the changes permanent:
Packaged installs: following settings are included in the /etc/security/limits.d/cassandra.conf file:

[php]
- memlock unlimited
- nofile 100000
- nproc 32768
- as unlimited[/php]

Tarball installs: settings are included in the /etc/security/limits.conf file:

[php]
- memlock unlimited
- nofile 100000
- nproc 32768
- as unlimited[/php]

For CentOS, RHEL, OEL systems, also set the nproc limits in /etc/security/limits.d/90-nproc.conf:

[php]- nproc 32768[/php]

For all installations, add the following line to /etc/sysctl.conf:

[php]vm.max_map_count = 131072[/php]

To make the changes take effect, reboot the server or run the following command:

[php]$ sudo sysctl -p[/php]

3) UPDATE THE PACKAGE:

[php]sudo yum update[/php]

4) INSTALLING VIM:

[php]sudo yum install vim[/php]

5) INSTALLING JDK:

Install latest Java 7 release:Oracle JDK 1.7+ required for Cassandra 2.0+, 64 bit Oracle Java 7 preferred
We can use the shell script below to download and install Java
downloading the oracle JDK:

[php]sudo wget --no-check-certificate --no-cookies --header "Cookie:oraclelicense=accept-securebackup-cookie"
"http://download.oracle.com/otn-pub/java/jdk/8u51-b16/jdk-8u51-linux-x64.tar.gz"
we can also use this shell script (source:https://gist.github.com/P7h/9741922
):[/php]

INSTALLING ORACLE JDK ON RHEL-BASED SYSTEMS:
Link : https://docs.datastax.com/en/cassandra/2.0/cassandra/install/installJdkRHEL.html

make a directory:

[php]mkdir -p /usr/java/latest
sudo mv jdk-8u51-linux-x64.tar.gz /usr/java/latest
cd /usr/java/latest ;sudo tar -zxf jdk-8u51-linux-x64.tar.gz
sudo /usr/sbin/alternatives --install "/usr/bin/java" "java" "/usr/java/latest/jdk1.8.0_51/bin/java" 1
sudo /usr/sbin/alternatives --config java
java -version
[hduser@base ~]$ java -version
java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b25)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)[/php]

ORACLE JDK ON DEBIAN OR UBUNTU SYSTEMS :
See this link:https://docs.datastax.com/en/cassandra/2.0/cassandra/install/installJdkDeb.html

• CONFIGURE JAVA_HOME ON CENTOS:

[php]JAVA_HOME=/usr/lib/java/jdk1.8.0_40[/php]

• INSTALL JAVA NATIVE ACCESS (JNA) LIBRARIES (PRIOR TO C*2.1) :
required for production systems
Installing the JNA on RHEL or CentOS Systems: see the link: https://docs.datastax.com/en/cassandra/2.0/cassandra/install/installJnaRHEL.
Install jna:

[php]sudo yum install jna[/php]

INSTALLING THE JNA ON DEBIAN OR UBUNTU SYSTEMS:
https://docs.datastax.com/en/cassandra/2.0/cassandra/install/installJnaDeb.html

6) SYNCHRONIZE CLOCKS ON EACH NODE SYSTEM:USE NTP OR SIMILAR TOOL

See this link: http://www.rackspace.com/knowledge_center/article/using-ntp-to-sync-time .All machines will have the same time

7) DISABLE SWAP:

[php]sudo swapoff -all[/php]

In production environment, the operating system could swap up if we don’t disable it, it can be difficult to reproduce.

8) ADD THE DATASTAX COMMUNITY REPOSITORY TO THE /ETC/YUM.REPOS.D/DATASTAX.REPO:

[php]
[datastax]
name = DataStax Repo for Apache Cassandra
baseurl = http://rpm.datastax.com/community
enabled = 1
gpgcheck = 0
[/php]

INSTALL THE PACKAGES:

[php]$ sudo yum install dsc22
$ sudo yum install cassandra22-tools ## Installs optional utilities[/php]

9) NOW CASSANDRA IS RUNNING :

[php][hduser@base ~]$ ps -ef|grep java[/php]

WE HAVE TO STOP ALL CASSANDRA:

[php]sudo service Cassandra stop[/php]

THEN DELETE ALL DIRECTORY OF CASSANDRA :

[php]cd /var/lib/Cassandra/
ls -ltr *
[hduser@base cassandra]$ ls -ltr
total 12
drwxr-xr-x 8 cassandra cassandra 4096 30 déc. 21:33 data
drwxr-xr-x 2 cassandra cassandra 4096 3 janv. 20:47 saved_caches
drwxr-xr-x 2 cassandra cassandra 4096 3 janv. 23:54 commitlog[/php]

[php]rm -Rf    */*[/php]

10) CONFIGURATION OF CASSANDRA.YAML :

[php]cd   /etc/cassandra/conf[/php]

see all configuration files :

OPEN THE CASSANDRA.YAML FILE :

[php]sudo vi Cassandra.yaml[/php]

Change cluster_name, for example I put Training_Cluster on all nodes.

Setting listen_address: can be the IP address for each machine:

Setting rpc_address: can be the IP address for each machine:

Setting the seeds: my seeds list here will be the IP address of the node 192.168.56.71 and node 192.168.56.74, then all nodes will have the same seeds.

11) NOW WE CAN START CASSANDRA ON ALL NODE VIA CSSH IF IT IS INSTALL OR ON EACH NODE:

[php][hduser@base cassandra]$ sudo service cassandra start[/php]

Starting Cassandra: OK

12) TO VERIFY THE STATUS ON CASSANDRA ON ALL NODES:

[php][hduser@base cassandra]$ sudo service cassandra status
cassandra (pid  3968) is running[/php]

13) TO VERIFY THE STATUS ON ALL NODES FROM ONE NODE BY USING nodetool status :

[php]
[hduser@base cassandra]$ nodetool -h 192.168.56.71 status
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address       Load     Tokens Owns Host ID                               Rack
UN 192.168.56.72 40.21 MB 256    ?    5ddb3532-70de-47b3-a9ca-9a8c9a70b186  rack1
UN 192.168.56.73 50.88 MB 256    ?    ea5286bb-5b69-4ccc-b22c-474981a1f789  rack1
UN 192.168.56.74 48.63 MB 256    ?    158812a5-8adb-4bfb-9a56-3ec235e76547  rack1
UN 192.168.56.71 48.52 MB 256    ?    a42d792b-1620-4f41-8662-8e44c73c38d4  rack1
[/php]

Leave a Reply

Close Menu
×
×

Cart