Skip to content

Instantly share code, notes, and snippets.

@loftywaif002
Last active April 25, 2017 18:53
Show Gist options
  • Save loftywaif002/1408199d0d52dae3527a8cfd30860d02 to your computer and use it in GitHub Desktop.
Save loftywaif002/1408199d0d52dae3527a8cfd30860d02 to your computer and use it in GitHub Desktop.
Installing-Cassandra+ Kong+Ubuntu
# Installing Java
We need Java in order to have Cassandra running
And we need Cassandra in order to run Kong.
So lets start installing Java 8 (the newest one)
First we add a repository to our build in order to manage the Java 8 package, since that is not normally supported by Ubuntu.
```
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
```
Now the repository have been added and updated we can go ahead and install Java 8
```
sudo apt-get install oracle-java8-installer
```
That will keep your Java installation up to date.
Now we need to setup the Java environment variables `JAVA_HOME` and `PATH`, luckily we can do that in another singe command:
```
sudo apt-get install oracle-java8-set-default
```
Now Java is fully installed on your server.
# Installing Cassandra
Now we can install Cassandra since we have installed Java, and Java 8 is required for Cassandra 2.0+.
Follow this instructions
http://ealfonso.com/setting-up-a-cassandra-cluster-on-awsubuntu14-04/
OR
By Downloading the package
cd /home/ubuntu
mkdir db
cd db/
wget http://www-eu.apache.org/dist/cassandra/3.0.7/apache-cassandra-3.0.7-bin.tar.gz
wget http://www-eu.apache.org/dist/cassandra/3.10/apache-cassandra-3.10-bin.tar.gz
tar xvzf apache-cassandra-3.0.7-bin.tar.gz
tar xvzf apache-cassandra-3.10-bin.tar.gz
cd apache-cassandra-3.10/
```
we can run casssandra by using this following command
bin/cassandra -f
To access the cql shell, we do [cassndra hs to be running for this and python must be installed]
[to install python sudo apt-get install python]
bin/cqlsh
[3 node cluster setup => assuming cassandra is running on 3 different nodes]
Example settings to connect them
Change following in conf/cassandra.yaml for all 3 nodes
Cassandra1 ==> 172.31.53.186 / 54.152.216.134
cluster_name: 'Test Cluster'
listen_address:
broadcast_address: 54.152.216.134
seeds: "52.91.62.29,52.91.85.200"
Cassandra2 ==> 172.31.63.178 / 52.91.62.29
cluster_name: 'Test Cluster'
listen_address:
broadcast_address: 52.91.62.29
seeds: "54.152.216.134,52.91.85.200"
Cassandra3 ==> 172.31.63.253 / 52.91.85.200
cluster_name: 'Test Cluster'
listen_address:
broadcast_address: 52.91.85.200
seeds: "54.152.216.134,52.91.62.29"
#Assuming the host is AWS
#By default the start_rpc is set to false in the cassandra.yaml file.
Set it to start_rpc: true !important
#seeds: <pubic_ip for the current server, public_ip for 2nd, public_ip for 3rd....>
#rpc_address is the address on which Cassandra listens to the client calls.
rpc_address: private ip of the node that it is running on
#listen_address is the address on which Cassandra listens to the other Cassandra nodes.
listen_address: private ip of the current server (if aws)
#broadcast_address is to broadcast the current node to other nodes
boradcast_address: public_ip address for the current server
For any memory issues
ulimit -4096
If you check the system.log file for cassandra in /var/log/cassandra, you will see that this problem occurs because the rpc server has not started.
By default the start_rpc is set to false in the cassandra.yaml file. Set it to start_rpc: true and then try again
Toubleshoooting refer to
https://stackoverflow.com/questions/29121904/cassandra-cqlsh-connection-refused
# Installing Kong
First we have to download the file from [Kong's website](http://getkong.org).
Luckily we can do that pretty easy:
```
wget "https://github.com/Mashape/kong/releases/download/0.3.2/kong-0.10.1.trusty_all.deb"
```
Now when we have the file we can install Kong, but it is a good idea to get the last required packages first.
```
sudo apt-get update
sudo apt-get install netcat lua5.1 openssl libpcre3 dnsmasq
```
And now we can install Kong
```
sudo dpkg -i kong-0.10.1.*.deb
```
cd /etc/kong
sudo mv kong.conf.default kong.conf
change #databbase=postgres to #database=cassandra and uncomment everything thats is realated to cassandra and clusters
On kong.conf
contact_points = private ip of server1, private ip server2,...... [VERY IMPORTANT!] [VERY IMPORTANT!]
You need node and npm to install the dashboard
sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install nodejs-legacy
sudo apt-get install npm
Then you can follow the following link
Install Kong Dashboard
https://github.com/PGBI/kong-dashboard
# Questions & Problems
I can be reached at [deep.row4@gmail.com).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment