Running elasticsearch with Tomcat on Jelastic

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone

Here’s one more guest post by our friend Luca Cavanna. Below, he shows you how to deploy elasticsearch to Jelastic cloud. It’s very easy. Just take a look!

You can read the original post here.

In this post I’m gonna write about elasticsearch and a way to deploy it within a Java servlet container as a war file. Since I’m playing around with Jelastic, why not try to deploy it to the cloud?

The deploy procedure is pretty straightforward. The really interesting feature I’ve used is the deploy via a Jelastic Maven node, directly from a github project.

If you are familiar with elasticsearch you know it’s a standalone application. In fact, when you download it you can start it immediately without the need to install any application server or servlet container, since it makes use of Netty underneath. Anyway, if you want to deploy it within a Java servlet container you can use the elasticsearch-transport-wares plugin. The plugin is really simple: a Java servlet that you can configure within your web.xml, which depends on elasticsearch. The servlet starts the elasticsearch instance and forwards requests to its REST interface.

You can create your own maven web project depending on the elasticsearch-transport-wares plugin, add your web.xml to it, and you basically have elasticsearch in war format as a result when you run

mvn package

That’s really handy, and gave me the opportunity to try the maven build node on Jelastic. The github project I created is called elasticsearch-war-example.

The following are the steps to deploy elasticsearch on Jelastic with Tomcat 7, through a maven node which makes use of the github project I created. You can enlarge each image just clicking on it.

  • Let’s create a new environment and choose the desired topology: one Tomcat 7 node, one Maven node

    01-topology-1

  • Let’s link our Maven node to the github project mentioned before.02-add-projectWe need to use the readonly url here, which is git://github.com/javanna/elasticsearch-war-example.git

  • We are now ready to build and deploy our project!

    04-build-and-deploy

  • Here it is! (Just click Open in browser for your environment)

I find it awesome: you just configure the public url of your project, SVN or git, and Jelastic does everything for you! It runs maven and deploys your project on your node. The other good thing is that elasticsearch works out of the box without any extra configuration needed.

Furthermore, it’s great to see that elasticsearch out of the box as NoSQL database is currently the second Jelastic most voted feature. I expect it will be available soon, probably using the original Netty instead of Tomcat as application server.


Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone

One Comment

Leave a Reply

Subscribe to get the latest updates