Thursday, May 26, 2011

Try On Oozie

While writing this post, I am assuming that you have
  • Installed oozie on your linux machine
  • Installed hadoop-0.20.1+
If not, I have already mentioned the Oozie Installation in my previous post.

Steps to get an Oozie app running


Having started hadoop and the oozie server, follow the steps below to get an sample oozie application running :
  • In case Oozie installation has been done using debian packag, you can find the oozie examples tar.gz at /etc/oozie/doc/oozie else it can be located in the oozie setup folder.
  • Extract this and the obtained /examples folder would contain apps, input-data and src sub-directories.
  • Add the following properties to the conf/core-site.xml of your hadoop setup

 <property>
     <name>hadoop.proxyuser.oozie.hosts</name>                                               
      <value>*</value>
 </property>
       
 <property>
      <name>hadoop.proxyuser.oozie.groups</name>
      <value>*</value>
 </property>

  • In order to run any of the apps, remember to edit the port nos. of jobtracker and the namenode in the job.properties file of the app depending upon your hadoop configuration
              JobTracker port no. is set in: /conf/mapred-site.xml
              and NameNode port no. is set in : /conf/core-site.xml

Accordingly replace the 'JTPortNo' and 'NNPortNo' in job.properties as below :

oozie.wf.application.path=hdfs://localhost:NNPortNo/path_to_examples/apps/map-reduce
jobTracker=localhost:JTPortNo
nameNode=hdfs://localhost:NNPortNo
queueName=default
outputDir=map-reduce

  • Now its time to copy the examples dir to hdfs, but if there is already an examples dir in hdfs you must delete it else the files are not copied. Here's the command :
/path_to_hadoopdir/bin/hadoop fs -put /path_to_egdir/examples examples              

For a confirmation, you can check if the copy has been successful at
        
                     http://localhost:50070
  • Run the following command to get the example running
In case of debian package used for installation of Oozie

/usr/lib/oozie/bin/oozie job -oozie http://localhost:11000/oozie -config /path_to_egdir/examples/apps/map-reduce/job.properties -run


                                                                           else


/path_to_oozie/bin/oozie job -oozie http://localhost:11000/oozie -config  /path_to_egdir/examples/apps/map-reduce/job.properties -run


Here an important note is that you need to specify the local system path to job.properties and not that of hdfs in the command.
If the application has started off successfully, a job id would be returned in response to the above command, something like this :
                    job: 14-20090525161321-oozie-tucu 
  • If you have the web console installed, you can view the status of the job on 
                  http://localhost:11000/oozie

else the following command will do

/path_to_oozie/bin/oozie job -oozie http://localhost:11000/oozie -info 14-20090525161321-oozie-tucu                                                                               


That's it … You can apply the same steps for running any of the documented examples. Well, if the things have not worked as smoothly as they seem, my next post on 'Errors while installation and running Oozie' could be an answer.

Oozie Installation


This post is an attempt to provide you with a very consolidated list of commands that are required to install Oozie, since the documentation involves many optional steps and requires you to refine lot many links to get to correct procedure.
As mentioned in my previous post, Oozie has two flavors, one is the Cloudera distribution and the other is the Yahoo distribution. This post is an attempt to state Cloudera Oozie's installation using two methods :
  • Installing Oozie debian package
  • Installing Oozie tarball 

Installing Cloudera's Oozie

Prerequisites

  • A Unix-like system (tested on Centos 5.5, Ubuntu 9.10+, SUSE Linux Enterprise Server 11, OS X 10.6)
  • Java 1.6+ (tested with JRE 1.6.0_20)
  • A Unix user and group named oozie on your machine

Installing Oozie debian package

The Oozie debian package for installing Oozie has separate packages for Oozie server(oozie) and the client(oozie-client). 

  1. Download them from the following link :
  
  2. Before proceeding further, it is required to install the Cloudera's Yum, for which you need to add a repository by creating a new file (a normal text file named cloudera.list) /etc/apt/sources.list.d/cloudera.list with the following two lines of content.
  • deb http://archive.cloudera.com/debian <RELEASE>-cdh3 contrib
  • deb-src http://archive.cloudera.com/debian <RELEASE>-cdh3 contrib
where <RELEASE> is to be replaced by the output of the command lsb_release -c.
  
  3. Run the following command
  • $ sudo apt-get update
  4. After this simply install the oozie server and client using the debian packages.  
  5. Start the oozie server using
  • $ sudo -u oozie /usr/lib/oozie/bin/oozie-start.sh
  6. Stop the oozie server
  • $ sudo -u oozie /usr/lib/oozie/bin/oozie-stop.sh

Installing Oozie Tarball


  1. Download the Oozie tarball(ver Oozie 2.3.0+31.2) from :
  
  2. Unpack the tarball in the appropriate directory. For example: 
  • $ (cd /home/abc/ && sudo tar -zxvf <PATH_TO_OOZIE_TAR_GZ>)
  
  3. Change ownership of the Oozie installation to oozie:oozie:
  • $ sudo chown -R oozie:oozie /home/abc/oozie-2.3.0+31.2
This installs both the client and the server and the directory contains all the necessary client and server files. 
  
  4. Start the oozie server
  • $ sudo -u oozie /home/abc/oozie-*/bin/oozie-start.sh
  5. Stop the oozie server
  • $ sudo -u oozie /home/abc/oozie-*/bin/oozie-stop.sh

    Oozie Web Console

    Though it is optional to use the web console, and there are command line utilities that can be used instead, I would recommend installing it as it presents a very clear picture of the running oozie jobs and is very easy to install.

      1. Download the ExtJS library from
      
      2. Place it in a convinient location and add to Oozie through this command
    • $ sudo -u oozie /usr/lib/oozie/bin/oozie-setup.sh -extjs /path_to_ExtJS/ext-2.2.z
                              or 
    • $ sudo -u oozie /home/abc/oozie-*/bin/oozie-setup.sh -extjs /path_to_ExtJS/ext-2.2.zip
        
        3. Having done this, after starting the oozie server as described above , you can view the console at :
      • http://localhost:11000/oozie

      That's all about installing Oozie, my next post would be on how to run an oozie sample application.

      Tuesday, May 10, 2011

      Introduction to Oozie

      What is Oozie ?

      “Oozie is a server-based workflow engine specialized in running workflow jobs with actions that execute Hadoop jobs, such as MapReduce, Pig, Hive, Sqoop, HDFS operations, and sub-workflows” as stated by 'cloudera.com'. The term 'OOZIE' literally is a Burmese term for an elephant rider/controller more commonly known by the Indian term 'Mahout'. It is a very accurate mapping as this workflow engine is also a controller to all the hadoop jobs that are a part of its workflow.

      Oozie Flavors 

      Oozie has got two flavors
      • Cloudera distribution for oozie
      • Yahoo distribution for oozie
      and you can use it in different combinations with Apache/Cloudera Hadoop as below :
      • Cloudera oozie + Cloudera Hadoop
      • Cloudera oozie + Apache Hadoop
      • Yahoo oozie + Cloudera Hadoop
      • Yahoo oozie + Apache Hadoop
      The first combination works just fine with a very feasible installation using debian packages. One of the major difference between the two distributions is that Yahoo distribution of oozie has no support for running hive actions but certainly patches have been added that add support for the same, whereas Cloudera distribution of oozie supports running hive and sqoop jobs and also has a sample workflow applications for them included in its set of examples.

      Need Assessment of Oozie 

      Lets start it with some stats, according to the Oozie presentation during Hadoop Summit in June – there are over 4800+ workflow applications deployed within Yahoo! at the moment, with largest workflow containing 2000 actions.
      It is very difficult to manage and run such workflows repeatedly without having a workflow engine that can automate these jobs. Not only this, in many of our small applications too we need a controller which can smoothly execute a set of given jobs and notify only in conditions where there is need of user intervention or some failure. If these jobs are Hadoop jobs, Oozie is the best choice one can make.

      Oozie Highlights 

      • Allows to run a series of map-reduce, hive, pig, java & scripts actions a single workflow job
      • Allows regular scheduling of workflow jobs
      • Uses an XML file for writing workflows and Direct Acyclic Graph for expressing them
      • It supports: mapreduce (java, streaming, pipes), pig, java, filesystem, ssh, hive, sqoop, sub-workflow
      • Supports variables and functions for parameterization of workflows
      • Supports decision nodes allowing the workflow to make decisions
      • Oozie interval job scheduling is time & input-data-dependent based
      • It runs as server (multi user, multi workflows)
      • Oozie, actions run in the Hadoop cluster as the user that submitted the workflow
      • Oozie uses a SQL/Derby database, a workflow state is in memory only when doing a state transition
      • In case of fail-overs, running workflows continue running from their current state
      Hope this post gave you some idea of what exactly Oozie is all about. In my next post, I'll be mentioning the steps to install oozie and getting started with it.


      Tuesday, March 8, 2011

      Building an S4 Application

      Having gathered some knowledge about 'how to run an S4 app' in my previous post, its time we move up to building applications of our own. Before we kick off this task, a precise note on the structure of a basic S4 application is required.

      Structure of an S4 application 



       To start, create a similar directory structure in your s4image directory's example folder. Assuming your application name 'appName', we would  take up each segment of the app one by one.
      .java files

      The most elementary S4 application also requires 2 java classes :
      1. Bean class :This class declares variables that represent the event of its type. In your application, you can start with a Login bean having two string variables 'id' and 'pwd' and their getter and setter methods.

      2. Receiver class for the Bean :It is significant to point out the action to be taken when an event is fired. For each distinct event, represented by a bean class, there has to be a receiver class that describes how to process the event it is meant for, in its processEvent() function.

      public void processEvent(Login data) {
      //handle the Login object
      }
      public String getId() {
      return this.getClass().getName();
      }

      appName_conf.xml

      Precisely, this xml defines a set of beans and the stream and the keys for each receiver classes, on which they would operate. Each bean is allocated an id of your choice and the class it represents.
      In this example the xml could be as :

      <bean id="loginDataCatcher" class="io.s4.example.appName.LoginReceiverPE">
          <property name="keys">
            <list>
              <value>LoginData *</value>
            </list>
          </property> 

      </bean>

      assembly.xml

      This xml is common to all the applications and you only need to replace the 'fileset include' with appName.xml which is indicating the resource directory as follows :

      <fileSet>
            <directory>${project.basedir}/src/main/resources</directory>
            <outputDirectory />
            <includes>
          <include>appName_conf.xml</include>
            </includes>
       </fileSet>

      pom.xml

      Here you only need to replace  <artifactId></artifactId> and <name></name> tag values with appName

      <modelVersion>4.0.0</modelVersion>
      <groupId>io.s4.examples</groupId>
      <artifactId>appName</artifactId>
      <packaging>jar</packaging>
      <version>0.0.0.1</version>
      <name>appName</name>

      Once you are done with these files, you can create an input (.txt) file and in case of any doubt you can download the sample application. Though commands for 'Running an S4 app' have been listed in my previous post, here's an apprise listing :
      •     cd /path _to_s4image_dir/examples/appName
      •     mvn assembly:assembly install
       will create a target folder in appName
      •     cd /path _to_s4image_dir/core/target/s4_apps/
      •     tar xzf /path _to_s4image_dir/examples/appName/target/appName-*.tar.gz
      •     cd /path _to_s4image_dir/core/target/bin
      •     ./s4_start.sh &
      •     head -10 /path _input_file_location/xyz.txt | \       ./generate_load.sh -x -r 2 -u/path _to_s4image_dir/core/target/s4_apps/appName/lib/appName-0.0.0.1.jar -
      Hope this helped you somehow ! Any suggestions would be highly appreciated.  


      Monday, February 28, 2011

      Running an S4 Application

      As mentioned in my previous post, this post is an attempt to help you run the sample S4 appilcations open sourced by Yahoo.
       
      Prerequisites
      • Linux (tried on ubuntu 9.04)
      • Java 1.6
      • Maven
      • S4 Communication Layer
      • S4 Core

      Setting up the S4 environment

      In order to build an S4 application of your own, you need to setup the S4 core , comm and examples(optional) directories as follows:

      1. Create a directory /S4/s4image at some location of your choice (assuming  /home/abc)
      •  mkdir S4;cd S4/;mkdir s4image;cd s4image/
      2.   In this s4image directory, we can either download the S4 core tarball or build S4 core ourself. Going by the latter option,
      •     git clone https://github.com/s4/core.git
      •     git clone https://github.com/s4/comm.git
         You can check core and comm folders created in the s4image directory.

      3. Building the comm and core folder
      •     cd comm
      •      mvn install:install-file -DgroupId=org.apache.hadoop -DartifactId=zookeeper -Dversion=3.1.1 -Dpackaging=jar -Dfile=lib/zookeeper-3.1.1.jar
      •     mvn install
      •     cd ../core
      •      mvn install:install-file -DgroupId=com.esotericsoftware -DartifactId=kryo -Dversion=1.01 -Dpackaging=jar -Dfile=lib/kryo-1.01.jar
      •     mvn install:install-file -DgroupId=com.esotericsoftware -DartifactId=reflectasm -Dversion=0.8 -Dpackaging=jar -Dfile=lib/reflectasm-0.8.jar
      •      mvn install:install-file -DgroupId=com.esotericsoftware -DartifactId=minlog -Dversion=1.2 -Dpackaging=jar -Dfile=lib/minlog-1.2.jar
      •     mvn assembly:assembly install
      After successfully running these, you can locate the /core/target/s4_core-0.3.0.0.tar.gz
      •     cd target/
      •     tar xzf s4_core-*.tar.gz
      4. Building the examples folder
      •     cd /home/abc/S4/s4image
      •     git clone https://github.com/s4/examples.git
      An examples directory should have been created along with comm and core.

      Running the examples

      To have an understanding of the structure of an S4 app, running a few examples is recommended. For a start, try to run the speech01 example:
      •     cd /home/abc/S4/s4image/examples/speech01
      •     mvn assembly:assembly install
       will create a target folder in speech01
      •     cd /home/abc/S4/s4image/core/target/s4_apps/
      •     tar xzf /home/abc/S4/s4image/examples/speech01/target/speech01-*.tar.gz
      •     cd /home/abc/S4/s4image/core/target/bin
      •     ./s4_start.sh &
      •     head -10 /home/abc/S4/s4image/examples/testinput/speeches.txt | \       ./generate_load.sh -x -r 2 -u /home/abc/S4/s4image/core/target/s4_apps/speech01/lib/speech01-0.0.0.1.jar -

      In my next post, would be on "how to build your own S4 application". Any suggestions would be highly appreciated.




      Sunday, February 27, 2011

      An Introduction to S4

      What is S4 ?
      S4 is a general-purpose, distributed, scalable, partially fault-tolerant, pluggable platform that allows programmers to easily develop applications for processing continuous unbounded streams of data, as described by S4.io. 

      Need Assessment of S4
      The emergence of commercial search engines and new applications such as real-time
      search, high frequency trading, and social networks demands a streaming paradigm that can process the unbounded stream of events that flows into the system. Since the Map Reduce systems operate on static data by scheduling batch jobs, the renowned Hadoop platform delivers its best for batch processing systems. Therefore there is a clear need for a highly scalable stream computing solution that can operate at high data rates and process massive amounts of data.
      Yahoo's open source product S4 (Simple Scalable Streaming System) is one such solution.

      Digging a bit more into S4
      S4 affirms to support many features and substantiates itself as :
      • Decentralized : All nodes of an S4 cluster are symmetric and there is no single point of failure.
      • Scalable : Throughput increases linearly with number of nodes.
      • Partially fault-tolerant : Fault tolerant because
      - cluster management system reroutes event from failed to other servers 
      and Partially because
      - state of the Processing Elements running on the failed server might be lost in case persistent
      storage has not been used.
      • Elastic : computing load automatically gets distributed
      • Expandable : a simple API has been provided
      •Object Oriented : POJOs used for internode communication.
        
      Basic Components of S4 

      • Processing Element (PE)
      Basic computational unit which can send and receive messages called Events. Upon receiving any
      event a PE can :
      - emit one or more events which may be consumed by other PEs
      - publish results, possibly to an external data store or consume.

      • Processing Node (PN)
      The logical hosts to PEs which can :
      - Listen to events
      - Dispatch events with the help of the communication layer
      - Emit output events
      - and execute operations on the incoming events.

      • Adapter
      The events being fed to the S4 cluster for processing need to be translated into S4
      compatible events and similarly the events received from an S4 cluster have to be made
      understandable to the client. The Client I/O Stub solves this purpose whereas the
      Adapter injects events into the S4 cluster and receives from it via the Communication
      Layer.

      Existing solutions and S4
      The S4 design is not new in the industry as it implements the Actor framework. Erlang
      and Scala already have a similar implementation. But the power of mixing in Zookeeper
      and a pluggeable architecture can set S4 apart from previous frameworks.
      At the moment Yahoo has open sources a handful set of applications. My next post would be an attempt to help you out in creating an S4 application.

      Monday, November 22, 2010

      Build a Web Application In Erlang


      Hiii .... I am here with an intent to help you make a web application that uses :
      •  Erlang as the programming language
      •  Mnesia , a distributed , soft-real time dbms written in Erlang 
      •  Yaws , an asynchronous HTTP 1.1 web server written in Erlang and
      •  Erlyweb , a component-oriented web development framework again written entirely in Erlang
      Isn't that amazing .... Well ... lets start with the installations first.
      I assure you , its not gonna be messy at all to setup all these on your system and it would be fun to see the real power of erlang in each of them.Assuming that your working on Ubuntu our prerequisites would be :
      • Erlang SDK
      • Yaws and 
      • ErlyWeb
      setup on the system.
      Our very first requirement , the erlang SDK can be installed directly from your Synaptic Package Manager.
      For installing YAWS , download and install from here  http://yaws.hyber.org/ and the latest ErlyWeb archive can be obtained from http://code.google.com/p/erlyweb/downloads/list?q=label:Type-Archive Just need to unzip it, and put the zip file's contents in your Erlang code path i.e.  "/usr/local/lib/erlang/lib".

      Now , its time to create an application in ErlyWeb that we would be using in developing our Web Application.
      Make a folder named 'appfolder'(or something of your choice)
      Start your YAWS shell in the interactive mode using (sudo yaws -i) and type :

      erlyweb:create_app("myapp", "/path_to_your_folder/appfolder").
      Edit your yaws.conf file by adding a server configuration with the following docroot, appmod, and opaque directives as below :

      docroot = /path_to_your_folder/appfolder/myapp/www
      appmods = <"/myapp", erlyweb>
      appname = myapp
      So now we have built an application named 'myapp'and we can continue by typing "yaws:restart()." in the yaws shell.
      To check , open your browser and point it at http://localhost:8000/myapp( your host/port may be different, depending on your Yaws configuration). You should see a page displaying the following :


      Welcome to 'myapp', your new ErlyWeb app.
      Let the Erlang hacking begin!


      Having things setup, I’ll brief u about the application we would develop here.

      Its gonna be a web app containing a login page and a home page from where onwards you can extend it as per ur needs. For our understanding of the database operations we would use a login table storing the userid and the password and for connecting it through the yaws server we would need one .yaws file that would parse  the incoming request from the html page and forward it to the required Action.

      A simple Login.html page code is here. Paste this html page into the www folder of the erlyweb app


      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

      <html xmlns="http://www.w3.org/1999/xhtml">

      <head>

      <title>Login Page</title>

      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

      <link href="css/style.css" rel="stylesheet" type="text/css" />

      <script language="JavaScript" type="text/javascript">


      function check()

      {
         
      var uid=document.Loginform.uid.value.length
         
      var pwd=document.Loginform.pwd.value.length
         
      if(uid==0)
      {
        
      alert('Please enter userid')
        
      return false;
      }
         
      if(pwd==0)
      {
        
      alert('Please enter Password')
        
      return false;
      }
         
      if(pwd<6)
      {
        
      alert('Password may not less than 6 characters')
        
      return false;
      }
         
      return true;

      }


      function verifyLogin()

      {
         
      var returnedval=check();
         
      if(returnedval==true)
      {
        
      uid=document.Loginform.uid.value;
        
      pwd=document.Loginform.pwd.value;
        
      if (window.XMLHttpRequest)
              
      {// code for IE7+, Firefox, Chrome, Opera, Safari
       
      xmlhttp=new XMLHttpRequest();
              
      }
        
      else
          
      {// code for IE6, IE5
               
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
              
      }
        
      xmlhttp.open("GET","controller.yaws?action=loginaction&username="+uid+"&pwd="+pwd,true);
      xmlhttp.onreadystatechange=function()
           
       {
                
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
         
      {
        
      a=xmlhttp.responseText;
      if(a.trim()=="success")
      window.location="Adminhome.html";
                 
           else
            
        document.getElementById('loginfail').innerHTML="<b>Incorrect login id or password</b>";

      }
                 
      }
               
      xmlhttp.send(null);
            
       }


      }

      </script>

      </head>



      <body>
      <div id="header_wrapper">
        
      <div id="header">
         
      <div id="site_title"> 
      <a href="#"> <span></span> </a> </div>
            
      <div id="menu">
          
      <ul>
       </ul>

      </div>
          
      </div>
        
      </div>
      <div id="ex" >
         
      <form name="Loginform" method=""  action="">
      <table style="width: 98%;" >
      <tr>
      <td><strong><h4>Username&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      &nbsp;&nbsp;&nbsp;</h4></strong></td>
      <td><input name="uid" type="text" size="50" style = "background:#E0FFFF;" /></td>
      </tr>
      <tr>
      <td><strong><h4>Password</h4></strong></td>
      <td><input name="pwd" type="password" size="50" style = "background:#E0FFFF;"/></td>

      </tr><br>
      <tr><td></td><td><div id='loginfail'></div></td></tr>
      <tr>
      <td></td>
      <td><button type="button" style = "background:#3B9C9C;" onclick="verifyLogin()">Login</button></td>
      </tr>
      </table>
         
      </form>

      </div>
      <br><br><br><br><br><br><br><br><br><br><br><br><br><br>
      <!-- end of content wrapper -->

      <div id="footer_wrapper">
        
      <div id="footer">
          
      <div class="footer_box">
            
      <div class="cleaner_h40"></div>
      </div>
          
      <div class="cleaner"></div>
        
      </div>
      </div>

      </body>

      </html>


      Now moving to the database part , we need to create a table in our database 
      mnesia and some functions to insert , retrieve and delete the data from on it.
      On your part u’ll have to create a User.erl file and copy the code below . 
      You can store it anywhere on your system.


      -module(User).
      -export([setup_and_start/0, insert/2, retrieve/1,delete/1]).

      -include("/usr/lib/erlang/lib/stdlib-1.16.4/include/qlc.hrl").

      -record(user, {username, password}).

      setup_and_start() ->
      mnesia:create_schema([node()]),
      mnesia:start(),
      mnesia:create_table(user, [{disc_copies, [node()]}, {attributes, record_info(fields, user)}]).
      insert(uid, pwd) ->
      Record = #user{username = uid, password = pwd},
      F = fun() ->
      mnesia:write(Record)end,
      mnesia:transaction(F).
      retrieve(uid) ->
      F = fun() ->
      mnesia:read({user, uid})
      end,
      {atomic, User} = mnesia:transaction(F),
      User.
      delete(uid) ->
      F=fun() ->
      mnesia:delete({user,uid})
      end,
      mnesia:transaction(F).


      This file is gonna act as a DAL for our application. Now that we are done with the 
      view and database part of the app , we would move forward to make a .yaws file .
      This file would receive the request from our application running on the server and 
      use the underlying Actions we would make to serve them.
      Since ours is a small application and here we have only the login page we would 
      have only one action , but if you develop your application  further you would need 
      many more actions. Anyways lets have this .yaws file  at hand first.

      <erl>
      out(X) ->
      A=yaws_api:parse_query(X),
      {value,{Key,Value}}= lists:keysearch("action",1,A),
      list_to_atom(Value) ! {self(), request, A},
      receive{From, response, Response} ->
      {html,Response}
      end.
      </erl>
      You’ll have to store this .yaws file in the www folder of the erlyweb app you have 
      built.Ahhh… now we’ll build the last part of the application , its an .erl file again that 
      would act as a bridge between our yaws file and the DAL.
      LoginAction.erl
      -module(LoginAction).
      -export([authuser/0,check/2,finalcheck/1,start/0]).
      -import(user,[retrieve/1]).
      -import(find,[getter/2]).
      start()->
      Pid1=spawn(fun authuser/0),
      register(loginaction,Pid1).
      authuser() ->
      receive{From,request,Userdata} ->
      Username1=find:getter("username",Userdata),
      Pwd1=find:getter("pwd",Userdata),
      Uid=list_to_atom(Username1),
      Pwd=list_to_atom(Pwd1),
      UserObj = user:retrieve(Username1),
      case UserObj of[] -> 
      From!{self(),response,"failure"},
      io:format("empty"),
      authuser();
      Data -> 
      io:format("~p",[Data])
      end,
      UserObj1=list_to_tuple(UserObj),
      {{user,Uid_retrieved,Pwd_retrieved}}=UserObj1,
      M=check(Pwd1,Pwd_retrieved),
      From!{self(),response,M},
      authuser()
      end.
      check(A,B)  when A==B -> "success";
      check(A,B) -> "failure".
      finalcheck(A)  when A==1 -> 1;
      finalcheck(A) -> 0.

      Another file Find.erl that is used in LoginAction.erl :
      -module(find).
      -export([getter/2]).
      getter(RecString,RecObject) ->
      {value,{Key,Value}}= lists:keysearch(RecString,1,RecObject),
      Value.

      So now finally .. the fun part i.e. run the app
      Before you hit the browser start your Yaws server , compile your Erlyweb app and 
      the .erl files we have made . And yes .. don't forget to insert some data into your 
      LoginTable before running the application.
      After having done all this just hit the following link

      http://localhost:your_port_no/Login.html
      Hope everything here must have helped you to some extent and all the best for 
      future programming in Erlang.
      Any suggestions or comments would be highly appreciated..