Install Cassandra and Titan on Ubuntu Server 14.04 Trusty

titan logo

Hello everyone, this guide show step by step how to install cassandra and titan on Ubuntu Server 14.04 Trusty.

In my example,

  • My Ubuntu Server username: tiendang
  • My IP: 192.168.14.129

Prerequisites

  1. Install Ubuntu Server 14.04 Trusty.

    • Link download: http://releases.ubuntu.com/14.04.1/ubuntu-14.04.1-server-amd64.iso
    • After install, make sure your server is up to date

      • sudo apt-get update
      • sudo apt-get upgrade 
    • Check your hostname and hosts file, with my example:

      • Hostname: sudo vi /etc/hostname: ubuntu.tiendang
      • Hosts file: sudo vi /etc/hosts: 192.168.14.129   ubuntu.tiendang   ubuntu
  2. Install the latest version of Oracle Java SE Runtime Environment (JRE) 7 or 8

Procedure

In terminal

1. Check which version of Java is installed by running the following command:

java -version

2. Install Cassandra

Step 1: Download lastest cassandra (in my example, using cassandra version 2.1.2

~$ cd /tmp
/tmp$ wget http://www.apache.org/dyn/closer.cgi?path=/cassandra/2.1.2/apache-cassandra-2.1.2-bin.tar.gz

Step 2: Unpacking and move cassandra to directory which you prefer. With me, I store cassandra at my home directory “/home/tiendang/cassandra”

/tmp$ tar -xztf apache-cassandra-2.1.2-bin.tar.gz
/tmp$ mv cassandra-2.1.2 /home/tiendang/cassandra

Step 3: Configuration cassandra

/tmp$ cd /home/tiendang/cassandra or /tmp$ cd ~/cassandra
~$ vi conf/cassandra.yaml

Find and change:

  1. – seeds: “127.0.0.1” to – seeds: “192.168.14.129”
  2. listen_address: 127.0.0.1 to listen_address: 192.168.14.129
  3. rpc_address: 127.0.0.1 to rpc_address: 192.168.14.129

Save “:w” and out edit file “:q”

Step 4: Run Cassandra

runs Cassandra in the foreground

cassandra$ bin/cassandra -f

runs Cassandra without the foreground

cassandra$ bin/cassandra

3. Install Titan

Step 1: Download lastest Titan (In my example, I downloaded Titan version 0.5.3)

cassandra$ cd /tmp
/tmp$ wget http://s3.thinkaurelius.com/downloads/titan/titan-0.5.3-hadoop2.zip

Step 2: Unzip and move Titan to you prefer directory (with me, I stored at /home/tiendang/titan

/tmp$ unzip titan-0.5.3-hadoop2.zip
/tpm$ move titan-0.5.3-hadoop2 /home/tiendang/titan

Step 3: Config Titan run with Cassandra, Elasticsearch, Rexster

Edit file elasticsearch.yml

/tmp$ cd ~/titan
vi conf/elasticsearch.yml

Change network.host: 127.0.0.1 to network.host: 192.168.14.129

Edit file rexster-cassandra-es.xml

vi conf/rexster-cassandra-es.xml

Change <base-uri>http://127.0.0.1</base-uri> to <base-uri>http://192.168.14.129</base-uri> (In Block <http>)

Add line <storage.hostname>192.168.14.129</storage.hostname> (In Block <graphs><graph><properties>)

Edit file titan-cassandra-es.properties

vi conf/titan-cassandra-es.properties

Change storage.backend=cassandrathirft to storage.backend=cassandra

Change storage.hostname=127.0.0.1 to storage.hostname=192.168.14.129

Change index.search.hostname=127.0.0.1 to index.search.hostname=192.168.14.129

Edit file bin/titan.sh

vi bin/titan.sh

Change ${ELASTICSEARCH_IP:=127.0.0.1} to ${ELASTICSEARCH_IP:=192.168.14.129}

Change ${REXSTER_IP:=127.0.0.1} to ${REXSTER_IP:=192.168.14.129}

 

That so Okey. Now you can start titan by using command line

~/titan/bin/titan.sh start

Stop and show status off Titan:

~/titan/bin/titan.sh stop
~/titan/bin/titan.sh status

4. Additional Options

a. Add more graph

Edit file rexster-cassandra-es.xml

vi conf/rexster-cassandra-es.xml

You can clone block <graph> in to <graphs> then you can change <graph-name>, etc.

b. Change Authentication backend

Default cassandra make authenticator is AllowAllAuthenticator. If you want to secure you data, you can change authentication that make using username and password to access cassandra. Now you can follow steps

Step 1: Edit Cassandra configuration

cd ~/cassandra
vi conf/cassandra.yaml

Find and modify two line:

authenticator: AllowAllAuthenticator to authenticator: PasswordAuthenticator

authorizer: AllowAllAuthorizer to authorizer: CassandraAuthorizer

Step 2: Restart Cassandra

~cassandra$ pkill -f CassandraDaemon
~cassandra$ bin/cassandra

Step 3: Change default cassandra password, Create new user

Login and change default password cassandra

~cassandra$ bin/cqlsh 192.168.14.129 -u cassandra -p cassandra
cassandra@cqlsh> ALTER USER cassandra WITH PASSWORD 'tien@123';

Create new user (NOSUPERUSER | SUPERUSER)

cassandra@cqlsh> CREATE USER tiendang WITH PASSWORD 'tien@123' SUPERUSER ;

Step 4: Config titan

Edit file titan-cassandra-es.properties

$ vi ~/titan/conf/titan-cassandra-es.properties

Add two line after storage.hostname=192.168.14.129 (I use new user I created above)

storage.username=tiendang

storage.password=tien@123

Edit file rexster-cassandra-es.xml

$ vi ~/titan/conf/rexster-cassandra-es.xml

In Graph Properties block you add two tag:

<storage.username>tiendang</storage.username>

<storage.password>tien@123</storage.password>

Final Restart Titan

$ ~/titan/bin/titan.sh stop
$ ~/titan/bin/titan.sh start

Now you can access Rexter to view your grahp and using Gremlin Console to query by using your prefer broswer to go address: 192.168.14.129:8182. Then click doghouse link.

When install, you should read cassandra and titan document or research on internet to know more about parameter, properties..

Good Luck!

You may also like

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments