-
Notifications
You must be signed in to change notification settings - Fork 2
Home
- Install Apache Cassandra. On AWS use Datastax AMI to install Cassandra as it provides a production ready image with raided disks, Java environment etc.
Otherwise Install Cassandra from Datastax repository
A. Install Oracle Java
sudo apt-get update
mkdir install
cd install
wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-x64.tar.gz
#or http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz
Untar and install
Update alternatives
java -version
echo $JAVA_HOME
B. Install Cassandra
echo "deb http://debian.datastax.com/community stable main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
curl -L http://debian.datastax.com/debian/repo_key | sudo apt-key add -
sudo apt-get update
sudo apt-get install dsc22
nodetool status
sudo service cassandra stop
sudo mv /var/lib/cassandra/ /mnt/cassandra
sudo mv /var/log/cassandra/ /mnt/cassandra/logs
sudo ln -s /mnt/cassandra/ /var/lib/cassandra
sudo ln -s /mnt/cassandra/logs/ /var/log/cassandra
sudo chown -R cassandra.cassandra /mnt/cassandra/
sudo service cassandra start
nodetool status
Download jna.jar
wget http://java.net/projects/jna/sources/svn/content/tags/3.3.0/jnalib/dist/jna.jar?rev=1208
Where to put jna.jar?
-
Create a keyspace in your Cassandra
-
Use the Schema in Database Schema Cassandra and create the two tables (in Cassandra table is usually called Column Family)
-
Clone the itrack project into your working environment.
-
To Run gps-ingester-sample, just change the config.properties file in gps-ingester-sample/src/main/resources/ Setthe nodes with the ip address of your cassandra. also set they keyspace using the keyspace name that you created on step 2. Afterwards, just run SampleTest.java to insert 10000 sample data to Cassandra.
-
To read the data we use php-read-sample so that the data can be displayed on the web. To tun php-read-sample, we need to install the following on the machine where we want to run PHP:
- Web Server (Apache, Nginx, or IIS)
- PHP
-
Place php-read-sample directory to the root directory of your web server. Inside php-read-sample there are two php files fulldata.php to display data from gps_full_data table. The other file is lastdata.php to display gps_last_data.php. Read latency is around 500 rows per second.