-
Book Overview & Buying
-
Table Of Contents
Apache Cassandra Essentials
By :
Apache provides source as well as binary tarballs and Debian packages. However, third-party vendors, such as Datastax, provide MSI installer, Linux RPM, Debian packages, and UNIX and Mac OS X binary in the form of community edition, which is a free packaged distribution of Apache Cassandra by Datastax. Here, we'll cover installation using binary tarball and source tarball packages.
The following are the prerequisites for installing Cassandra:
commitlog file is used by Cassandra to make write requests durable. Every write request is first written to this file in append only mode and an in memory representation of column family called memtable.JAVA_HOME environment variable to the correct version of Java if you are using multiple Java versions on your machine.cqlsh, are based on Python.Lets have a look at the following table
|
Port/Protocol |
Configuration file |
Configuration name |
Firewall setting |
Description |
|---|---|---|---|---|
|
|
|
|
Open among nodes in the cluster |
It acts as an internode communication port in a Cassandra cluster. |
|
|
|
|
Open among nodes in the cluster |
It is a SSL port for encrypted communication among cluster nodes. |
|
|
|
|
Between the Cassandra client and the cluster |
Cassandra clients, for example |
|
|
|
|
The Thrift client and the Cassandra cluster |
Thrift uses this port for client connections. |
|
|
|
|
Between the JMX console and the Cassandra cluster |
It acts as an JMX console port for monitoring the Cassandra server. |
The following method of installation is less used. One of the cases when we might use this method is if we're doing some optimization work on Cassandra. We'll need JDK 1.7, ANT 1.8, or later versions to compile the Cassandra code. Optionally, we can directly clone from the Cassandra Git repository or we can use the source tarball. Git client 1.7 will be required for cloning git repo.
To obtain the latest source code from Git, use the following command:
$ git clone http://git://git-wip-us.apache.org/repos/asf/cassandra.git Cassandra
For a specific branch, use the following command:
$ git clone -b cassandra-<version> http://git://git-wip-us.apache.org/repos/asf/cassandra.git
Use this command for version 1.2:
$ git clone -b cassandra-2.1.2 http://git://git-wip-us.apache.org/repos/asf/cassandra.git
Then, use the ant command to build the code:
$ ant
Alternatively, if a proxy is needed to connect to the Internet, use the autoproxy flag:
$ ant –autoproxy
or
$ export ANT_OPTS="-Dhttp.proxyHost=<your-proxy-host> -Dhttp.proxyPort=<your-proxy-port>"
Download a binary tarball from the Apache website; open it using the following command. Here, we will extract it in the /opt directory:
$ tar xzf apache-cassandra-<Version>.bin.tar.gz –C /opt
Consider the following example:
$ tar xzf apache-cassandra-2.1.2.bin.tar.gz –C /opt
Optionally, you can create a soft link as a best practice, which will help in scenarios where you need to change the installation location:
$ ln –s apache-cassandra-2.1.2 cassandra
The Cassandra installation layout may be different based on your type of installation. If you're installing using Debian or an RPM package, then the installation creates the required directories and applies the required permissions.
In older versions of Cassandra, you might need to create Cassandra log and data directories before running; by default, they are pointed to /var/lib/cassandra and /var/log/Cassandra. Running Cassandra will fail if the user running Cassandra doesn't have permissions for these paths. You can create and set permissions as shown here:
$ sudo mkdir -p /var/log/Cassandra $ sudo chown -R `whoami` /var/log/Cassandra $ sudo mkdir -p /var/lib/Cassandra $ sudo chown -R `whoami` /var/lib/cassandra
Change the font size
Change margin width
Change background colour