DataStax Developer Blog

Running OpsCenter With a Local Development Cluster

By Nick Bailey -  September 7, 2012 | 0 Comments

OpsCenter is a graphical tool for managing your Apache Cassandra and DataStax Enterprise clusters. While it is useful in monitoring your production Cassandra clusters, a lot of time is spent working with a development cluster when you are building an application. Running OpsCenter against a single node development cluster is straightforward with the current documentation. However, if you are running a multi-node cluster on one machine, OpsCenter requires some additional configuration.

In this post we’ll go over how to get OpsCenter to run with a local multi-node cluster. First though, I’ll briefly introduce CCM, a tool that makes setting up a multi-node Cassandra cluster on your development machine extremely easy.

CCM

For in depth information about CCM, see the github page. For now we’ll go over the simple steps for installing and then running a simple 3 node cluster.

Installation

> git clone https://github.com/pcmanus/ccm.git
Cloning into ccm...
...
> cd ccm/
> sudo ./setup.py install
running install
running build
...
ccm>

Now that CCM is installed we can move on to starting a cluster.

Starting a Cluster

Depending on your development environment you may or may not to need to run the next steps. I’m running these steps on OSX, which by default won’t allow binding to local interfaces besides 127.0.0.1. Since we are going to start a 3 node cluster, we need to tell the system to let us bind to 127.0.0.2 and 127.0.0.3

> sudo ifconfig lo0 alias 127.0.0.2 up
> sudo ifconfig lo0 alias 127.0.0.3 up

Now that thats done, we can tell ccm to initialize a and start a 3 node Cassandra cluster for us.

ccm> ccm create local-cluster -v 1.0.11 -n 3
...
ccm> ccm start
ccm> ccm status
node1: UP
node3: UP
node2: UP

At this point you have a 3 node cassandra cluster all running locally. CCM provides shortcuts for doing things like running ‘nodetool ring’, but if you already have a copy of Cassandra, the built in tools will work as well.

> ccm node1 ring
Address DC Rack Status State Load Owns Token
113427455640312821154458202477256070484
127.0.0.1 datacenter1 rack1 Up Normal 6.7 KB 33.33% 0
127.0.0.2 datacenter1 rack1 Up Normal 6.7 KB 33.33% 56713727820156410577229101238628035242
127.0.0.3 datacenter1 rack1 Up Normal 6.7 KB 33.33% 113427455640312821154458202477256070484

OpsCenter

Installing OpsCenter

Now that we have a cluster running locally, we can install OpsCenter. I’ll go through the steps for installing OpsCenter on OSX, but you can find the instructions for other operating systems here. I’m assuming you’ve already downloaded the latest version of OpsCenter. You can get either the community or enterprise edition here.

> tar -xzf opscenter-2.1.2.tar.gz
> cd opscenter-2.1.2/
> bin/opscenter -f

That will start up the OpsCenter in the foreground. At this point you can point your browser at http://localhost:8888/ to access the OpsCenter UI. It will ask you for the ip of at least one node, the jmx port, and thrift port for your cluster. You can enter 127.0.0.1 for the ip and leave the other options at the default. Click ‘Add Cluster’ to add your cluster.

Because all 3 nodes can’t use the same JMX port, we now need to remove the JMX port option from the configuration OpsCenter just stored. Instead we will tell each agent individually which port to use. First stop the OpsCenter process with CTRL-C and open the ‘conf/clusters/local_cluster.conf’ file. You will see the following lines:

[jmx]
username =
password =
port = 7199

Simply remove the ‘port = 7199′ line from the file and save it. Now you can start OpsCenter back up.

Installing Agents

Next, we’ll follow a slightly modified version of the instructions for installing agents manually. We need to modify the instructions slightly since we are installing on a single node.

The agent files for OpsCenter are located in the ‘agent.tar.gz’ file. Since we are going to need 3 agents, we will extract that directory to three different locations. Now we’ll configure and start the first agent.

> cd agent1/agent/
> bin/setup 127.0.0.1
> echo '
agent_rpc_interface: 127.0.0.1
jmx_host: 127.0.0.1
jmx_port: 7100
' >> conf/address.yaml
> bin/opscenter-agent
> cd ../../

And the second agent:

> cd agent2/agent/
> bin/setup 127.0.0.1
> echo '
agent_rpc_interface: 127.0.0.2
jmx_host: 127.0.0.2
jmx_port: 7200
' >> conf/address.yaml
> bin/opscenter-agent
> cd ../../

And finally the last agent

> cd agent3/agent/
> bin/setup 127.0.0.1
> echo '
agent_rpc_interface: 127.0.0.3
jmx_host: 127.0.0.3
jmx_port: 7300
' >> conf/address.yaml
> bin/opscenter-agent
> cd ../../

At this point you’ll now have a local 3 node Cassandra cluster as well as a working OpsCenter install for monitoring that cluster.



Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>