Jump to: navigation, search

Deploying a Cassandra Cluster Node for a Multiple Data Center

Linux

Installation

  1. Download version 3.11.2 or higher from the Cassandra stream.
  2. Unpack the archive into the installation directory, for example:
  3. cd /genesys
    tar xzf apache-cassandra-3.11.2 x-bin.tar.gz
    


Important
Do not use paths with spaces when installing Cassandra.

Configuration

  1. Go to the directory where you installed your Cassandra node.
  2. Edit conf/cassandra.yaml, using the following custom values:
    • cluster_name—Cluster name without spaces; for example ucs9cassandracluster
    • seeds—Comma-separated list of fully qualified domain names (FQDN) or IP addresses of one or more Cassandra nodes from different data centers
    Note: This value must be the same for all nodes. Here are two examples:
    192.168.0.1,192.168.0.3, 172.25.140.3
    host1.mydomain.com, host2.mydomain.com, host7.yourdomain.com
    • storage_port7000 (default value)
    • listen_address—Current node IP address (it is not possible to use a host name)
    • native_transport_port9042 (default value)
    • rpc_address—Current node ip address (it is not possible to use a host name)
    • rpc_port9160 (default value)
    • endpoint_snitchGossipingPropertyFileSnitch
    • write_request_timeout_in_ms30000 (increased from default)
    • batch_size_fail_threshold_in_kb16384 (increased from default)
  3. Edit the conf/cassandra-rackdc.properties for each Cassandra node from each data center. Use the following as a guide:
  4. dc=''<Data Center name>''
    rack=''<RACK ID>''
    

    For example, for data center 1:

    dc=DC1
    rack=RAC1
    

    and for data center 2:

    dc=DC2
    rack=RAC1
    
  5. Edit the conf/cassandra-topology.properties for each Cassandra node in the data center. Use the following as a guide:
  6. IPs@forDC1seeds=<Data Center name1><RACK ID>
    IPs@forDC2seeds=<Data Center name2><RACK ID>
    

    For example:

    #DC1
    192.168.0.1=DC1:RAC1
    192.168.0.3=DC1:RAC1
    

    and

    #DC2
    172.25.140.3=DC2:RAC1
    

    Note: Genesys recommends that you use the same rack ID for all nodes in your data center. For more information about cassandra-rackdc.properties, refer to https://docs.datastax.com/en/cassandra/3.0/cassandra/architecture/archsnitchGossipPF.html.

  7. In order to install Elasticsearch Cassandra plugin, copy all jar files from UCS installation directory/lib4cassandra to Cassandra installation directory/lib:

Setting Up a Cassandra Service

  1. Create the /etc/init.d/cassandra startup script.
  2. Edit the contents of the file:
  3. #!/bin/sh
    #
    # chkconfig: - 80 45
    # description: Starts and stops Cassandra
    # update daemon path to point to the cassandra executable
    DAEMON=<Cassandra_installation_dir>/bin/cassandra
    start() {
            echo -n "Starting Cassandra... "
            $DAEMON -p /var/run/cassandra.pid
            echo "OK"
            return 0
    }
    stop() {
            echo -n "Stopping Cassandra... "
            kill $(cat /var/run/cassandra.pid)
            echo "OK"
            return 0
    }
    case "$1" in
      start)
            start
            ;;
      stop)
            stop
            ;;
      restart)
            stop
            start
            ;;
      *)
            echo $"Usage: $0 {start|stop|restart}"
            exit 1
    esac
    exit $?
  1. Make the file executable: sudo chmod +x /etc/init.d/cassandra
  2. Add the new service to the list: sudo chkconfig --add cassandra
  3. Now you can manage the service from the command line:
  • sudo /etc/init.d/cassandra start
  • sudo /etc/init.d/cassandra stop
  1. Configure the service to be started automatically together with the VM: sudo chkconfig --level 2345 cassandra on

Windows

Installation

  1. Download version 3.11.2 or higher from the Cassandra stream.
  2. Unpack the archive into a path without spaces.

Configuration

  1. Go to the directory where you installed your Cassandra node.
  2. Edit cassandra.yaml, using the following custom values:
    • cluster_name—Cluster name without spaces, for example; UCS_Cassandra_Cluster
    • seeds—Comma-separated list of fully qualified domain names (FQDN) or IP addresses of one or more Cassandra nodes from different data centers. Note: This value must be the same for all nodes. Here are two examples:
      • 192.168.0.1,192.168.0.3, 172.25.140.3
      • host1.mydomain.com, host2.mydomain.com, host7.yourdomain.com
    • storage_port7000 (default value)
    • listen_address—Current node IP address (it is not possible to use a host name)
    • native_transport_port9042 (default value)
    • rpc_address—Current node IP address (it is not possible to use a host name)
    • rpc_port: 9160 (default value)
    • endpoint_snitchGossipingPropertyFileSnitch
    • write_request_timeout_in_ms30000 (increased from default)
    • batch_size_fail_threshold_in_kb16384 (increased from default)
  1. Edit the conf/cassandra-rackdc.properties for each Cassandra node from each data center. Use the following as a guide:
  2. dc=''<Data Center name>''
    rack=''<RACK ID>''
    

    For example, for data center 1:

    dc=DC1
    rack=RAC1
    

    and for data center 2:

    dc=DC2
    rack=RAC1
    
  3. Edit the conf/cassandra-topology.properties for each Cassandra node in the data center. Use the following as a guide:
  4. IPs@forDC1seeds=<Data Center name1><RACK ID>
    IPs@forDC2seeds=<Data Center name2><RACK ID>
    

    For example:

    #DC1
    192.168.0.1=DC1:RAC1
    192.168.0.3=DC1:RAC1
    

    and

    #DC2
    172.25.140.3=DC2:RAC1
    

    Note: Genesys recommends that you use the same rack ID for all nodes in your data center. For more information about cassandra-rackdc.properties, refer to https://docs.datastax.com/en/cassandra/3.0/cassandra/architecture/archsnitchGossipPF.html.

  5. In order to install Elasticsearch Cassandra plugin, copy all jar files from UCS installation directory\lib4cassandra to Cassandra installation directory\lib.
  6. Start Cassandra.

Feedback

Comment on this article:

blog comments powered by Disqus
This page was last modified on May 18, 2018, at 06:55.