Casandra cluster setup on plain Ubuntu 14.04 VM’s

Step 1 → Add Public Key Authentication

ssh-keygen outputGenerating public/private rsa key pair.
Enter file in which to save the key (/Users/localuser/.ssh/id_rsa):
id_rsa.pub contentsssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDBGTO0tsVejssuaYR5R3Y/i73SppJAhme1dH7W2c47d4gOqB4izP0+fRLfvbz/tnXFz4iOP/H6eCV05hqUhF+KYRxt9Y8tVMrpDZR2l75o6+xSbUOMu6xN+uVF0T9XzKcxmzTmnV7Na5up3QM3DoSRYX/EP3utr2+zAqpJIfKPLdA74w7g56oYWI9blpnpzxkEd3edVJOivUkpZ4JoenWManvIaSdMTJXMy3MtlQhva+j9CgguyVbUkdzK9KKEuah+pFZvaugtebsU+bllPTB0nlXGIJk98Ie9ZtxuY3nCKneB+KjKiXrAvXUPCI9mWkYS/1rggpFmu3HbXBnWSUdf localuser@machine.local

Step 2 How To Implement a Basic Firewall Template with Iptables on Ubuntu 14.04

# Generated by iptables-save v1.4.21 on Tue Jul 28 13:29:56 2015
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
COMMIT
# Completed on Tue Jul 28 13:29:56 2015
*filter
# Allow all outgoing, but drop incoming and forwarding packets by default
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
# Custom per-protocol chains
:UDP - [0:0]
:TCP - [0:0]
:ICMP - [0:0]
# Acceptable UDP traffic# Acceptable TCP traffic
-A TCP -p tcp --dport 22 -j ACCEPT
# Acceptable ICMP traffic# Boilerplate acceptance policy
-A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
-A INPUT -i lo -j ACCEPT
# Drop invalid packets
-A INPUT -m conntrack --ctstate INVALID -j DROP
# Pass traffic to protocol-specific chains
## Only allow new connections (established and related should already be handled)
## For TCP, additionally only allow new SYN packets since that is the only valid
## method for establishing a new TCP connection
-A INPUT -p udp -m conntrack --ctstate NEW -j UDP
-A INPUT -p tcp --syn -m conntrack --ctstate NEW -j TCP
-A INPUT -p icmp -m conntrack --ctstate NEW -j ICMP
-A INPUT -p tcp -s <IP address of the node> -m multiport --dports 7000,9042,7001,7199,9160 -m state --state NEW,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -s <IP address of the node>-m multiport --dports 7000,9042,7001,7199,9160 -m state --state NEW,ESTABLISHED -j ACCEPT# Reject anything that's fallen through to this point
## Try to be protocol-specific w/ rejection message
-A INPUT -p udp -j REJECT --reject-with icmp-port-unreachable
-A INPUT -p tcp -j REJECT --reject-with tcp-reset
-A INPUT -j REJECT --reject-with icmp-proto-unreachable
# Commit the changes
COMMIT
*raw
:PREROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
COMMIT
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
COMMIT
*security
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
COMMIT
*mangle
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
COMMIT
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [0:0]
COMMIT
*raw
:PREROUTING DROP [0:0]
:OUTPUT DROP [0:0]
COMMIT
*nat
:PREROUTING DROP [0:0]
:INPUT DROP [0:0]
:OUTPUT DROP [0:0]
:POSTROUTING DROP [0:0]
COMMIT
*security
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [0:0]
COMMIT
*mangle
:PREROUTING DROP [0:0]
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [0:0]
:POSTROUTING DROP [0:0]
COMMIT
sudo service netfilter-persistent restart
sudo apt install apt-transport-https

Step 3 →Installing java 1.8.0_131

wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz"
sudo mkdir /usr/lib/jvm
cd /usr/lib/jvm
sudo tar -xvzf ~/Downloads/jdk-8u301-linux-x64.tar.gz
sudo gedit /etc/environment
/usr/lib/jvm/jdk1.8.0_281/bin
/usr/lib/jvm/jdk1.8.0_281/db/bin
/usr/lib/jvm/jdk1.8.0_281/jre/bin
J2SDKDIR="/usr/lib/jvm/jdk1.8.0_281"
J2REDIR="/usr/lib/jvm/jdk1.8.0_281/jre"
JAVA_HOME="/usr/lib/jvm/jdk1.8.0_281"
DERBY_HOME="/usr/lib/jvm/jdk1.8.0_281/db"
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/jdk1.8.0_281/bin:/usr/lib/jvm/jdk1.8.0_281/db/bin:/usr/lib/jvm/jdk1.8.0_281/jre/bin"
J2SDKDIR="/usr/lib/jvm/jdk1.8.0_281"
J2REDIR="/usr/lib/jvm/jdk1.8.0_281/jre"
JAVA_HOME="/usr/lib/jvm/jdk1.8.0_281"
DERBY_HOME="/usr/lib/jvm/jdk1.8.0_281/db"
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_281/bin/java" 0sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.8.0_281/bin/javac" 0sudo update-alternatives --set java /usr/lib/jvm/jdk1.8.0_281/bin/javasudo update-alternatives --set javac /usr/lib/jvm/jdk1.8.0_281/bin/javac
update-alternatives --list javaupdate-alternatives --list Java
java -version

Step 4 — Cassandra Cluster Install on Ubuntu 18.04 for Big Data

# wget http://apache.claz.org/cassandra/3.11.2/apache-cassandra-3.11.2-bin.tar.gz
# tar -xzvf apache-cassandra-3.11.2-bin.tar.gz# mv apache-cassandra-3.11.2 /usr/local/cassandra
#  useradd cassandra#  groupadd cassandra#  usermod -aG cassandra cassandra#  chown root:cassandra -R /usr/local/cassandra/#  chmod g+w -R /usr/local/cassandra/
[Unit]Description=Cassandra Database ServiceAfter=network-online.targetRequires=network-online.target[Service]User=cassandraGroup=cassandraExecStart=/usr/local/cassandra/bin/cassandra -f[Install]
# systemctl daemon-reload# systemctl enable cassandra.service
listen_address: 102.168.1.47
rpc_address: 192.168.1.47
cluster_name: 'AdminTome Cluster'
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.SimpleSeedProviderparameters:# seeds is actually a comma-delimited list of addresses.# Ex: "<ip1>,<ip2>,<ip3>"- seeds: "192.168.1.47"
# swapoff -a
#/swap.imgnoneswapsw00
cassandra - memlock unlimitedcassandra - nofile 100000cassandra - nproc 32768cassandra - as unlimited
vm.max_map_count = 131072
sysctl vm.max_map_count=131072
# systemctl start cassandra# systemctl status cassandra
# journalctl -f -u cassandra.service
bill@admintome:~/Downloads/cassandra$ bin/cqlsh cassandra.admintome.labConnected to Test Cluster at cassandra.admintome.lab:9042.[cqlsh 5.0.1 | Cassandra 3.11.2 | CQL spec 3.4.4 | Native protocol v4]Use HELP for help.cqlsh> select cluster_name, listen_address from system.local;cluster_name      | listen_address------------------+----------------AdminTome Cluster | 192.168.1.47(1 rows)cqlsh>
oot@cass1:~# /usr/local/cassandra/bin/nodetool statusDatacenter: datacenter1=======================Status=Up/Down|/ State=Normal/Leaving/Joining/Moving--  Address       Load       Tokens       Owns (effective)  Host ID                               RackUN  192.168.1.47  108.61 KiB  256          100.0%            5a82d2b5-3ad5-4c41-93cb-48c5b60deb27  rack1
root@cass1:~# /usr/local/cassandra/bin/nodetool statusDatacenter: datacenter1=======================Status=Up/Down|/ State=Normal/Leaving/Joining/Moving--  Address       Load       Tokens       Owns (effective)  Host ID                               RackUN  192.168.1.47  108.61 KiB  256          67.1%             5a82d2b5-3ad5-4c41-93cb-48c5b60deb27  rack1UN  192.168.1.48  112.97 KiB  256          65.0%             eabb7fd9-18c2-4e44-bcd2-5fcc1be3a83e  rack1UN  192.168.1.49  40.75 KiB  256          67.8%             ef978de6-f733-4863-9ad9-435c1504d9b8  rack1
CREATE KEYSPACE admintome WITH replication = {'class':'SimpleStrategy', 'replication_factor' : 3};
CREATE TABLE admintome.logs ( id UUID, datetime text, source text, type text, log text, PRIMARY KEY (id) );
cqlsh> create keyspace admintome with replication = {'class': 'SimpleStrategy', 'replication_factor': 3};cqlsh> create table admintome.logs ( id UUID, datetime text, source text, type text, log text, PRIMARY KEY (id) );cqlsh> select * from admintome.logs;id | datetime | log | source | type----+----------+-----+--------+------(0 rows)cqlsh>

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store