Saturday, 28 November 2015

Monitoring Apache Storm using JConsole

When you setup a storm cluster in a production environment it is important to monitor performance and resource usage of storm components to make sure that your cluster is working smoothly without issues.

This post will guide you to enable JMX and monitor storm components using JConsole.
Mainly there are two nodes to monitor in a storm cluster
  • Nimbus Node
  • Supervisor Node

Configure Nimbus Node 

Open storm.yaml file located at Nimbus_HOME>/conf/ directory and add below configurations.
  • Here I will be enabling JMX at port 9997. You can specify a preferred port here.
  • Add the host name of nimbus node
nimbus.childopts: "-Xmx1024m -Dcom.sun.management.jxmremote 
-Dcom.sun.management.jmxremote.local.only=false 
-Dcom.sun.management.jmxremote.authenticate=false 
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.port=9997 
-Djava.rmi.server.hostname=192.168.22.231"
Start storm nimbus using below command
./storm nimbus

Configure Supervisor Node

Open storm.yaml file located at Supervisor_HOME>/conf/ directory and add below configurations.
  • Here I will be enabling JMX at port 9998. You can specify a preferred port here.
  • Add the host name of supervisor node
supervisor.childopts: "-Xmx1024m -Dcom.sun.management.jxmremote 
 -Dcom.sun.management.jmxremote.local.only=false 
 -Dcom.sun.management.jmxremote.authenticate=false
 -Dcom.sun.management.jmxremote.ssl=false
 -Dcom.sun.management.jmxremote.port=9998
 -Djava.rmi.server.hostname=192.168.22.232"
Start storm supervisor using below command
./storm supervisor

Using JConsole

Open a terminal and type 'jconsole' to open JConsole. To monitor storm nimbus and supervisor running on remote serves you have to select 'Remote Process' and provide the ip and port of the server.


After you connect to JConsole, you might get a message as below. Click 'Insecure' to connect to the servers.

Upon successful connection to the storm servers, performance and resource usage can be monitored through JConsole.

Saturday, 14 November 2015

Setting up Apache Storm Topology for CEP distributed mode deployment


This post will guide you through the storm part of the configuration for the wso2 Complex Event Processor(CEP) deployment in distributed mode. Please refer: https://docs.wso2.com/display/CLUSTER44x/Clustering+CEP+4.0.0 for the CEP part of the configuration. 

  

Here I will be illustrating a basic storm setup, with three instances running as below diagram.


Their details are as below
  1. Nimbus host - 192.168.22.231
  2. Zookeeper host -192.168.22.235
  3. Supervisor host - 192.168.22.232

Configuring Zookeeper

I will be referring the location of zookeeper folder  as <Zookeeper_HOME>.

1. Download  zookeeper  from here
2. Extract the zookeeper.zip file to 192.168.22.235 instance
3. Go to <Zookeeper_HOME> directory and create a folder called 'data'.
4. Zookeeper needs a configuration file to start. You can create a file called zoo.conf inside <Zookeeper_HOME>/conf directory

tickTime=2000
dataDir=<Zookeeper_HOME>/zookeeper-3.3.6/data
clientPort=2181

5. Open a terminal and go to <Zookeeper_HOME>/bin and enter below command to start zookeeper instance
./zkServer.sh start
6. You can check whether zookeeper start properly using below command
echo ruok | nc localhost 2181
if zookeeper is running properly it will respond with "imok"

Configuring Storm Nimbus

 

I will be referring the location of nimbus folder  as <Nimbus_HOME>.

1. Download apache storm from here
2. Extract the file in to relevant instance
3. Go to <Nimbus_HOME>/conf folder and add below configuration details to storm.yaml file
  • Provide the host name of zookeeper node
storm.zookeeper.servers:
     - "192.168.22.235"
  • Configure zookeeper port (you can use the default port)
storm.zookeeper.port: 2181
  • Create a local directory called "localdir" in <Nimbus_HOME>/bin location, and give the path to the created directory as below. This localdir is used to manage the temporary files of nimbus node. 
storm.local.dir: "/home/ubuntu/storm_cluster/storm_manager/apache-storm-0.9.5/bin/localdir" 
Add below configrations to storm.yaml
nimbus.host : "192.168.22.231"
nimbus.seeds : ["localhost"]
nimbus.thrift.port: 6627
nimbus.thrift.threads: 64
nimbus.thrift.max_buffer_size: 1048576
nimbus.childopts: "-Xmx1024m"
nimbus.task.timeout.secs: 30
nimbus.supervisor.timeout.secs: 60
nimbus.monitor.freq.secs: 10
nimbus.cleanup.inbox.freq.secs: 600
nimbus.inbox.jar.expiration.secs: 3600
nimbus.code.sync.freq.secs: 300
nimbus.task.launch.secs: 120
nimbus.reassign: true
nimbus.file.copy.expiration.secs: 600
nimbus.topology.validator: "backtype.storm.nimbus.DefaultTopologyValidator"
topology.min.replication.count: 1
topology.max.replication.wait.time.sec: 60
nimbus.credential.renewers.freq.secs: 600
4. Go to <Nimbus_HOME>/bin location in terminal and type below command to start nimbus node
./storm nimbus

Configuring Storm Supervisor

 

I will be referring the location of supervisor folder  as <Supervisor_HOME>.

1. Download apache storm from here
2. Extract the file in to relevant instance
3. Go to <Supervisor_HOME>/conf folder and add below configuration details to storm.yaml file
  • Provide the host name of zookeeper node
storm.zookeeper.servers:
     - "192.168.22.235"
  • Configure zookeeper port (you can use the default port)
storm.zookeeper.port: 2181
  • Provide the host name and port of storm nimbus
nimbus.host: "192.168.22.231"

storm.nimbus.port: 6627
  • Create a local directory called "localdir" in <Supervisor_HOME>/bin location, and give the path to the created directory as below. 
storm.local.dir: "/home/ubuntu/storm_supervisor/apache-storm-0.9.5/localdir" 
  • supervisor.slots.ports – this is used to define the number of workers a user wants to create in storm supervisor. For ports are configured here, you can increase the number of ports depending requirements. (ex – if user defined 5 ports, then storm will allocate up to 5 workers to run on the machine )
supervisor.slots.ports:
- 6700
- 6701
- 6702
- 6703
4. Go to <Supervisor_HOME>/bin location in terminal and type below command to start supervisor node
./storm supervisor

Access Storm web interface

1. Go to nimbus host and open a new terminal
2. Go to <Nimbus_HOST>/bin and type below command to start storm UI
./storm ui
3. Open a web browser and go to "http://<nimbus_host_ip>:8080" to access the web interface

  
Now you have successfully configured the storm cluster. Then configure CEP distributed mode cluster by referring to "Distributed mode deployment" section in https://docs.wso2.com/display/CLUSTER44x/Clustering+CEP+4.0.0