| Author | 
              Topic: Apache Cassandra  |  
           
         | 
        
          
            
              
                
                	
                  
                    
                      EricJ member offline     |  
                    
                      |   |  
                    
                      
                        
                          
                            | posts: | 
                            50 |  
                          
                            | joined: | 
                            02/22/2007 |  
                          
                            | from: | 
                            CA |  
                         
                       |  
                    | 
                  | 
                
                  
                    
                       |  
                    
                       |  
                    
                      
                        
                          | Apache Cassandra |  
                        
                          Apache Cassandra is an open source distributed NOSQL database designed to handle large amounts of data across many commodity servers, providing high availability with no single point of failure.
  Major features: Large scalability -- achieved by distributed partitions High availability -- achieved by multiple nodes Fault-tolerance   -- achieved by non-master-slave replicas with no single point of failure
 
  |  
                        
                           |  
                        |  
                    
                       |  
                    
                       |  
                    |  
                | 
        
          
            
              
                
                	
                  
                    
                      EricJ member offline     |  
                    
                      |   |  
                    
                      
                        
                          
                            | posts: | 
                            50 |  
                          
                            | joined: | 
                            02/22/2007 |  
                          
                            | from: | 
                            CA |  
                         
                       |  
                    | 
                  | 
                
                  
                    
                       |  
                    
                       |  
                    
                      
                        
                          | How to download and install Cassandra? |  
                        
                           Step 1. Get the Apache Cassandra Go to: http://cassandra.apache.org/download/ Click on: apache-cassandra-2.2.1-bin.tar.gz Use 7-zip to extract files into: C:\temp\apache-cassandra-2.2.1-bin.tar\ Use 7-zip to extract files into: C:\tmp\apache-cassandra-2.2.1-bin\ Move the folder to: C:\downloads\apache-cassandra-2.2.1
 
  Step 2. Set the Cassandra environment
 
          JAVA_HOME = C:\Program Files\Java\jdk1.7.0_25
     CASSANDRA_HOME = C:\downloads\apache-cassandra-2.2.1
               PATH = C:\downloads\apache-cassandra-2.2.1\bin
 
  Step 3. Start server
 
C:\downloads\apache-cassandra-2.2.1\bin>cassandra -f
 
 
  Step 4. Check Server/node status
  How do I know Cassandra is running or not?
 
C:\downloads\apache-cassandra-2.2.1\bin> nodetool status 
Starting NodeTool
Datacenter: datacenter1
========================
Status=Up/Down|/ State=Normal/Leaving/Joining/Moving
--  Address     Load      Tokens  Owns  Host ID        Rack
UN  127.0.0.1   11.41 MB  256      ?    4571f3b-51807  rack1
 
  As it can be seen that the node is "Up" AND "Normal".
 
  Step 5. Stop server
  Simply by Ctrl+C
 
  |  
                        
                           |  
                        |  
                    
                       |  
                    
                       |  
                    |  
                | 
        
          
            
              
                
                	
                  
                    
                      EricJ member offline     |  
                    
                      |   |  
                    
                      
                        
                          
                            | posts: | 
                            50 |  
                          
                            | joined: | 
                            02/22/2007 |  
                          
                            | from: | 
                            CA |  
                         
                       |  
                    | 
                  | 
                
                  
                    
                       |  
                    
                       |  
                    
                      
                        
                          | How to customize/Configure Cassandra |  
                        
                           Open C:\downloads\apache-cassandra-2.2.1\conf\cassandra.yaml:
  Change the following default settings:
 
cluster_name: 'Test Cluster'
listen_address: localhost
rpc_address: localhost
 - seeds: "127.0.0.1"
 
  to:
 
 
cluster_name: 'Cluster101'
listen_address: 10.11.12.13
rpc_address: 10.11.12.13
– seeds: "10.11.12.13"
 
 
 
C:\downloads\apache-cassandra-2.2.1\bin> nodetool status 
Starting NodeTool
Datacenter: datacenter1
========================
Status=Up/Down|/ State=Normal/Leaving/Joining/Moving
--  Address      Load      Tokens  Owns  Host ID        Rack
UN  10.11.12.13  11.41 MB  256      ?    4571f3b-51807  rack1
 
  As it can be seen that this Cassandra is running on 10.11.12.13 which can be accessed from outside.
 
  |  
                        
                           |  
                        |  
                    
                       |  
                    
                       |  
                    |  
                | 
        
          
            
              
                
                	
                  
                    
                      EricJ member offline     |  
                    
                      |   |  
                    
                      
                        
                          
                            | posts: | 
                            50 |  
                          
                            | joined: | 
                            02/22/2007 |  
                          
                            | from: | 
                            CA |  
                         
                       |  
                    | 
                  | 
                
                  
                    
                       |  
                    
                       |  
                    
                      
                        
                          | How to add a new node into existing cluster? |  
                        
                          Setp 1. Download and install Cassandra package unto the new host
  Step 2. Configure the new Cassandra node: Change:
 
cluster_name: 'Test Cluster'
listen_address: localhost
rpc_address: localhost
 - seeds: "127.0.0.1"
  to:
 
cluster_name: 'Clusetr101'  <-- The cluster to join
listen_address: 10.11.12.123
rpc_address: 10.11.12.123
– seeds: "10.11.12.13"      <-- The cluster's seeds to reference
 
  Step 3. Start the new node:
 
C:\downloads\apache-cassandra-2.2.1\bin> cassandra -f
 
  Step 4. Check the status:
 
C:\downloads\apache-cassandra-2.2.1\bin> nodetool status 
Starting NodeTool
Datacenter: datacenter1
========================
Status=Up/Down|/ State=Normal/Leaving/Joining/Moving
--  Address      Load      Tokens  Owns  Host ID        Rack
UN  10.11.12.13  11.51 MB  256      ?    4571f3b-51807  rack1
UN  10.11.12.123  4.32 MB  256      ?    8f1b1c8-2d0d6  rack1
 
  As it can be seen that the cluster is now having 2 nodes: '10.11.12.13' and '10.11.12.123'.
 
  Note: Check your application data's replication factor before adding any new node, for example,  ReplicationFactor=1 -- trouble if any one node is down   ReplicationFactor=2 -- trouble if any two nodes are down
  UnavailableException: Not enough replica available for query at consistency ONE (1 required but only 0 alive)
 
 
 
  |  
                        
                           |  
                        |  
                    
                       |  
                    
                       |  
                    |  
                | 
        
          
            
              
                
                	
                  
                    
                      EricJ member offline     |  
                    
                      |   |  
                    
                      
                        
                          
                            | posts: | 
                            50 |  
                          
                            | joined: | 
                            02/22/2007 |  
                          
                            | from: | 
                            CA |  
                         
                       |  
                    | 
                  | 
                
                  
                    
                       |  
                    
                       |  
                    
                      
                        
                          | Is it possible to set up a multi-node cluster on a single machine |  
                        
                           It seams to be possible based on the following link
  http://stackoverflow.com/questions/22513979/setting-up-cassandra-multi-node-cluster-on-a-single-ubuntu-server
  In summary:  Multiple folders for each instance;  Within each folder's yaml file, set 'localhost' as '127,0,0,1', '127,0,0,2', ..., respectively.  Within each folder's cassandra-env.sh file, set 'JMX_PORT' as 7199, 8199, ..., respectively.
 
  |  
                        
                           |  
                        |  
                    
                       |  
                    
                       |  
                    |  
                |