Cassandra Installation

  1. Install Cassandra packages

    # apt-get install openjdk-8-jre-headless
    # apt-get install dsc22
  2. Configure Cassandra

    1. Common Configuration

      Edit the /etc/cassandra/cassandra.yaml file to contain the following:

      # The name of the cluster.
      cluster_name: 'midonet'
      
      ...
      
      # Addresses of hosts that are deemed contact points.
      seed_provider:
          - class_name: org.apache.cassandra.locator.SimpleSeedProvider
            parameters:
                - seeds: "nsdb1,nsdb2,nsdb3"
    2. Node-specific Configuration

      1. NSDB Node 1

        Edit the /etc/cassandra/cassandra.yaml file to contain the following:

        # Address to bind to and tell other Cassandra nodes to connect to.
        listen_address: nsdb1
        
        ...
        
        # The address to bind the Thrift RPC service.
        rpc_address: nsdb1
      2. NSDB Node 2

        Edit the /etc/cassandra/cassandra.yaml file to contain the following:

        # Address to bind to and tell other Cassandra nodes to connect to.
        listen_address: nsdb2
        
        ...
        
        # The address to bind the Thrift RPC service.
        rpc_address: nsdb2
      3. NSDB Node 3

        Edit the /etc/cassandra/cassandra.yaml file to contain the following:

        # Address to bind to and tell other Cassandra nodes to connect to.
        listen_address: nsdb3
        
        ...
        
        # The address to bind the Thrift RPC service.
        rpc_address: nsdb3
  3. Clean existing data and restart Cassandra

    # service cassandra stop
    # rm -rf /var/lib/cassandra/*
    # service cassandra start
  4. Verify Cassandra Operation

    After installation of all nodes has been completed, verify that Cassandra is operating properly.

    [Important]Important

    If Cassandra fails to start and prints a "buffer overflow" error message in its log file, you may try associating 127.0.0.1 with the hostname in etc/hosts (so that hostname -i will show 127.0.0.1). This may solve the Cassandra start problem.

    A basic check can be done by executing the nodetool status command. This will reply with UN (Up / Normal) in the first column if the servers are running in a non-error state:

    $ nodetool --host 127.0.0.1 status
    [...]
    Status=Up/Down
    |/ State=Normal/Leaving/Joining/Moving
    --  Address    Load       Tokens  Owns   Host ID                               Rack
    UN  192.0.2.1  123.45 KB  256     33.3%  11111111-2222-3333-4444-555555555555  rack1
    UN  192.0.2.2  234.56 KB  256     33.3%  22222222-3333-4444-5555-666666666666  rack1
    UN  192.0.2.3  345.67 KB  256     33.4%  33333333-4444-5555-6666-777777777777  rack1
Questions? Discuss on Mailing Lists or Chat.
Found an error? Report a bug.