Let us now see how to install Apache Storm framework on your machine. There are three majo steps here −
Use the following command to check whether you have Java already installed on your system.
$ java -version
If Java is already there, then you would see its version number. Else, download the latest version of JDK.
Download the latest version of JDK by using the following link − www.oracle.com
The latest version is JDK 8u 60 and the file is “jdk-8u60-linux-x64.tar.gz”. Download the file on your machine.
Generally files are being downloaded onto the downloads folder. Extract the tar setup using the following commands.
$ cd /go/to/download/path $ tar -zxf jdk-8u60-linux-x64.gz
To make Java available to all users, move the extracted java content to “/usr/local/java” folder.
$ su password: (type password of root user) $ mkdir /opt/jdk $ mv jdk-1.8.0_60 /opt/jdk/
To set path and JAVA_HOME variables, add the following commands to ~/.bashrc file.
export JAVA_HOME =/usr/jdk/jdk-1.8.0_60 export PATH=$PATH:$JAVA_HOME/bin
Now apply all the changes in to the current running system.
$ source ~/.bashrc
Use the following command to change Java alternatives.
update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_60/bin/java 100
Now verify the Java installation using the verification command (java -version) explained in Step 1.
To install ZooKeeper framework on your machine, visit the following link and download the latest version of ZooKeeper http://zookeeper.apache.org/releases.html
As of now, the latest version of ZooKeeper is 3.4.6 (ZooKeeper-3.4.6.tar.gz).
Extract the tar file using the following commands −
$ cd opt/ $ tar -zxf zookeeper-3.4.6.tar.gz $ cd zookeeper-3.4.6 $ mkdir data
Open configuration file named “conf/zoo.cfg” using the command "vi conf/zoo.cfg" and setting all the following parameters as starting point.
$ vi conf/zoo.cfg tickTime=2000 dataDir=/path/to/zookeeper/data clientPort=2181 initLimit=5 syncLimit=2
Once the configuration file has been saved successfully, you can start the ZooKeeper server.
Use the following command to start the ZooKeeper server.
$ bin/zkServer.sh start
After executing this command, you will get a response as follows −
$ JMX enabled by default $ Using config: /Users/../zookeeper-3.4.6/bin/../conf/zoo.cfg $ Starting zookeeper ... STARTED
Use the following command to start the CLI.
$ bin/zkCli.sh
After executing the above command, you will be connected to the ZooKeeper server and get the following response.
Connecting to localhost:2181 ................ ................ ................ Welcome to ZooKeeper! ................ ................ WATCHER:: WatchedEvent state:SyncConnected type: None path:null [zk: localhost:2181(CONNECTED) 0]
After connecting the server and performing all the operations, you can stop the ZooKeeper server by using the following command.
bin/zkServer.sh stop
You have successfully installed Java and ZooKeeper on your machine. Let us now see the steps to install Apache Storm framework.
To install Storm framework on your machine, visit the following link and download the latest version of Storm http://storm.apache.org/downloads.html
As of now, the latest version of Storm is “apache-storm-0.9.5.tar.gz”.
Extract the tar file using the following commands −
$ cd opt/ $ tar -zxf apache-storm-0.9.5.tar.gz $ cd apache-storm-0.9.5 $ mkdir data
The current release of Storm contains a file at “conf/storm.yaml” that configures Storm daemons. Add the following information to that file.
$ vi conf/storm.yaml storm.zookeeper.servers: - "localhost" storm.local.dir: “/path/to/storm/data(any path)” nimbus.host: "localhost" supervisor.slots.ports: - 6700 - 6701 - 6702 - 6703
After applying all the changes, save and return to terminal.
$ bin/storm nimbus
$ bin/storm supervisor
$ bin/storm ui
After starting Storm user interface application, type the URL http://localhost:8080 in your favorite browser and you could see Storm cluster information and its running topology. The page should look similar to the following screenshot.