Showing posts from January, 2018

Datastax administration Commands ( Part 6)

Start DSE service : sudo service dse start
Stop DSE service : sudo service dse stop

Configuration File Location :

## Show information of cluster
        nodetool status

## Show information about nodes and ring
        nodetool ring

## Repair one or more table
         nodetool repair

## Cleans up keyspaces and partition keys no longer belonging to a node.
         nodetool cleanup

## Flushes one or more tables from the memtable
         nodetool flush

## List files from backup data directories :
        find /mnt/cassandra/data/*/*/backups/* -type f -ls

## Remove files from backup data directories :
        find /mnt/cassandra/data/*/*/backups/* -type f -delete

## Retrieve the list of tokens associated with each node's IP:
      nodetool ring | grep ip_address_of_node | awk '{print $NF ","}&…

Changing keyspace replication strategy in Datastax Cassandra ( Part 5 )

In production environment, network aware topology must be set. Default SimpleStrategy will not work if you want to add rack and datacenter in to an existing cluster. In production environment use NetworkTopologyStrategy. Before changing topology we must make sure inter node communication is network aware for that change the Snitch properties.

Step 1) Change the snitch.
            cat /etc/dse/cassandra/cassandra.yaml | grep endpoint_snitch:
            endpoint_snitch: GossipingPropertyFileSnitch

Step 2) After changing snitch, specify the datacenter and rack information in 
             properties file.             cat /etc/dse/cassandra/ |grep -E 'dc=|rack='             dc=SearchGraph             rack=rack1
Step 3) Any change in cassandra.yaml file require node restart. Restart each node  one by one.              service dse restart
Step 4) Changed keyspace topology.
             ALTER KEYSPACE tech_app1 WITH REPLICATION = {'class' : '…

Install Datastax Cassandra PHP Extension in Ubuntu ( Part 4 )

Step 1 : Install Dependencies

sudo apt-get install g++ make cmake libuv-dev libssl-dev libgmp-dev  php5-dev openssl libpcre3-dev

Step 2 : Install cpp-drivers as per your requirement from the link :

        # sudo apt-get install php-config  //to solve cpp driver version issue with php

        dpkg -i libuv_1.8.0-1_amd64.deb
        dpkg -i libuv-dbg_1.8.0-1_amd64.deb
        dpkg -i libuv-dev_1.8.0-1_amd64.deb
        dpkg -i cassandra-cpp-driver_2.4.2-1_amd64.deb
        dpkg -i cassandra-cpp-driver-dbg_2.4.2-1_amd64.deb
        dpkg -i cassandra-cpp-driver-dev_2.4.2-1_amd64.deb

Step 3 : Build Datastax C/C++ Driver.

       git clone
       mkdir cpp-driver/build
       cd cpp-driver/build
       cmake ..
       make install

Step 4 : Install the PHP extension

       git clone
       cd php-driver
       git submodule update --init
       cd ext

Install OpsCenter & Configure to existing Datastax Cassandra Cluster ( Part 3 )

Follow the steps to install OpsCenter .Don't forget to signup inDatastax acadamey, which we will need during the installation process 

Step 1:  Add Datastax repository file
             sudo echo "deb stable main" | sudo tee -a /etc/apt/sources.list.d/datastax.sources.list

Step 2:  Add the Datastax repository key
             sudo curl -L | sudo apt-key add -
Step 3:  Install the package
             sudo apt-get update              sudo apt-get install opscenter

Step 4:  Start Opscenter
              sudo service opscenterd start

Step 5:  Browse Opscenter using below url
Follow the step to  Configuring OpsCenter to existing Datastax Cassandra Cluster.
Step 1:  Update address.yaml located in your Cassandra cluster nodes.
             sudo echo "stomp_interface: <reachable_opscenterd_ip>" | sudo tee -a /var/…

Upgrading to Datastax Cassandra 5.0 ( Part 2 )

Follow the instructions to upgrade  DataStax Enterprise  from 4.8 to 5.0 version. First take the backup of cassandra.yaml and dse.yaml. Don't forget to signup in Datastax acadamey , which we will need during the installation process 

Step 1:  Snapshot all keyspaces as needed.

             nodetool snapshot <keyspace_name>

Step 2:  Backup keyspace snapshot

Step 3:  Run nodetool drain to flush the commit log of the old installation.

             sudo nodetool -h hostname drain

Step 4:  Stop node services

            sudo service dse stop
            sudo service datastax-agent stop

Step 5:  Backup configuration file.

            cp -r /etc/dse/dse.yaml /home
            cp -r /etc/dse/cassandra/cassandra.yaml /home
            cp -r /etc/dse/cassandra/ /home
            cp -r /etc/dse/cassandra/ /home

Step 6:  Make sure you have latest java is installed (1.8.0_40 minimum) or install it

             sudo java -version

Step 7:  Add Datastax repositor…

Datastax Cassandra Cluster implementation in Debian ( Part 1 )

Lets check how to setup Cassandra clustering in 3 Debian nodes. I am using Cluserssh tool to connect to all nodes at the same time.First create an login account in Datastax acadamey , which we will need during the installation process

Step 1:  Connect to all 3 nodes using clusterssh
              sudo cssh -l username node1ip node2ip node3ip
Step 2:  Make sure java is installed or install it
             sudo java -version
Step 3:  Add Datastax repository file
             sudo echo "deb stable main" | sudo tee -a /etc/apt/sources.list.d/ datastax.sources.list
Step 4:  Add the Datastax repository key
             sudo curl -L | sudo apt-key add -
Step 5:  Install the package
             sudo apt-get update              sudo apt-get install dse-full
Step 6:  Stop DSE service
             sudo service dse stop
Step 7:  Delete all files from cassandra data directory …

Continuous Deployment : Using AWS Code Commit, AWS Code Deploy and Jenkins (Part 5)

Create a source bundle, which includes the deployment scripts, and upload it to AWS CodeCommit repository Now you can download the following sample bundle to your local repository and push the change to the central repository along with your application code hosted on AWS CodeCommit. The sample bundle includes everything you need to work AWS CodeDeploy: the Application Specification (AppSpec) file and deployment scripts. This sample bundle contains the deployment artifacts and a set of scripts that call the AutoScaling EnterStandby and ExitStandby APIs to do both the registration and deregistration of an Amazon EC2 instance from the load balancer. The installation scripts and deployment artifacts are bundled together with a CodeDeploy AppSpec file. The AppSpec file must be placed in the root of your sourcerepository and describes where to copy the application and how to execute installation sc…

Continuous Deployment : Using AWS Code Commit, AWS Code Deploy and Jenkins (Part 4)

Use AWS CodeDeploy to Deploy  Amazon EC2 Instances Behind an Elastic Load Balancer and Auto Scaling Let’s assume you have an application architecture designed for high availability that includes an Elastic Load Balancer in front of multiple application servers belonging to an Auto Scaling Group. Elastic Load Balancing enables you to distribute incoming traffic over multiple servers and Auto Scaling allows you to scale your EC2 capacity up or down automatically according to your needs In this blog post, we will show how you can use CodeDeploy to avoid downtime when updating the code running on your application servers in such an environment. We will use the CodeDeploy rolling updates feature so that there is a minimum capacity always available to serve traffic and use a simple script to take EC2 instances out of the load balancer as and when we deploy new code on it. So let’s get started. We are going to: Set up the environment with Elastic Load Balancer and Auto Scaling GroupSet up the…

Continuous Deployment : Using AWS Code Commit, AWS Code Deploy and Jenkins (Part 3)

AWS CodeDeploy AWS CodeDeploy coordinates application deployments to Amazon EC2 instances, on-premises instances, or both. (On-premises instances are physical devices that are not Amazon EC2 instances.) An application can contain deployable content like code, web, and configuration files, executables, packages, scripts, and so on. AWS CodeDeploy deploys applications from Amazon S3 buckets and GitHub repositories. You do not need to make changes to your existing code to use AWS CodeDeploy. You can use AWS CodeDeploy to control the pace of deployment across Amazon EC2 instances and to define the actions to be taken at each stage. AWS CodeDeploy works with various systems for configuration management, source control, continuous integration, continuous delivery, and continuous deployment. AWS CodeDeploy offers these benefits: Automated deployments: AWS CodeDeploy fully automates your application deployments across your development, test, and production environments. AWS CodeDeploy scales w…