How to : Setup a Single node Cassandra 2.1.8 on Ubuntu 14.04.3 using apt-get

From my previous post here i installed cassandra using the tarball.
Now i’ll be using apt-get to install the Cassandra binaries.

1. Prepare the directory where we will place all our cassandra files.

 
cassandra@casslnx01:~$ sudo chown -R $USER:$GROUP /cassdata
cassandra@casslnx01:~$ sudo chown -R $USER:$GROUP /casslog
cassandra@casslnx01:~$ mkdir /cassdata/cassandra
cassandra@casslnx01:~$ mkdir /casslog/cassandra
cassandra@casslnx01:~$ sudo ln -s /cassdata/cassandra /var/lib/cassandra
cassandra@casslnx01:~$ sudo ln -s /casslog/cassandra /var/log/cassandra


2.Install Java 1.8

 
sudo add-apt-repository -y ppa:webupd8team/java
     
sudo apt-get update
sudo aptitude -y install oracle-java8-installer

cassandra@casslnx01:~$ java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
cassandra@casslnx01:~$

3.Add the DataStax Community repository to the /etc/apt/sources.list.d/cassandra.sources.list

 
$ echo "deb http://debian.datastax.com/community stable main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list

4.Add the DataStax repository key to your aptitude trusted keys.

 
curl -L http://debian.datastax.com/debian/repo_key | sudo apt-key add -

5.install the Cassandra 2.1.8 package

 
cassandra@casslnx01:~$ sudo apt-get install dsc21=2.1.8-1 cassandra=2.1.8
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following extra packages will be installed:
  libopts25 ntp python-support
Suggested packages:
  cassandra-tools ntp-doc
The following NEW packages will be installed:
  cassandra dsc21 libopts25 ntp python-support
0 upgraded, 5 newly installed, 0 to remove and 3 not upgraded.
Need to get 20.7 MB of archives.
After this operation, 24.8 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://debian.datastax.com/community/ stable/main cassandra all 2.1.8 [20.2 MB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ trusty/main libopts25 amd64 1:5.18-2ubuntu2 [55.3 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main ntp amd64 1:4.2.6.p5+dfsg-3ubuntu2.14.04.3 [418 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu/ trusty/universe python-support all 1.0.15 [26.7 kB]
Get:5 http://debian.datastax.com/community/ stable/main cassandra all 2.1.8 [20.2 MB]
87% [5 cassandra 17.6 MB/20.2 MB 87%]                                         
Get:6 http://debian.datastax.com/community/ stable/main cassandra all 2.1.8 [20.2 MB]
Get:7 http://debian.datastax.com/community/ stable/main dsc21 all 2.1.8-1 [1,310 B]
Fetched 3,147 kB in 17min 18s (3,028 B/s)                                     
Selecting previously unselected package libopts25:amd64.
(Reading database ... 57065 files and directories currently installed.)
Preparing to unpack .../libopts25_1%3a5.18-2ubuntu2_amd64.deb ...
Unpacking libopts25:amd64 (1:5.18-2ubuntu2) ...
Selecting previously unselected package ntp.
Preparing to unpack .../ntp_1%3a4.2.6.p5+dfsg-3ubuntu2.14.04.3_amd64.deb ...
Unpacking ntp (1:4.2.6.p5+dfsg-3ubuntu2.14.04.3) ...
Selecting previously unselected package python-support.
Preparing to unpack .../python-support_1.0.15_all.deb ...
Unpacking python-support (1.0.15) ...
Selecting previously unselected package cassandra.
Preparing to unpack .../cassandra_2.1.8_all.deb ...
Unpacking cassandra (2.1.8) ...
Selecting previously unselected package dsc21.
Preparing to unpack .../archives/dsc21_2.1.8-1_all.deb ...
Unpacking dsc21 (2.1.8-1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up libopts25:amd64 (1:5.18-2ubuntu2) ...
Setting up ntp (1:4.2.6.p5+dfsg-3ubuntu2.14.04.3) ...
 * Starting NTP server ntpd                                                                                                                                [ OK ]
Setting up python-support (1.0.15) ...
Setting up cassandra (2.1.8) ...
vm.max_map_count = 1048575
net.ipv4.tcp_keepalive_time = 300
Processing triggers for ureadahead (0.100.0-16) ...
Setting up dsc21 (2.1.8-1) ...
Processing triggers for libc-bin (2.19-0ubuntu6.6) ...
Processing triggers for python-support (1.0.15) ...
cassandra@casslnx01:~$

cassandra@casslnx01:~$ sudo apt-get install dsc21=2.1.8-1 cassandra=2.1.8 cassandra-tools=2.1.8
Reading package lists... Done
Building dependency tree      
Reading state information... Done
cassandra is already the newest version.
dsc21 is already the newest version.
The following NEW packages will be installed:
  cassandra-tools
0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
Need to get 8,698 B of archives.
After this operation, 77.8 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://debian.datastax.com/community/ stable/main cassandra-tools all 2.1.8 [8,698 B]
Fetched 8,698 B in 0s (16.7 kB/s)   
Selecting previously unselected package cassandra-tools.
(Reading database ... 57270 files and directories currently installed.)
Preparing to unpack .../cassandra-tools_2.1.8_all.deb ...
Unpacking cassandra-tools (2.1.8) ...
Setting up cassandra-tools (2.1.8) ...
cassandra@casslnx01:~$
cassandra@casslnx01:~$

6. Now lets check our cassandra cluster.

 
cassandra@casslnx01:~$ nodetool status
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address    Load       Tokens  Owns (effective)  Host ID                               Rack
UN  127.0.0.1  51.65 KB   256     100.0%            4b64ac25-0b97-4f9f-895a-29feb3d92647  rack1

cassandra@casslnx01:~$ cqlsh
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 2.1.8 | CQL spec 3.2.0 | Native protocol v3]
Use HELP for help.
cqlsh> describe cluster;

Cluster: Test Cluster
Partitioner: Murmur3Partitioner

cqlsh>

thank you… next post is multi node and multi datacenter cassandra cluster.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s