This documentation is for older WSO2 products. View documentation for the latest release.
Page Comparison - Configuring Cassandra Cluster (v.32 vs v.33) - Clustering Guide 4.2.0 - WSO2 Documentation

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Add the following configurations to < BAM_HOME>/repository/conf/etc/cassandra.yaml file in the nodes mentioned below.

    Localtab Group
    Localtab
    activetrue
    titleBAM 2.4.1

    In WSO2 BAM 2.4.1, we use Cassandra version 1.2.13. You can generate tokens for the nodes using the script available in http://www.datastax.com/documentation/cassandra/1.2/cassandra/configuration/configGenTokens_c.html Apache Cassandra Documentation - Generating Tokens.

    Localtab
    titleBAM 2.4.0

    In WSO2 BAM 2.4.0, we use Cassandra version 1.1.3. You can generate tokens for the nodes using the script available in http://www.datastax.com/docs/0.8/install/cluster_init#calculating-tokens-for-a-single-data-center

    To node3:

    Code Block
    cluster_name:   Test Cluster
    initial_token:  0 
    seed_provider:
           - seeds: "node3,node4,node5"
    listen_address: node3
    rpc_address: node3
    rpc_port: 9160
    Note

    For Cassandra 1.2.13 (in BAM 2.4.1) the initial_token value cannot be 0. You must enter the value generated by the script.

    to node4:

    Code Block
    cluster_name: Test Cluster
    initial_token: 56713727820156410577229101238628035242
    seed_provider:
           - seeds: "node3,node4,node5"
    listen_address: node4
    rpc_address: node4
    rpc_port: 9160

    to node5:

    Code Block
    cluster_name: Test Cluster
    initial_token: 113427455640312821154458202477256070485
    seed_provider:
           - seeds: "node3,node4,node5"
    listen_address: node5
    rpc_address:    node5
    rpc_port:	    9160
  2. Connect the nodes to Cassandra endpoints.

    Localtab Group
    Localtab
    activetrue
    titleBAM 2.4.1

    This is for Cassandra version 1.2.13. Change the hector-config.xml file in all nodes as follows.

    Code Block
    <Cassandra>
     	<Cluster>
         		<Name>Test Cluster</Name>
         		<Nodes>node3:9160,node4:9160,node5:9160</Nodes>
    		<DefaultPort>9160</DefaultPort>
         		<AutoDiscovery disable="false" delay="1000"/>
     	</Cluster>
    </Cassandra>
    Localtab
    titleBAM 2.4.0

    This is for Cassandra version 1.1.3. Change the cassandra-component.xml file in all nodes as follows.

    Code Block
    <Cassandra>
     	<Cluster>
         		<Name>Test Cluster</Name>
         		<Nodes>node3:9160,node4:9160,node5:9160</Nodes>
    		<DefaultPort>9160</DefaultPort>
         		<AutoDiscovery disable="false" delay="1000"/>
     	</Cluster>
    </Cassandra>
  3. Edit the < BAM_HOME>/repository/conf/advanced/streamdefn.xml file in all nodes as follows. This changes replication factor and read/write consistency levels using which data receivers write data to Cassandra. For example, if you have four Cassandra nodes in the cluster, enter 3 as the value for the <ReplicationFactor> property.

    Code Block
    languagehtml/xml
    <StreamDefinition>
    	<ReplicationFactor>3</ReplicationFactor>
    	<ReadConsistencyLevel>QUORUM</ReadConsistencyLevel>
    	<WriteConsistencyLevel>ONE</WriteConsistencyLevel>
    	<StrategyClass>org.apache.cassandra.locator.SimpleStrategy</StrategyClass>
    </StreamDefinition>
  4. Configure the datasources. A set of JDBC URLs must be added as a comma separated list when load balancing is required.

    Localtab Group
    Localtab
    activetrue
    titleBAM 2.4.1

    This is for Cassandra version 1.2.13. These configurations are done in the  < BAM_HOME>/repository/conf/ datasources/bam-datasources. xml  file for all nodes as follows.

    Code Block
    languagehtml/xml
    <datasource>
    	<name>WSO2BAM_CASSANDRA_DATASOURCE</name>
    	<description>The datasource used for Cassandra data</description>
    	<definition type="RDBMS">
    		<configuration>
    			<url>jdbc:cassandra://node3:9160/EVENT_KS,jdbc:cassandra://node4:9160/EVENT_KS,jdbc:cassandra://node5:9160/EVENT_KS<url> 
    			<username>admin</username>
    			<password>admin</password>
    		</configuration>
    	</definition>
    </datasource>

    Additionally, you need to configure the WSO2BAM_UTIL_DATASOURCE as follows.

    Note

    The externalCassandra property of the should be changed to true if you are connecting to an external Cassandra cluster.

    Code Block
    languagehtml/xml
    <datasource>
            <name>WSO2BAM_UTIL_DATASOURCE</name>
            <description>The datasource used for BAM utilities, such as message store etc..</description>
            <definition type="RDBMS">
                    <configuration>
                            <url>jdbc:cassandra://localhost:9160/BAM_UTIL_KS</url>
                            <username>admin</username>
                            <password>admin</password>
                            <dataSourceProps>
                                  <property name="externalCassandra">false</property>
                            </dataSourceProps>
                    </configuration>
            </definition>
    </datasource>

    If you are using Hive analyzing functions, update the replication factor in the WSO2BAM_HIVE_INCREMENTAL_DATASOURCE as follows.

    Code Block
    languagehtml/xml
    <datasource>
    			<name>WSO2BAM_HIVE_INCREMENTAL_DATASOURCE</name>
    			<definition type="RDBMS">
    				<configuration>
    					<username>admin</username>
    					<password>admin</password>
    					<dataSourceProps>
    						<property name="replicationFactor">1</property>
    						<property name="strategyClass">org.apache.cassandra.locator.SimpleStrategy</property>
    						<property name="readConsistencyLevel">QUORUM</property>
    						<property name="writeConsistencyLevel">QUORUM</property>
    						<property name="keyspaceName">HIVE_INCREMENTAL_KS</property>
    					</dataSourceProps>
    				</configuration>
    			</definition>
    		</datasource>
    Localtab
    titleBAM 2.4.0

    This is for Cassandra version 1.1.3. These configurations are done in the < BAM_HOME>/repository/conf/datasources/ master-datasources.xml in all nodes .

    Code Block
    languagehtml/xml
    <datasource>
    	<name>WSO2BAM_CASSANDRA_DATASOURCE</name>
    	<description>The datasource used for Cassandra data</description>
    	<definition type="RDBMS">
    		<configuration>
    			<url>jdbc:cassandra://node3:9160/EVENT_KS,jdbc:cassandra://node4:9160/EVENT_KS,jdbc:cassandra://node5:9160/EVENT_KS<url>
    			<username>admin</username>
    			<password>admin</password>
    		</configuration>
    	</definition>
    </datasource>

    Additionally, you need to configure the WSO2BAM_UTIL_DATASOURCE .

    Code Block
    languagehtml/xml
    <datasource>
    	<name>WSO2BAM_UTIL_DATASOURCE</name>
    	<description>The datasource used for BAM utilities, such as message store etc..</description>
    	<definition type="RDBMS">
    		<configuration>
    			<url>jdbc:cassandra://localhost:9160/BAM_UTIL_KS</url>
    			<username>admin</username>
    			<password>admin</password>
    		</configuration>
    	</definition>
    </datasource>
  5. Optionally in order to view  the cluster information in the Cassandra Keyspaces List UI, add a file named cassandra-endpoint.xml in  <BAM_HOME>/repository/conf/etc with following configuration. The cassandra-endpoint.xml file is required when deploying the backend Cassandra cluster in a IaaS like AWS. IaaS may not provide real IPs, hence it is necessary to use this configuration file to list the mapped real IPs. 

    Code Block
    languagehtml/xml
    <Cassandra>
     <EndPoints>
        <EndPoint><HostName>name_of_machine1(BAM N1)</HostName></EndPoint>
        <EndPoint><HostName>name_of_machine2(BAM N2)</HostName></EndPoint>
     </EndPoints>
    </Cassandra>

    When configuring an external Cassandra cluster, you must additionally enable clustering in the <BAM_HOME>/repository/conf/axis2/axis2.xml file.

    Code Block
    languagexml
    <clustering class="org.wso2.carbon.core.clustering.hazelcast.HazelcastClusteringAgent" enable="true">
  6. After starting the Cassandra cluster, you can verify the status of the cluster using a NodeTool command. For example, the below command is used to access the Cassandra keyspaces via NodeTool. (Port 9999 is the JMX port.)

    ./nodetool -u admin -pw admin -h localhost -p 9999 cfstats

...