Standalone Deployment using the MB Cassandra Profile
Cassandra is a highly-scalable, eventually consistent, distributed, structured key-value store which acts as the default, persistence storage for WSO2 Message Broker. The message broker can be configured to connect using the MB Cassandra profile instead of the in-built Cassandra server, which is not recommended when processing large volumes of queues in a typical production environment.
WSO2 recommends the following on an actual, production deployment:
- Using an external server or cluster such as Cassandra profile or Zookeeper profile.
- Have the external server on a separate machine or a dedicated VM instance and point to it from the Message Broker.
This section provides instructions to setup and point a Cassandra server to a standalone WSO2 Message Broker instance.
Configure Message Broker as a Cassandra server
The WSO2 Message Broker should be started as a Cassandra server using profiles and should be configured to listen to all the broker nodes, which require changes in the <MB_HOME>/repository/conf/etc/cassandra.yaml
 file.Â
Download WSO2 MB and unzip it in the server you wish to use as Cassandra.Â
Make changes to theÂ
<MB_HOME>/repository/conf/etc/cassandra.yaml
 file.The '
listen_address
' of the server is "localhost
" by default. Change it to the IP address of the host where the Cassandra server is in. This has to be done to each server. For example, in server 192.168.0.101, it looks as follows.listen_address: 192.168.0.101
Change the RPC address of the server, which is "
localhost
" by default. Change it to the IP address of the host where you have the Cassandra server. You need to change the RPC address of the each server to it's ip address. For example, the server 192.168.0.101 will look as follows.rpc_address: 192.168.0.101
Start the WSO2 Message Broker with the Cassandra profile using the following commands,
In the foreground:
<MB_HOME>/bin$ ./wso2server.sh -Dprofile=cassandraÂ
In the background:
nohup ./bin/wso2server.sh -Dprofile=cassandra > /dev/null 2>&1 &Â
-Dprofile
is the command line argument that specifies which profile is to be used in this instance of MB.
Point WSO2 MB to Cassandra
By default, WSO2 MB uses admin/admin as the username and password. To login as a new user, follow the steps below:
- In the server started above, create a new user with admin privileges.Â
In the
<MB_HOME>/repository/conf/advanced/andes-virtualhosts.xml
file, change the credentials in the entry below with the credentials of the newly created user. For example, if the new username is bob and the password is bob123, the entry is as follows:<class>org.wso2.andes.server.store.CassandraMessageStore</class> <username>bob</username> <password>bob123</password> <cluster>ClusterOne</cluster>
- Modify theÂ
<PRODUCT_HOME>/repository/conf/advanced/andes-config.xml
 file as follows:Change theÂ
<externalCassandraServerRequired>
 tag to true under theÂ<clustering>
 tag to ensure that the server is configured to connect to an external Cassandra server.
- Start the message broker by pointing to the Cassandra server started above.
If your Cassandra server is hosted in the same host in which MB runs, you do not need to make any changes to the connection string in the <MB_HOME>/repository/conf/advanced/andes-virtualhosts.xml
 file. By default it is <connectionString>localhost:9160</connectionString>
. If your Cassandra server is running in a different host, for example the 10.100.3.234 server, you need to change the connection string to <connectionString>10.100.3.234:9160</connectionString>
.
If your Cassandra server is running on a port other than the default port which is 9160, change the connection string by the port offset value defined in the <MB_HOME>/repository/conf/carbon.xml
 file. For example, if the port offset is 2, change the connection string to
<connectionString>localhost:9162</connectionString>
.
<virtualhost> <name>carbon</name> <carbon> <store> <class>org.wso2.andes.server.store.CassandraMessageStore</class> <username>admin</username> <password>admin</password> <cluster>ClusterOne</cluster> <idGenerator>org.wso2.andes.server.cluster.coordination.TimeStampBasedMessageIdGenerator</idGenerator> <connectionString>localhost:9162</connectionString> </store>
Enabling Cassandra specific system logs
When using MB with the Cassandra profile, enabling system logs is important as they are heavily required when analyzing any Cassandra node issue, especially within a cluster. To enable system logs, edit the <MB_HOME>/repository/logs/wso2carbon.log
and <MB_HOME>/repository/logs/cassandra_system.log
 files as follows:
#cassandra specific log4j.logger.org.apache.cassandra=INFO, CASSANDRA_PROFILE log4j.additivity.org.apache.cassandra=false log4j.appender.CASSANDRA_PROFILE=org.apache.log4j.RollingFileAppender log4j.appender.CASSANDRA_PROFILE.maxFileSize=20MB log4j.appender.CASSANDRA_PROFILE.Threshold=INFO log4j.appender.CASSANDRA_PROFILE.layout=org.apache.log4j.PatternLayout log4j.appender.CASSANDRA_PROFILE.layout.ConversionPattern=%c %5p [%t] %d{ISO8601} %F (line %L) %m%n # Edit the next line to point to your cassandra system logs directory log4j.appender.CASSANDRA_PROFILE.File=${carbon.home}/repository/logs/cassandra_system.log