Saturday, 20 June 2015

Starting and Stopping Cassandra

Starting and Stopping Cassandra as a service
                service cassandra start
                service cassandra stop


Cassandra operations in case of tarball installations:

                Starting Cassandra:        
                                $ cd <install_location>                  
                                $ bin/cassandra

                                - where <install_location> is where you have installed cassandra
                                - bin/cassandra will start cassandra as a background process
                                - bin/cassandra -f will start cassandra in foreground


                Stopping Cassandra:
                - As it's only a process and not a service you could do something like
                - where <pid> is what you get from ps auwx | grep cassandra
                                $ ps auwx | grep cassandra
                                $ sudo kill <pid>

Best Practices:

                - You could check if cassandra is running by checking the port, if you got a result back that
                   means it is running
                                $ lsof -i :9160
                - If you want to kill it , do kill -9 "pid"

                - Below procedure is suggested that minimizes the risk of something going wrong.

                - The other advantage of clean Cassandra restart procedure is saving some startup time.

                - A two-node cluster with nodes known as node01.hostserver.net and node02.hostserver.net :
                                 # nodetool -h node01.hostserver.net disablegossip         
                                 # nodetool -h node01.hostserver.net disablethrift
                                 # nodetool -h node01.hostserver.net drain


                disablegossip :  Because it makes node look like “dead” for other nodes.
                disablethrift   :  Turning it off makes Cassandra unable to accept user’s requests because it 
                                           disables Cassandra’s RPC server.
                drain              :   It flushes column families. In other words – converts Memtables into
                                            immutable SSTables, emptying Commit Log this way


2 comments:

  1. Nice Blog Good information brother...SreeniReddy

    ReplyDelete
  2. You are doing a great job by sharing useful information about Apache Spark course. It is one of the post to read and improve my knowledge in Apache Spark.You can check our Cassandra installation prerequisites, tutorial for more information about Cassandra cluster ubuntu setup.

    ReplyDelete