Code Monkey home page Code Monkey logo

kite-openshift-logging-example's Introduction

Kite OpenShift Logging Example

This module provides an example of logging application events from a webapp to a Kite dataset via Flume (using log4j as the logging API) then querying the dataset using Hive JDBC.

To facilitate rapid development, the webapp runs a Hadoop minicluster that provides all the necessary components.

The example runs in a local Tomcat instance, as well as on Red Hat's OpenShift.

Running Locally

To build the project, type

git clone https://github.com/kite-sdk/kite-openshift-logging-example.git
cd kite-openshift-logging-example
mvn package

This creates a WAR file, which can be used in a Java EE 6 servlet container. For this example we'll start an embedded Tomcat instance using Maven:

mvn tomcat7:run

Navigate to http://localhost:8080/kite-openshift-logging-example, which presents you with a very simple web page for sending messages.

The message events are sent to the Flume agent over a socket, and the agent writes the events to the Kite dataset sink.

Send a few messages using the web form. Then wait 30 seconds for the sink to roll the file so that the data is visible. This page (which uses a Hive JDBC connection to run a query), shows all the events in the dataset: http://localhost:8080/kite-openshift-logging-example/all_events.jsp.

Running on OpenShift

Before going any further you need to open an OpenShift account and install the client tools.

Note: You will need to have an account that allows you to run large gear sizes (this is not possible with the free account).

On your local machine run the following commands to create a new application called 'logging' running on OpenShift online:

rhc app create logging jbossews-2.0 -g large

This will create a plain webapp (its URL will be printed to the console). To replace it with the Kite webapp, type the following:

cd logging
git remote add upstream -m master git://github.com/kite-sdk/kite-openshift-logging-example.git
git pull -s recursive -X theirs upstream master
git push origin master

The push will do a full build and deploy, which will take a few minutes. When it’s done, the home page will be available at http://logging-[your-domain].rhcloud.com/, which is the URL that was printed to the console when you ran the the rhc app create command. You can also access your OpenShift applications at https://openshift.redhat.com/app/console/applications.

Note: You can see the webapp container logs if you log into the OpenShift machine (details on the OpenShift application page, under 'Remote Access') and type:

tail -f app-root/logs/jbossews.log

The page at http://logging-[your-domain].rhcloud.com/ presents you with a very simple web page for sending messages.

The message events are sent to the Flume agent over a socket, and the agent writes the events to the Kite dataset sink.

Send a few messages using the web form. Then wait 30 seconds for the sink to roll the file so that the data is visible. This page (which uses a Hive JDBC connection to run a query), shows all the events in the dataset: http://logging-[your-domain].rhcloud.com/all_events.jsp

Note: By default the application only has 1GB of disk space, which is not enough if you leave the application running for more than a few minutes. You can increase the amount of disk space via the web console, or by running:

rhc cartridge storage jbossews-2.0 -a logging --set 4

When you've finished with the application, delete it permanently with

rhc app delete logging

kite-openshift-logging-example's People

Contributors

tomwhite avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

isabella232

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.