You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sqoop.apache.org by bu...@apache.org on 2013/11/06 23:20:16 UTC
svn commit: r885669 [4/9] - in /websites/staging/sqoop/trunk/content: ./
docs/1.99.3/ docs/1.99.3/_sources/ docs/1.99.3/_static/ docs/1.99.3/css/
docs/1.99.3/images/ docs/1.99.3/images/logos/
Added: websites/staging/sqoop/trunk/content/docs/1.99.3/Sqoop5MinutesDemo.html
==============================================================================
--- websites/staging/sqoop/trunk/content/docs/1.99.3/Sqoop5MinutesDemo.html (added)
+++ websites/staging/sqoop/trunk/content/docs/1.99.3/Sqoop5MinutesDemo.html Wed Nov 6 22:20:15 2013
@@ -0,0 +1,198 @@
+
+
+<!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>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+ <title>Sqoop 5 Minutes Demo — Apache Sqoop documentation</title>
+
+ <link rel="stylesheet" href="_static/haiku.css" type="text/css" />
+ <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
+ <link rel="stylesheet" href="_static/print.css" type="text/css" />
+
+ <script type="text/javascript">
+ var DOCUMENTATION_OPTIONS = {
+ URL_ROOT: '',
+ VERSION: '',
+ COLLAPSE_INDEX: false,
+ FILE_SUFFIX: '.html',
+ HAS_SOURCE: true
+ };
+ </script>
+ <script type="text/javascript" src="_static/jquery.js"></script>
+ <script type="text/javascript" src="_static/underscore.js"></script>
+ <script type="text/javascript" src="_static/doctools.js"></script>
+ <script type="text/javascript" src="_static/theme_extras.js"></script>
+ <link rel="top" title="Apache Sqoop documentation" href="index.html" />
+ </head>
+ <body>
+ <div class="header"><img class="rightlogo" src="_static/sqoop-logo.png" alt="Logo"/><h1 class="heading"><a href="index.html">
+ <span>Apache Sqoop documentation</span></a></h1>
+ <h2 class="heading"><span>Sqoop 5 Minutes Demo</span></h2>
+ </div>
+ <div class="topnav">
+
+ <p>
+ <a class="uplink" href="index.html">Contents</a>
+ </p>
+
+ </div>
+ <div class="content">
+
+
+ <div class="section" id="sqoop-5-minutes-demo">
+<h1>Sqoop 5 Minutes Demo<a class="headerlink" href="#sqoop-5-minutes-demo" title="Permalink to this headline">¶</a></h1>
+<p>This page will walk you through basic usage of Sqoop. You need to have installed and configured Sqoop server and client in order to follow this guide. Installation procedure is described on <a class="reference external" href="Installation.html">Installation page</a>. Please note that precise output shown in this page might differ from your as Sqoop develops. All major information should however remain the same.</p>
+<p>Sqoop is using numerical identifiers to identify various meta data structures (connectors, connections, jobs). Each meta data structures have it’s own pool of identifiers and thus it’s perfectly valid when Sqoop have connector with id 1, connection with id 1 and job with id 1 at the same time.</p>
+<div class="section" id="starting-client">
+<h2>Starting Client<a class="headerlink" href="#starting-client" title="Permalink to this headline">¶</a></h2>
+<p>Start client in interactive mode using following command:</p>
+<div class="highlight-none"><div class="highlight"><pre>./bin/sqoop.sh client
+</pre></div>
+</div>
+<p>Configure client to use your Sqoop server:</p>
+<div class="highlight-none"><div class="highlight"><pre>sqoop:000> set server --host your.host.com --port 12000 --webapp sqoop
+</pre></div>
+</div>
+<p>Verify that connection is working by simple version checking:</p>
+<div class="highlight-none"><div class="highlight"><pre>sqoop:000> show version --all
+Server version:
+ Sqoop 2.0.0-SNAPSHOT revision Unknown
+ Compiled by jarcec on Wed Nov 21 16:15:51 PST 2012
+Client version:
+ Sqoop 2.0.0-SNAPSHOT revision Unknown
+ Compiled by jarcec on Wed Nov 21 16:15:51 PST 2012
+Protocol version:
+ [1]
+</pre></div>
+</div>
+<p>You should received similar output as shown describing versions of both your client and remote server as well as negotiated protocol version.</p>
+</div>
+<div class="section" id="creating-connection-object">
+<h2>Creating Connection Object<a class="headerlink" href="#creating-connection-object" title="Permalink to this headline">¶</a></h2>
+<p>Check what connectors are available on your Sqoop server:</p>
+<div class="highlight-none"><div class="highlight"><pre>sqoop:000> show connector --all
+1 connector(s) to show:
+Connector with id 1:
+ Name: generic-jdbc-connector
+ Class: org.apache.sqoop.connector.jdbc.GenericJdbcConnector
+ Supported job types: [EXPORT, IMPORT]
+...
+</pre></div>
+</div>
+<p>Our example contains one connector called <tt class="docutils literal"><span class="pre">generic-jdbc-connector</span></tt>. This is basic connector that is relying on Java JDBC interface for doing data transfers. It should work on most common databases that are providing JDBC drivers. Please note that you must install JDBC drivers separately. They are not bundled in Sqoop due to incompatible licenses.</p>
+<p>Generic JDBC Connector have in our example id 1 and we will use this value to create new connection object for this connector:</p>
+<div class="highlight-none"><div class="highlight"><pre>sqoop:000> create connection --cid 1
+Creating connection for connector with id 1
+Please fill following values to create new connection object
+Name: First connection
+
+Configuration configuration
+JDBC Driver Class: com.mysql.jdbc.Driver
+JDBC Connection String: jdbc:mysql://mysql.server/database
+Username: sqoop
+Password: *****
+JDBC Connection Properties:
+There are currently 0 values in the map:
+entry#
+
+Security related configuration options
+Max connections: 0
+New connection was successfully created with validation status FINE and persistent id 1
+</pre></div>
+</div>
+<p>Our new connection object was created with assigned id 1.</p>
+</div>
+<div class="section" id="creating-job-object">
+<h2>Creating Job Object<a class="headerlink" href="#creating-job-object" title="Permalink to this headline">¶</a></h2>
+<p>Job objects have multiple types and each connector might not support all of them. Generic JDBC Connector supports job types <tt class="docutils literal"><span class="pre">import</span></tt> (importing data to Hadoop ecosystem) and <tt class="docutils literal"><span class="pre">export</span></tt> (exporting data from Hadoop ecosystem). List of supported job types for each connector might be seen in the output of <tt class="docutils literal"><span class="pre">show</span> <span class="pre">connector</span></tt> command:</p>
+<div class="highlight-none"><div class="highlight"><pre>sqoop:000> show connector --all
+...
+ Name: generic-jdbc-connector
+...
+ Supported job types: [EXPORT, IMPORT]
+...
+</pre></div>
+</div>
+<p>Create import job for Connection object created in previous section:</p>
+<div class="highlight-none"><div class="highlight"><pre>sqoop:000> create job --xid 1 --type import
+Creating job for connection with id 1
+Please fill following values to create new job object
+Name: First job
+
+Database configuration
+Table name: users
+Table SQL statement:
+Table column names:
+Partition column name:
+Boundary query:
+
+Output configuration
+Storage type:
+ 0 : HDFS
+Choose: 0
+Output directory: /user/jarcec/users
+New job was successfully created with validation status FINE and persistent id 1
+</pre></div>
+</div>
+<p>Our new job object was created with assigned id 1.</p>
+</div>
+<div class="section" id="moving-data">
+<h2>Moving Data<a class="headerlink" href="#moving-data" title="Permalink to this headline">¶</a></h2>
+<p>When all meta data objects are in place we can start moving data around. You can submit Hadoop job using <tt class="docutils literal"><span class="pre">submission</span> <span class="pre">start</span></tt> command:</p>
+<div class="highlight-none"><div class="highlight"><pre>sqoop:000> submission start --jid 1
+Submission details
+Job id: 1
+Status: BOOTING
+Creation date: 2012-12-23 13:20:34 PST
+Last update date: 2012-12-23 13:20:34 PST
+External Id: job_1353136146286_0004
+ http://hadoop.cluster.com:8088/proxy/application_1353136146286_0004/
+Progress: Progress is not available
+</pre></div>
+</div>
+<p>You can iteratively check your running job status with <tt class="docutils literal"><span class="pre">submission</span> <span class="pre">status</span></tt> command:</p>
+<div class="highlight-none"><div class="highlight"><pre>sqoop:000> submission status --jid 1
+Submission details
+Job id: 1
+Status: RUNNING
+Creation date: 2012-12-23 13:21:45 PST
+Last update date: 2012-12-23 13:21:56 PST
+External Id: job_1353136146286_0005
+ http://hadoop.cluster.com:8088/proxy/application_1353136146286_0004/
+Progress: 0.00 %
+</pre></div>
+</div>
+<p>And finally you can stop running job at any time using <tt class="docutils literal"><span class="pre">submission</span> <span class="pre">stop</span></tt> command:</p>
+<div class="highlight-none"><div class="highlight"><pre>sqoop:000> submission stop --jid 1
+Submission details
+Job id: 1
+Status: FAILED
+Creation date: 2012-12-23 13:22:39 PST
+Last update date: 2012-12-23 13:22:42 PST
+External Id: job_1353136146286_0006
+ http://hadoop.cluster.com:8088/proxy/application_1353136146286_0004/
+</pre></div>
+</div>
+</div>
+</div>
+
+
+ </div>
+ <div class="bottomnav">
+
+ <p>
+ <a class="uplink" href="index.html">Contents</a>
+ </p>
+
+ </div>
+
+ <div class="footer">
+ © Copyright 2009-2013 The Apache Software Foundation.
+ </div>
+ </body>
+</html>
\ No newline at end of file
Added: websites/staging/sqoop/trunk/content/docs/1.99.3/Upgrade.html
==============================================================================
--- websites/staging/sqoop/trunk/content/docs/1.99.3/Upgrade.html (added)
+++ websites/staging/sqoop/trunk/content/docs/1.99.3/Upgrade.html Wed Nov 6 22:20:15 2013
@@ -0,0 +1,93 @@
+
+
+<!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>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+ <title>Upgrade — Apache Sqoop documentation</title>
+
+ <link rel="stylesheet" href="_static/haiku.css" type="text/css" />
+ <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
+ <link rel="stylesheet" href="_static/print.css" type="text/css" />
+
+ <script type="text/javascript">
+ var DOCUMENTATION_OPTIONS = {
+ URL_ROOT: '',
+ VERSION: '',
+ COLLAPSE_INDEX: false,
+ FILE_SUFFIX: '.html',
+ HAS_SOURCE: true
+ };
+ </script>
+ <script type="text/javascript" src="_static/jquery.js"></script>
+ <script type="text/javascript" src="_static/underscore.js"></script>
+ <script type="text/javascript" src="_static/doctools.js"></script>
+ <script type="text/javascript" src="_static/theme_extras.js"></script>
+ <link rel="top" title="Apache Sqoop documentation" href="index.html" />
+ </head>
+ <body>
+ <div class="header"><img class="rightlogo" src="_static/sqoop-logo.png" alt="Logo"/><h1 class="heading"><a href="index.html">
+ <span>Apache Sqoop documentation</span></a></h1>
+ <h2 class="heading"><span>Upgrade</span></h2>
+ </div>
+ <div class="topnav">
+
+ <p>
+ <a class="uplink" href="index.html">Contents</a>
+ </p>
+
+ </div>
+ <div class="content">
+
+
+ <div class="section" id="upgrade">
+<h1>Upgrade<a class="headerlink" href="#upgrade" title="Permalink to this headline">¶</a></h1>
+<p>This page describes procedure that you need to take in order to upgrade Sqoop from one release to a higher release. Upgrading both client and server component will be discussed separately.</p>
+<div class="admonition note">
+<p class="first admonition-title">Note</p>
+<p class="last">Only updates from one Sqoop 2 release to another are covered, starting with upgrades from version 1.99.2. This guide do not contain general information how to upgrade from Sqoop 1 to Sqoop 2.</p>
+</div>
+<div class="section" id="upgrading-server">
+<h2>Upgrading Server<a class="headerlink" href="#upgrading-server" title="Permalink to this headline">¶</a></h2>
+<p>As Sqoop server is using external repository for persisting connection and job objects, this repository needs to be updated in addition to updating the server bits. The capability of performing the upgrade has been built-in to the server, however is disabled by default to avoid any unintentional changes to the repository. You can start the upgrade procedure by stopping the server:</p>
+<div class="highlight-none"><div class="highlight"><pre>./bin/sqoop.sh server stop
+</pre></div>
+</div>
+<p>It’s strongly advised to back up the repository before moving on to next steps. Precise back-up instructions depends on the repository implementation that is in use, please follow the repository owns instructions to back it up.</p>
+<p>Now you can update server bits. Before starting the server again you will need to enable the auto-upgrade feature that will perform all necessary during Sqoop Server boot up procedure. You need to set following properties in configuration file <tt class="docutils literal"><span class="pre">sqoop.properties</span></tt>:</p>
+<div class="highlight-none"><div class="highlight"><pre>org.apache.sqoop.repository.schema.immutable=false
+org.apache.sqoop.connector.autoupgrade=true
+org.apache.sqoop.framework.autoupgrade=true
+</pre></div>
+</div>
+<p>When all properties are set, start server using following command:</p>
+<div class="highlight-none"><div class="highlight"><pre>./bin/sqoop.sh server start
+</pre></div>
+</div>
+<p>All required actions will be performed automatically during the server bootstrap procedure. It’s strongly advised to set all three properties to their original values once the server has been successfully started.</p>
+</div>
+<div class="section" id="upgrading-client">
+<h2>Upgrading Client<a class="headerlink" href="#upgrading-client" title="Permalink to this headline">¶</a></h2>
+<p>Client do not require any manual steps during upgrade. Replacing the binaries with updated version is sufficient.</p>
+</div>
+</div>
+
+
+ </div>
+ <div class="bottomnav">
+
+ <p>
+ <a class="uplink" href="index.html">Contents</a>
+ </p>
+
+ </div>
+
+ <div class="footer">
+ © Copyright 2009-2013 The Apache Software Foundation.
+ </div>
+ </body>
+</html>
\ No newline at end of file
Added: websites/staging/sqoop/trunk/content/docs/1.99.3/_sources/BuildingSqoop2.txt
==============================================================================
--- websites/staging/sqoop/trunk/content/docs/1.99.3/_sources/BuildingSqoop2.txt (added)
+++ websites/staging/sqoop/trunk/content/docs/1.99.3/_sources/BuildingSqoop2.txt Wed Nov 6 22:20:15 2013
@@ -0,0 +1,69 @@
+.. Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+================================
+Building Sqoop2 from source code
+================================
+
+This guide will show you how to build Sqoop2 from source code. Sqoop is using `maven <http://maven.apache.org/>`_ as build system. You you will need to use at least version 3.0 as older versions will not work correctly. All other dependencies will be downloaded by maven automatically. With exception of special JDBC drivers that are needed only for advanced integration tests.
+
+Downloading source code
+-----------------------
+
+Sqoop project is using git as a revision control system hosted at Apache Software Foundation. You can clone entire repository using following command:
+
+::
+
+ git clone https://git-wip-us.apache.org/repos/asf/sqoop.git sqoop2
+
+Sqoop2 is currently developed in special branch ``sqoop2`` that you need to check out after clone:
+
+::
+
+ cd sqoop2
+ git checkout sqoop2
+
+Building project
+----------------
+
+You can use usual maven targets like ``compile`` or ``package`` to build the project. Sqoop supports two major Hadoop revisions at the moment - 1.x and 2.x. As compiled code for one Hadoop major version can't be used on another, you must compile Sqoop against appropriate Hadoop version. You can change the target Hadoop version by specifying ``-Dhadoop.profile=$hadoopVersion`` on the maven command line. Possible values of ``$hadoopVersions`` are 100 and 200 for Hadoop version 1.x and 2.x respectively. Sqoop will compile against Hadoop 2 by default. Following example will compile Sqoop against Hadoop 1.x:
+
+::
+
+ mvn compile -Dhadoop.profile=100
+
+Maven target ``package`` can be used to create Sqoop packages similar to the ones that are officially available for download. Sqoop will build only source tarball by default. You need to specify ``-Pbinary`` to build binary distribution. You might need to explicitly specify Hadoop version if the default is not accurate.
+
+::
+
+ mvn package -Pbinary
+
+Running tests
+-------------
+
+Sqoop supports two different sets of tests. First smaller and much faster set is called unit tests and will be executed on maven target ``test``. Second larger set of integration tests will be executed on maven target ``integration-test``. Please note that integration tests might require manual steps for installing various JDBC drivers into your local maven cache.
+
+Example for running unit tests:
+
+::
+
+ mvn test
+
+Example for running integration tests:
+
+::
+
+ mvn integration-test
Added: websites/staging/sqoop/trunk/content/docs/1.99.3/_sources/ClientAPI.txt
==============================================================================
--- websites/staging/sqoop/trunk/content/docs/1.99.3/_sources/ClientAPI.txt (added)
+++ websites/staging/sqoop/trunk/content/docs/1.99.3/_sources/ClientAPI.txt Wed Nov 6 22:20:15 2013
@@ -0,0 +1,322 @@
+.. Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+======================
+Sqoop Client API Guide
+======================
+
+This document will explain how to use Sqoop Client API with external application. Client API allows you to execute the functions of sqoop commands. It requires Sqoop Client JAR and its dependencies.
+
+Client API is explained using Generic JDBC Connector properties. Before executing the application using the sqoop client API, check whether sqoop server is running.
+
+Workflow
+========
+
+Given workflow has to be followed for executing a job in Sqoop server.
+
+ 1. Create connection using Connector ID (cid) - Creates connection and returns connection ID (xid)
+ 2. Create Job using Connection ID (xid) - Create job and returns Job ID (jid)
+ 3. Job submission with Job ID (jid) - Submit sqoop Job to server
+
+Project Dependencies
+====================
+Here given maven dependency
+
+::
+
+ <dependency>
+ <groupId>org.apache.sqoop</groupId>
+ <artifactId>sqoop-client</artifactId>
+ <version>${requestedVersion}</version>
+ </dependency>
+
+Initialization
+==============
+
+First initialize the SqoopClient class with server URL as argument.
+
+::
+
+ String url = "http://localhost:12000/sqoop/";
+ SqoopClient client = new SqoopClient(url);
+
+Server URL value can be modfied by setting value to setServerUrl(String) method
+
+::
+
+ client.setServerUrl(newUrl);
+
+
+Connection
+==========
+
+Client API allows you to create, update and delete connection. For creating or updating connection requires Connector forms and Framwork Forms. User has to retrive the connector and framework forms, then update the values.
+
+Create Connection
+-----------------
+
+First create a new connection by invoking newConnection(cid) method with connector ID and returns a MConnection object with dummy id. Then fill the connection and framework forms as given below. Invoke create connection with updated connection object.
+
+::
+
+ //Dummy connection object
+ MConnection newCon = client.newConnection(1);
+
+ //Get connection and framework forms. Set name for connection
+ MConnectionForms conForms = newCon.getConnectorPart();
+ MConnectionForms frameworkForms = newCon.getFrameworkPart();
+ newCon.setName("MyConnection");
+
+ //Set connection forms values
+ conForms.getStringInput("connection.connectionString").setValue("jdbc:mysql://localhost/my");
+ conForms.getStringInput("connection.jdbcDriver").setValue("com.mysql.jdbc.Driver");
+ conForms.getStringInput("connection.username").setValue("root");
+ conForms.getStringInput("connection.password").setValue("root");
+
+ frameworkForms.getIntegerInput("security.maxConnections").setValue(0);
+
+ Status status = client.createConnection(newCon);
+ if(status.canProceed()) {
+ System.out.println("Created. New Connection ID : " +newCon.getPersistenceId());
+ } else {
+ System.out.println("Check for status and forms error ");
+ }
+
+status.canProceed() returns true if status is FINE or ACCEPTABLE. Above code has given status after validation of connector and framework forms.
+
+On successful execution, new connection ID is assigned for the connection. getPersistenceId() method returns ID.
+User can retrieve a connection using below methods
+
++----------------------------+--------------------------------------+
+| Method | Description |
++============================+======================================+
+| ``getConnection(xid)`` | Returns a connection object. |
++----------------------------+--------------------------------------+
+| ``getConnections()`` | Returns list of connection object |
++----------------------------+--------------------------------------+
+
+List of status code
+-------------------
+
++------------------+------------------------------------------------------------------------------------------------------------+
+| Function | Description |
++==================+============================================================================================================+
+| ``FINE`` | There are no issues, no warnings. |
++------------------+------------------------------------------------------------------------------------------------------------+
+| ``ACCEPTABLE`` | Validated entity is correct enough to be processed. There might be some warnings, but no errors. |
++------------------+------------------------------------------------------------------------------------------------------------+
+| ``UNACCEPTABLE`` | There are serious issues with validated entity. We can't proceed until reported issues will be resolved. |
++------------------+------------------------------------------------------------------------------------------------------------+
+
+View Error or Warning message
+-----------------------------
+
+In case of any UNACCEPTABLE AND ACCEPTABLE status, user has to iterate the connector part forms and framework part forms for getting actual error or warning message. Below piece of code describe how to itereate over the forms for input message.
+
+::
+
+ printMessage(newCon.getConnectorPart().getForms());
+ printMessage(newCon.getFrameworkPart().getForms());
+
+ private static void printMessage(List<MForm> formList) {
+ for(MForm form : formList) {
+ List<MInput<?>> inputlist = form.getInputs();
+ if (form.getValidationMessage() != null) {
+ System.out.println("Form message: " + form.getValidationMessage());
+ }
+ for (MInput minput : inputlist) {
+ if (minput.getValidationStatus() == Status.ACCEPTABLE) {
+ System.out.println("Warning:" + minput.getValidationMessage());
+ } else if (minput.getValidationStatus() == Status.UNACCEPTABLE) {
+ System.out.println("Error:" + minput.getValidationMessage());
+ }
+ }
+ }
+ }
+
+Job
+===
+
+A job object holds database configurations, input or output configurations and resources required for executing as a hadoop job. Create job object requires filling connector part and framework part forms.
+
+Below given code shows how to create a import job
+
+::
+
+ String url = "http://localhost:12000/sqoop/";
+ SqoopClient client = new SqoopClient(url);
+ //Creating dummy job object
+ MJob newjob = client.newJob(1, org.apache.sqoop.model.MJob.Type.IMPORT);
+ MJobForms connectorForm = newjob.getConnectorPart();
+ MJobForms frameworkForm = newjob.getFrameworkPart();
+
+ newjob.setName("ImportJob");
+ //Database configuration
+ connectorForm.getStringInput("table.schemaName").setValue("");
+ //Input either table name or sql
+ connectorForm.getStringInput("table.tableName").setValue("table");
+ //connectorForm.getStringInput("table.sql").setValue("select id,name from table where ${CONDITIONS}");
+ connectorForm.getStringInput("table.columns").setValue("id,name");
+ connectorForm.getStringInput("table.partitionColumn").setValue("id");
+ //Set boundary value only if required
+ //connectorForm.getStringInput("table.boundaryQuery").setValue("");
+
+ //Output configurations
+ frameworkForm.getEnumInput("output.storageType").setValue("HDFS");
+ frameworkForm.getEnumInput("output.outputFormat").setValue("TEXT_FILE");//Other option: SEQUENCE_FILE
+ frameworkForm.getStringInput("output.outputDirectory").setValue("/output");
+
+ //Job resources
+ frameworkForm.getIntegerInput("throttling.extractors").setValue(1);
+ frameworkForm.getIntegerInput("throttling.loaders").setValue(1);
+
+ Status status = client.createJob(newjob);
+ if(status.canProceed()) {
+ System.out.println("New Job ID: "+ newjob.getPersistenceId());
+ } else {
+ System.out.println("Check for status and forms error ");
+ }
+
+ //Print errors or warnings
+ printMessage(newjob.getConnectorPart().getForms());
+ printMessage(newjob.getFrameworkPart().getForms());
+
+
+Export job creation is same as import job, but only few input configuration changes
+
+::
+
+ String url = "http://localhost:12000/sqoop/";
+ SqoopClient client = new SqoopClient(url);
+ MJob newjob = client.newJob(1, org.apache.sqoop.model.MJob.Type.EXPORT);
+ MJobForms connectorForm = newjob.getConnectorPart();
+ MJobForms frameworkForm = newjob.getFrameworkPart();
+
+ newjob.setName("ExportJob");
+ //Database configuration
+ connectorForm.getStringInput("table.schemaName").setValue("");
+ //Input either table name or sql
+ connectorForm.getStringInput("table.tableName").setValue("table");
+ //connectorForm.getStringInput("table.sql").setValue("select id,name from table where ${CONDITIONS}");
+ connectorForm.getStringInput("table.columns").setValue("id,name");
+
+ //Input configurations
+ frameworkForm.getStringInput("input.inputDirectory").setValue("/input");
+
+ //Job resources
+ frameworkForm.getIntegerInput("throttling.extractors").setValue(1);
+ frameworkForm.getIntegerInput("throttling.loaders").setValue(1);
+
+ Status status = client.createJob(newjob);
+ if(status.canProceed()) {
+ System.out.println("New Job ID: "+ newjob.getPersistenceId());
+ } else {
+ System.out.println("Check for status and forms error ");
+ }
+
+ //Print errors or warnings
+ printMessage(newjob.getConnectorPart().getForms());
+ printMessage(newjob.getFrameworkPart().getForms());
+
+Managing connection and job
+---------------------------
+After creating connection or job object, you can update or delete a connection or job using given functions
+
++----------------------------------+------------------------------------------------------------------------------------+
+| Method | Description |
++==================================+====================================================================================+
+| ``updateConnection(connection)`` | Invoke update with connection object and check status for any errors or warnings |
++----------------------------------+------------------------------------------------------------------------------------+
+| ``deleteConnection(xid)`` | Delete connection. Deletes only if specified connection is used by any job |
++----------------------------------+------------------------------------------------------------------------------------+
+| ``updateJob(job)`` | Invoke update with job object and check status for any errors or warnings |
++----------------------------------+------------------------------------------------------------------------------------+
+| ``deleteJob(jid)`` | Delete job |
++----------------------------------+------------------------------------------------------------------------------------+
+
+Job Submission
+==============
+
+Job submission requires a job id. On successful submission, getStatus() method returns "BOOTING" or "RUNNING".
+
+::
+
+ //Job submission start
+ MSubmission submission = client.startSubmission(1);
+ System.out.println("Status : " + submission.getStatus());
+ if(submission.getStatus().isRunning() && submission.getProgress() != -1) {
+ System.out.println("Progress : " + String.format("%.2f %%", submission.getProgress() * 100));
+ }
+ System.out.println("Hadoop job id :" + submission.getExternalId());
+ System.out.println("Job link : " + submission.getExternalLink());
+ Counters counters = submission.getCounters();
+ if(counters != null) {
+ System.out.println("Counters:");
+ for(CounterGroup group : counters) {
+ System.out.print("\t");
+ System.out.println(group.getName());
+ for(Counter counter : group) {
+ System.out.print("\t\t");
+ System.out.print(counter.getName());
+ System.out.print(": ");
+ System.out.println(counter.getValue());
+ }
+ }
+ }
+ if(submission.getExceptionInfo() != null) {
+ System.out.println("Exception info : " +submission.getExceptionInfo());
+ }
+
+
+ //Check job status
+ MSubmission submission = client.getSubmissionStatus(1);
+ if(submission.getStatus().isRunning() && submission.getProgress() != -1) {
+ System.out.println("Progress : " + String.format("%.2f %%", submission.getProgress() * 100));
+ }
+
+ //Stop a running job
+ submission.stopSubmission(jid);
+
+Above code block, job submission is asynchronous. For synchronous job submission, use startSubmission(jid, callback, pollTime) method. If user is not interested in getting submission status, then invoke method with null for callback parameter and returns final submission status. Polltime is request interval for getting submission status from sqoop server and value should be greater than zero. Frequently hit the sqoop server if the low value is set to pollTime.
+When a synchronous job is submission started with callback, first invokes the callback's submitted(MSubmission) method on successful submission, after every poll time interval invokes updated(MSubmission) and finally on finished executing the job invokes finished(MSubmission) method.
+
+Describe Forms
+==========================
+
+You can view the connection or job forms input values with labels of built-in resource bundle.
+
+::
+
+ String url = "http://localhost:12000/sqoop/";
+ SqoopClient client = new SqoopClient(url);
+ //Use getJob(jid) for describing job.
+ //While printing connection forms, pass connector id to getResourceBundle(cid).
+ describe(client.getConnection(1).getConnectorPart().getForms(), client.getResourceBundle(1));
+ describe(client.getConnection(1).getFrameworkPart().getForms(), client.getFrameworkResourceBundle());
+
+ void describe(List<MForm> forms, ResourceBundle resource) {
+ for (MForm mf : forms) {
+ System.out.println(resource.getString(mf.getLabelKey())+":");
+ List<MInput<?>> mis = mf.getInputs();
+ for (MInput mi : mis) {
+ System.out.println(resource.getString(mi.getLabelKey()) + " : " + mi.getValue());
+ }
+ System.out.println();
+ }
+ }
+
+
+Above Sqoop 2 Client API tutorial explained you how to create connection, create job and submit job.
Added: websites/staging/sqoop/trunk/content/docs/1.99.3/_sources/CommandLineClient.txt
==============================================================================
--- websites/staging/sqoop/trunk/content/docs/1.99.3/_sources/CommandLineClient.txt (added)
+++ websites/staging/sqoop/trunk/content/docs/1.99.3/_sources/CommandLineClient.txt Wed Nov 6 22:20:15 2013
@@ -0,0 +1,512 @@
+.. Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+===================
+Command Line Client
+===================
+
+Sqoop 2 provides command line client that is capable of communicating with Sqoop 2 server using REST interface. Client is able to run in two modes - interactive and batch mode. Commands ``create``, ``update`` and ``clone`` are not currently supported in batch mode. Interactive mode supports all available commands.
+
+You can start Sqoop 2 client in interactive mode using provided ``sqoop.sh`` shell script by passing argument ``client``: ::
+
+ sqoop.sh client
+
+Batch mode can be started by adding additional argument representing path to your Sqoop client script: ::
+
+ sqoop.sh client /path/to/your/script.sqoop
+
+Sqoop client script is expected to contain valid Sqoop client commands, empty lines and lines starting with ``#`` that are denoting comment lines. Comments and empty lines are ignored, all other lines are interpreted. Example script: ::
+
+ # Specify company server
+ set server --host sqoop2.company.net
+
+ # Executing given job
+ submission start --jid 1
+
+.. contents:: Table of Contents
+
+Resource file
+=============
+
+Sqoop 2 client have ability to load resource files similarly as other command line tools. At the beginning of execution Sqoop client will check existence of file ``.sqoop2rc`` in home directory of currently logged user. If such file exists, it will be interpreted before any additional actions. This file is loaded in both interactive and batch mode. It can be used to execute any batch compatible commands.
+
+Example resource file: ::
+
+ # Configure our Sqoop 2 server automatically
+ set server --host sqoop2.company.net
+
+ # Run in verbose mode by default
+ set option --name verbose --value true
+
+Commands
+========
+
+Sqoop 2 contains several commands that will be documented in this section. Each command have one more functions that are accepting various arguments. Not all commands are supported in both interactive and batch mode.
+
+Auxiliary Commands
+------------------
+
+Auxiliary commands are commands that are improving user experience and are running purely on client side. Thus they do not need working connection to the server.
+
+* ``exit`` Exit client immediately. This command can be also executed by sending EOT (end of transmission) character. It's CTRL+D on most common Linux shells like Bash or Zsh.
+* ``history`` Print out command history. Please note that Sqoop client is saving history from previous executions and thus you might see commands that you've executed in previous runs.
+* ``help`` Show all available commands with short in-shell documentation.
+
+Set Command
+-----------
+
+Set command allows to set various properties of the client. Similarly as auxiliary commands, set do not require connection to Sqoop server. Set commands is not used to reconfigure Sqoop server.
+
+Available functions:
+
++---------------+------------------------------------------+
+| Function | Description |
++===============+==========================================+
+| ``server`` | Set connection configuration for server |
++---------------+------------------------------------------+
+| ``option`` | Set various client side options |
++---------------+------------------------------------------+
+
+Set Server Function
+~~~~~~~~~~~~~~~~~~~
+
+Configure connection to Sqoop server - host port and web application name. Available arguments:
+
++-----------------------+---------------+--------------------------------------------------+
+| Argument | Default value | Description |
++=======================+===============+==================================================+
+| ``-h``, ``--host`` | localhost | Server name (FQDN) where Sqoop server is running |
++-----------------------+---------------+--------------------------------------------------+
+| ``-p``, ``--port`` | 12000 | TCP Port |
++-----------------------+---------------+--------------------------------------------------+
+| ``-w``, ``--webapp`` | sqoop | Tomcat's web application name |
++-----------------------+---------------+--------------------------------------------------+
+| ``-u``, ``--url`` | | Sqoop Server in url format |
++-----------------------+---------------+--------------------------------------------------+
+
+Example: ::
+
+ set server --host sqoop2.company.net --port 80 --webapp sqoop
+
+or ::
+
+ set server --url http://sqoop2.company.net:80/sqoop
+
+Note: When ``--url`` option is given, ``--host``, ``--port`` or ``--webapp`` option will be ignored.
+
+Set Option Function
+~~~~~~~~~~~~~~~~~~~
+
+Configure Sqoop client related options. This function have two required arguments ``name`` and ``value``. Name represents internal property name and value holds new value that should be set. List of available option names follows:
+
++-------------------+---------------+---------------------------------------------------------------------+
+| Option name | Default value | Description |
++===================+===============+=====================================================================+
+| ``verbose`` | false | Client will print additional information if verbose mode is enabled |
++-------------------+---------------+---------------------------------------------------------------------+
+| ``poll-timeout`` | 10000 | Server poll timeout in milliseconds |
++-------------------+---------------+---------------------------------------------------------------------+
+
+Example: ::
+
+ set option --name verbose --value true
+ set option --name poll-timeout --value 20000
+
+Show Command
+------------
+
+Show commands displays various information including server and protocol versions or all stored meta data.
+
+Available functions:
+
++----------------+--------------------------------------------------------------------------------------------------------+
+| Function | Description |
++================+========================================================================================================+
+| ``server`` | Display connection information to the server (host, port, webapp) |
++----------------+--------------------------------------------------------------------------------------------------------+
+| ``option`` | Display various client side options |
++----------------+--------------------------------------------------------------------------------------------------------+
+| ``version`` | Show version of both client and server (build numbers, supported protocols) |
++----------------+--------------------------------------------------------------------------------------------------------+
+| ``connector`` | Show connector meta data - set of parameters that connectors needs to create connections and jobs |
++----------------+--------------------------------------------------------------------------------------------------------+
+| ``framework`` | Show framework meta data - set of parameters that Sqoop framework needs to create connections and jobs |
++----------------+--------------------------------------------------------------------------------------------------------+
+| ``connection`` | Show created connection meta data objects |
++----------------+--------------------------------------------------------------------------------------------------------+
+| ``job`` | Show created job meta data objects |
++----------------+--------------------------------------------------------------------------------------------------------+
+
+Show Server Function
+~~~~~~~~~~~~~~~~~~~~
+
+Show details about configuration connection to Sqoop server.
+
++-----------------------+--------------------------------------------------------------+
+| Argument | Description |
++=======================+==============================================================+
+| ``-a``, ``--all`` | Show all connection related information (host, port, webapp) |
++-----------------------+--------------------------------------------------------------+
+| ``-h``, ``--host`` | Show host |
++-----------------------+--------------------------------------------------------------+
+| ``-p``, ``--port`` | Show port |
++-----------------------+--------------------------------------------------------------+
+| ``-w``, ``--webapp`` | Show web application name |
++-----------------------+--------------------------------------------------------------+
+
+Example: ::
+
+ show server --all
+
+Show Option Function
+~~~~~~~~~~~~~~~~~~~~
+
+Show values of various client side options. This function will show all client options when called without arguments.
+
++-----------------------+--------------------------------------------------------------+
+| Argument | Description |
++=======================+==============================================================+
+| ``-n``, ``--name`` | Show client option value with given name |
++-----------------------+--------------------------------------------------------------+
+
+Please check table in `Set Option Function`_ section to get a list of all supported option names.
+
+Example: ::
+
+ show option --name verbose
+
+Show Version Function
+~~~~~~~~~~~~~~~~~~~~~
+
+Show versions of both client and server as well as supported protocols.
+
++------------------------+-----------------------------------------------+
+| Argument | Description |
++========================+===============================================+
+| ``-a``, ``--all`` | Show all versions (server, client, protocols) |
++------------------------+-----------------------------------------------+
+| ``-c``, ``--client`` | Show client version |
++------------------------+-----------------------------------------------+
+| ``-s``, ``--server`` | Show server version |
++------------------------+-----------------------------------------------+
+| ``-p``, ``--protocol`` | Show protocol support on client or server |
++------------------------+-----------------------------------------------+
+
+Example: ::
+
+ show version --all
+
+Show Connector Function
+~~~~~~~~~~~~~~~~~~~~~~~
+
+Show connector meta data - parameters that connectors need in order to create new connection and job objects.
+
++-----------------------+------------------------------------------------+
+| Argument | Description |
++=======================+================================================+
+| ``-a``, ``--all`` | Show information for all connectors |
++-----------------------+------------------------------------------------+
+| ``-c``, ``--cid <x>`` | Show information for connector with id ``<x>`` |
++-----------------------+------------------------------------------------+
+
+Example: ::
+
+ show connector --all
+
+Show Framework Function
+~~~~~~~~~~~~~~~~~~~~~~~
+
+Show framework meta data - parameters that Sqoop framework need in order to create new connection and job objects.
+
+This function do not have any extra arguments.
+
+Example: ::
+
+ show framework
+
+Show Connection Function
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+Show persisted connection objects.
+
++-----------------------+------------------------------------------------------+
+| Argument | Description |
++=======================+======================================================+
+| ``-a``, ``--all`` | Show all available connections from all connectors |
++-----------------------+------------------------------------------------------+
+| ``-x``, ``--xid <x>`` | Show connection with id ``<x>`` |
++-----------------------+------------------------------------------------------+
+
+Example: ::
+
+ show connection --all
+
+Show Job Function
+~~~~~~~~~~~~~~~~~
+
+Show persisted job objects.
+
++-----------------------+----------------------------------------------+
+| Argument | Description |
++=======================+==============================================+
+| ``-a``, ``--all`` | Show all available jobs from all connectors |
++-----------------------+----------------------------------------------+
+| ``-j``, ``--jid <x>`` | Show job with id ``<x>`` |
++-----------------------+----------------------------------------------+
+
+Example: ::
+
+ show job --all
+
+Show Submission Function
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+Show persisted submission objects.
+
++-----------------------+---------------------------------------------+
+| Argument | Description |
++=======================+=============================================+
+| ``-j``, ``--jid <x>`` | Show available submissions for given job |
++-----------------------+---------------------------------------------+
+| ``-d``, ``--detail`` | Show jobs in full details |
++-----------------------+---------------------------------------------+
+
+Example: ::
+
+ show submission
+ show submission --jid 1
+ show submission --jid 1 --detail
+
+Create Command
+--------------
+
+Creates new connection and job objects. This command is supported only in interactive mode. It will query user for all parameters that are required by specific connector and framework and persist them in Sqoop server for later use.
+
+Available functions:
+
++----------------+-------------------------------------------------+
+| Function | Description |
++================+=================================================+
+| ``connection`` | Create new connection object |
++----------------+-------------------------------------------------+
+| ``job`` | Create new job object |
++----------------+-------------------------------------------------+
+
+Create Connection Function
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Create new connection object.
+
++------------------------+-------------------------------------------------------------+
+| Argument | Description |
++========================+=============================================================+
+| ``-c``, ``--cid <x>`` | Create new connection object for connector with id ``<x>`` |
++------------------------+-------------------------------------------------------------+
+
+
+Example: ::
+
+ create connection --cid 1
+
+Create Job Function
+~~~~~~~~~~~~~~~~~~~
+
+Create new job object.
+
++------------------------+------------------------------------------------------------------+
+| Argument | Description |
++========================+==================================================================+
+| ``-x``, ``--xid <x>`` | Create new job object for connection with id ``<x>`` |
++------------------------+------------------------------------------------------------------+
+| ``-t``, ``--type <t>`` | Create new job object with type ``<t>`` (``import``, ``export``) |
++------------------------+------------------------------------------------------------------+
+
+Example: ::
+
+ create job --xid 1
+
+Update Command
+--------------
+
+Update commands allows you to edit connection and job objects - change persisted meta data. This command is supported only in interactive mode.
+
+Update Connection Function
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Update existing connection object.
+
++-----------------------+---------------------------------------------+
+| Argument | Description |
++=======================+=============================================+
+| ``-x``, ``--xid <x>`` | Update existing connection with id ``<x>`` |
++-----------------------+---------------------------------------------+
+
+Example: ::
+
+ update connection --xid 1
+
+Update Job Function
+~~~~~~~~~~~~~~~~~~~
+
+Update existing job object.
+
++-----------------------+--------------------------------------------+
+| Argument | Description |
++=======================+============================================+
+| ``-j``, ``--jid <x>`` | Update existing job object with id ``<x>`` |
++-----------------------+--------------------------------------------+
+
+Example: ::
+
+ update job --jid 1
+
+
+Delete Command
+--------------
+
+Deletes connection and job objects from Sqoop server.
+
+Delete Connection Function
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Delete existing connection object.
+
++-----------------------+-------------------------------------------+
+| Argument | Description |
++=======================+===========================================+
+| ``-x``, ``--xid <x>`` | Delete connection object with id ``<x>`` |
++-----------------------+-------------------------------------------+
+
+Example: ::
+
+ delete connection --xid 1
+
+
+Delete Job Function
+~~~~~~~~~~~~~~~~~~~
+
+Delete existing job object.
+
++-----------------------+------------------------------------------+
+| Argument | Description |
++=======================+==========================================+
+| ``-j``, ``--jid <x>`` | Delete job object with id ``<x>`` |
++-----------------------+------------------------------------------+
+
+Example: ::
+
+ delete job --jid 1
+
+
+Clone Command
+-------------
+
+Clone command will load existing connection or job object from Sqoop server and allow user in place changes that will result in creation of new connection or job object. This command is not supported in batch mode.
+
+Clone Connection Function
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Clone existing connection object.
+
++-----------------------+------------------------------------------+
+| Argument | Description |
++=======================+==========================================+
+| ``-x``, ``--xid <x>`` | Clone connection object with id ``<x>`` |
++-----------------------+------------------------------------------+
+
+Example: ::
+
+ clone connection --xid 1
+
+
+Clone Job Function
+~~~~~~~~~~~~~~~~~~
+
+Clone existing job object.
+
++-----------------------+------------------------------------------+
+| Argument | Description |
++=======================+==========================================+
+| ``-j``, ``--jid <x>`` | Clone job object with id ``<x>`` |
++-----------------------+------------------------------------------+
+
+Example: ::
+
+ clone job --jid 1
+
+Start Command
+-------------
+
+Start command will begin execution of an existing Sqoop job.
+
+Start Job Function
+~~~~~~~~~~~~~~~~~~
+
+Start job (submit new submission). Starting already running job is considered as invalid operation.
+
++----------------------------+----------------------------+
+| Argument | Description |
++============================+============================+
+| ``-j``, ``--jid <x>`` | Start job with id ``<x>`` |
++----------------------------+----------------------------+
+| ``-s``, ``--synchronous`` | Synchoronous job execution |
++----------------------------+----------------------------+
+
+Example: ::
+
+ start job --jid 1
+ start job --jid 1 --synchronous
+
+Stop Command
+------------
+
+Stop command will interrupt an job execution.
+
+Stop Job Function
+~~~~~~~~~~~~~~~~~
+
+Interrupt running job.
+
++-----------------------+------------------------------------------+
+| Argument | Description |
++=======================+==========================================+
+| ``-j``, ``--jid <x>`` | Interrupt running job with id ``<x>`` |
++-----------------------+------------------------------------------+
+
+Example: ::
+
+ stop job --jid 1
+
+Status Command
+--------------
+
+Status command will retrieve the last status of a job.
+
+Status Job Function
+~~~~~~~~~~~~~~~~~~~
+
+Retrieve last status for given job.
+
++-----------------------+------------------------------------------+
+| Argument | Description |
++=======================+==========================================+
+| ``-j``, ``--jid <x>`` | Retrieve status for job with id ``<x>`` |
++-----------------------+------------------------------------------+
+
+Example: ::
+
+ status job --jid 1
+
Added: websites/staging/sqoop/trunk/content/docs/1.99.3/_sources/ConnectorDevelopment.txt
==============================================================================
--- websites/staging/sqoop/trunk/content/docs/1.99.3/_sources/ConnectorDevelopment.txt (added)
+++ websites/staging/sqoop/trunk/content/docs/1.99.3/_sources/ConnectorDevelopment.txt Wed Nov 6 22:20:15 2013
@@ -0,0 +1,250 @@
+.. Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+=============================
+Sqoop 2 Connector Development
+=============================
+
+This document describes you how to implement connector for Sqoop 2.
+
+
+What is Connector?
+++++++++++++++++++
+
+Connector provides interaction with external databases.
+Connector reads data from databases for import,
+and write data to databases for export.
+Interaction with Hadoop is taken cared by common modules of Sqoop 2 framework.
+
+
+Connector Implementation
+++++++++++++++++++++++++
+
+The SqoopConnector class defines functionality
+which must be provided by Connectors.
+Each Connector must extends SqoopConnector and overrides methods shown below.
+::
+
+ public abstract String getVersion();
+ public abstract ResourceBundle getBundle(Locale locale);
+ public abstract Class getConnectionConfigurationClass();
+ public abstract Class getJobConfigurationClass(MJob.Type jobType);
+ public abstract Importer getImporter();
+ public abstract Exporter getExporter();
+ public abstract Validator getValidator();
+ public abstract MetadataUpgrader getMetadataUpgrader();
+
+The getImporter method returns Importer_ instance
+which is a placeholder for the modules needed for import.
+
+The getExporter method returns Exporter_ instance
+which is a placeholder for the modules needed for export.
+
+Methods such as getBundle, getConnectionConfigurationClass,
+getJobConfigurationClass and getValidator
+are concerned to `Connector configurations`_ .
+
+
+Importer
+========
+
+Connector#getImporter method returns Importer instance
+which is a placeholder for the modules needed for import
+such as Partitioner_ and Extractor_ .
+Built-in GenericJdbcConnector defines Importer like this.
+::
+
+ private static final Importer IMPORTER = new Importer(
+ GenericJdbcImportInitializer.class,
+ GenericJdbcImportPartitioner.class,
+ GenericJdbcImportExtractor.class,
+ GenericJdbcImportDestroyer.class);
+
+ ...
+
+ @Override
+ public Importer getImporter() {
+ return IMPORTER;
+ }
+
+
+Extractor
+---------
+
+Extractor (E for ETL) extracts data from external database and
+writes it to Sqoop framework for import.
+
+Extractor must overrides extract method.
+::
+
+ public abstract void extract(ExtractorContext context,
+ ConnectionConfiguration connectionConfiguration,
+ JobConfiguration jobConfiguration,
+ Partition partition);
+
+The extract method extracts data from database in some way and
+writes it to DataWriter (provided by context) as `Intermediate representation`_ .
+
+Extractor must iterates in the extract method until the data from database exhausts.
+::
+
+ while (resultSet.next()) {
+ ...
+ context.getDataWriter().writeArrayRecord(array);
+ ...
+ }
+
+
+Partitioner
+-----------
+
+Partitioner creates Partition instances based on configurations.
+The number of Partition instances is interpreted as the number of map tasks.
+Partition instances are passed to Extractor_ as the argument of extract method.
+Extractor_ determines which portion of the data to extract by Partition.
+
+There is no actual convention for Partition classes
+other than being actually Writable and toString()-able.
+::
+
+ public abstract class Partition {
+ public abstract void readFields(DataInput in) throws IOException;
+ public abstract void write(DataOutput out) throws IOException;
+ public abstract String toString();
+ }
+
+Connectors can define the design of Partition on their own.
+
+
+Initializer and Destroyer
+-------------------------
+
+Initializer is instantiated before the submission of MapReduce job
+for doing preparation such as adding dependent jar files.
+
+Destroyer is instantiated after MapReduce job is finished for clean up.
+
+
+Exporter
+========
+
+Connector#getExporter method returns Exporter instance
+which is a placeholder for the modules needed for export
+such as Loader_ .
+Built-in GenericJdbcConnector defines Exporter like this.
+::
+
+ private static final Exporter EXPORTER = new Exporter(
+ GenericJdbcExportInitializer.class,
+ GenericJdbcExportLoader.class,
+ GenericJdbcExportDestroyer.class);
+
+ ...
+
+ @Override
+ public Exporter getExporter() {
+ return EXPORTER;
+ }
+
+
+Loader
+------
+
+Loader (L for ETL) receives data from Sqoop framework and
+loads it to external database.
+
+Loader must overrides load method.
+::
+
+ public abstract void load(LoaderContext context,
+ ConnectionConfiguration connectionConfiguration,
+ JobConfiguration jobConfiguration) throws Exception;
+
+The load method reads data from DataReader (provided by context)
+in `Intermediate representation`_ and loads it to database in some way.
+
+Loader must iterates in the load method until the data from DataReader exhausts.
+::
+
+ while ((array = context.getDataReader().readArrayRecord()) != null) {
+ ...
+ }
+
+
+Initializer and Destroyer
+-------------------------
+
+Initializer is instantiated before the submission of MapReduce job
+for doing preparation such as adding dependent jar files.
+
+Destroyer is instantiated after MapReduce job is finished for clean up.
+
+
+Connector Configurations
+++++++++++++++++++++++++
+
+Configurations
+==============
+
+The definition of the configurations are represented
+by models defined in org.apache.sqoop.model package.
+
+
+ConnectionConfigurationClass
+----------------------------
+
+
+JobConfigurationClass
+---------------------
+
+
+ResourceBundle
+==============
+
+Resources for Configurations_ are stored in properties file
+accessed by getBundle method of the Connector.
+
+
+Validator
+=========
+
+Validator validates configurations set by users.
+
+
+Internal of Sqoop2 MapReduce Job
+++++++++++++++++++++++++++++++++
+
+Sqoop 2 provides common MapReduce modules such as SqoopMapper and SqoopReducer
+for the both of import and export.
+
+- InputFormat create splits using Partitioner.
+
+- SqoopMapper invokes Extractor's extract method.
+
+- SqoopReducer do no actual works.
+
+- OutputFormat invokes Loader's load method (via SqoopOutputFormatLoadExecutor).
+
+.. todo: sequence diagram like figure.
+
+For import, Extractor provided by Connector extracts data from databases,
+and Loader provided by Sqoop2 loads data into Hadoop.
+
+For export, Extractor provided Sqoop2 exracts data from Hadoop,
+and Loader provided by Connector loads data into databases.
+
+
+.. _`Intermediate representation`: https://cwiki.apache.org/confluence/display/SQOOP/Sqoop2+Intermediate+representation
Added: websites/staging/sqoop/trunk/content/docs/1.99.3/_sources/DevEnv.txt
==============================================================================
--- websites/staging/sqoop/trunk/content/docs/1.99.3/_sources/DevEnv.txt (added)
+++ websites/staging/sqoop/trunk/content/docs/1.99.3/_sources/DevEnv.txt Wed Nov 6 22:20:15 2013
@@ -0,0 +1,57 @@
+.. Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+=====================================
+Sqoop 2 Development Environment Setup
+=====================================
+
+This document describes you how to setup development environment for Sqoop 2.
+
+System Requirement
+==================
+
+Java
+----
+
+Sqoop written in Java and using version 1.6. You can `download java <http://www.oracle.com/technetwork/java/javase/downloads/index.html>`_ and install. Locate JAVA_HOME to installed directroy, e.g. export JAVA_HOME=/usr/lib/jvm/jdk1.6.0_32.
+
+Maven
+-----
+
+Sqoop uses Maven 3 for building the project. Download `Maven <http://maven.apache.org/download.cgi>`_ and its Installation instructions given in `link <http://maven.apache.org/download.cgi#Maven_Documentation>`_.
+
+Eclipse Setup
+=============
+
+Steps for downloading source code is given in `Building Sqoop2 <BuildingSqoop2.html>`_
+
+Sqoop 2 project has multiple modules where one module is depend on another module for e.g. sqoop 2 client module has sqoop 2 common module dependency. Follow below step for creating eclipse's project and classpath for each module.
+
+::
+
+ //Install all package into local maven repository
+ mvn clean install -DskipTests
+
+ //Adding M2_REPO variable to eclipse workspace
+ mvn eclipse:configure-workspace -Declipse.workspace=<path-to-eclipse-workspace-dir-for-sqoop-2>
+
+ //Eclipse project creation with optional parameters
+ mvn eclipse:eclipse -DdownloadSources=true -DdownloadJavadocs=true
+
+Alternatively, for manually adding M2_REPO classpath variable as maven repository path in eclipse-> window-> Java ->Classpath Variables ->Click "New" ->In new dialog box, input Name as M2_REPO and Path as $HOME/.m2/repository ->click Ok.
+
+On successful execution of above maven commands, Then import the sqoop project modules into eclipse-> File -> Import ->General ->Existing Projects into Workspace-> Click Next-> Browse Sqoop 2 directory ($HOME/git/sqoop2) ->Click Ok ->Import dialog shows multiple projects (sqoop-client, sqoop-common, etc.) -> Select all modules -> click Finish.
+
Added: websites/staging/sqoop/trunk/content/docs/1.99.3/_sources/Installation.txt
==============================================================================
--- websites/staging/sqoop/trunk/content/docs/1.99.3/_sources/Installation.txt (added)
+++ websites/staging/sqoop/trunk/content/docs/1.99.3/_sources/Installation.txt Wed Nov 6 22:20:15 2013
@@ -0,0 +1,83 @@
+.. Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF lANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+=======================================
+Installation
+=======================================
+
+Sqoop ships as one binary package however it's compound from two separate parts - client and server. You need to install server on single node in your cluster. This node will then serve as an entry point for all connecting Sqoop clients. Server acts as a mapreduce client and therefore Hadoop must be installed and configured on machine hosting Sqoop server. Clients can be installed on any arbitrary number of machines. Client is not acting as a mapreduce client and thus you do not need to install Hadoop on nodes that will act only as a Sqoop client.
+
+Server installation
+===================
+
+Copy Sqoop artifact on machine where you want to run Sqoop server. This machine must have installed and configured Hadoop. You don't need to run any Hadoop related services there, however the machine must be able to act as an Hadoop client. You should be able to list a HDFS for example: ::
+
+ hadoop dfs -ls
+
+Sqoop server supports multiple Hadoop versions. However as Hadoop major versions are not compatible with each other, Sqoop have multiple binary artefacts - one for each supported major version of Hadoop. You need to make sure that you're using appropriated binary artifact for your specific Hadoop version. To install Sqoop server decompress appropriate distribution artifact in location at your convenience and change your working directory to this folder. ::
+
+ # Decompress Sqoop distribution tarball
+ tar -xvf sqoop-<version>-bin-hadoop<hadoop-version>.tar.gz
+
+ # Move decompressed content to any location
+ mv sqoop-<version>-bin-hadoop<hadoop version>.tar.gz /usr/lib/sqoop
+
+ # Change working directory
+ cd /usr/lib/sqoop
+
+
+Installing Dependencies
+-----------------------
+
+Hadoop libraries must be available on node where you are planning to run Sqoop server with proper configuration for major services - ``NameNode`` and either ``JobTracker`` or ``ResourceManager`` depending whether you are running Hadoop 1 or 2. There is no need to run any Hadoop service on the same node as Sqoop server, just the libraries and configuration must be available.
+
+Path to Hadoop libraries is stored in file ``catalina.properties`` inside directory ``server/conf``. You need to change property called ``common.loader`` to contain all directories with your Hadoop libraries. The default expected locations are ``/usr/lib/hadoop`` and ``/usr/lib/hadoop/lib/``. Please check out the comments in the file for further description how to configure different locations.
+
+Lastly you might need to install JDBC drivers that are not bundled with Sqoop because of incompatible licenses. You can add any arbitrary Java jar file to Sqoop server by copying it into ``lib/`` directory. You can create this directory if it do not exists already.
+
+Configuring Server
+------------------
+
+Before starting server you should revise configuration to match your specific environment. Server configuration files are stored in ``server/config`` directory of distributed artifact along side with other configuration files of Tomcat.
+
+File ``sqoop_bootstrap.properties`` specifies which configuration provider should be used for loading configuration for rest of Sqoop server. Default value ``PropertiesConfigurationProvider`` should be sufficient.
+
+
+Second configuration file ``sqoop.properties`` contains remaining configuration properties that can affect Sqoop server. File is very well documented, so check if all configuration properties fits your environment. Default or very little tweaking should be sufficient most common cases.
+
+Server Life Cycle
+-----------------
+
+After installation and configuration you can start Sqoop server with following command: ::
+
+ ./bin/sqoop.sh server start
+
+Similarly you can stop server using following command: ::
+
+ ./bin/sqoop.sh server stop
+
+By default Sqoop server daemons use ports 12000 and 12001. You can set ``SQOOP_HTTP_PORT`` and ``SQOOP_ADMIN_PORT`` in configuration file ``server/bin/setenv.sh`` to use different ports.
+
+Client installation
+===================
+
+Client do not need extra installation and configuration steps. Just copy Sqoop distribution artifact on target machine and unzip it in desired location. You can start client with following command: ::
+
+ bin/sqoop.sh client
+
+You can find more documentation to Sqoop client in `Command Line Client <CommandLineClient.html>`_ section.
+
+