Return-Path: X-Original-To: apmail-accumulo-commits-archive@www.apache.org Delivered-To: apmail-accumulo-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 67E3191B4 for ; Tue, 21 May 2013 20:18:02 +0000 (UTC) Received: (qmail 64032 invoked by uid 500); 21 May 2013 20:18:02 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 64010 invoked by uid 500); 21 May 2013 20:18:02 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 64003 invoked by uid 99); 21 May 2013 20:18:02 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 May 2013 20:18:02 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 May 2013 20:17:58 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 885BF23888E4; Tue, 21 May 2013 20:17:36 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1484935 - in /accumulo/branches/1.4: ./ docs/src/user_manual/chapters/ src/minicluster/ src/minicluster/src/ src/minicluster/src/main/ src/minicluster/src/main/java/ src/minicluster/src/main/java/org/ src/minicluster/src/main/java/org/apac... Date: Tue, 21 May 2013 20:17:35 -0000 To: commits@accumulo.apache.org From: cjnolet@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130521201736.885BF23888E4@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: cjnolet Date: Tue May 21 20:17:35 2013 New Revision: 1484935 URL: http://svn.apache.org/r1484935 Log: ACCUMULO-1438, ACCUMULO-1414 Move minicluster into its own package and add proxy to user manual Added: accumulo/branches/1.4/src/minicluster/ (with props) accumulo/branches/1.4/src/minicluster/pom.xml (with props) accumulo/branches/1.4/src/minicluster/src/ accumulo/branches/1.4/src/minicluster/src/main/ accumulo/branches/1.4/src/minicluster/src/main/java/ accumulo/branches/1.4/src/minicluster/src/main/java/org/ accumulo/branches/1.4/src/minicluster/src/main/java/org/apache/ accumulo/branches/1.4/src/minicluster/src/main/java/org/apache/accumulo/ accumulo/branches/1.4/src/minicluster/src/main/java/org/apache/accumulo/minicluster/ accumulo/branches/1.4/src/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java - copied, changed from r1484915, accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/mini/MiniAccumuloCluster.java accumulo/branches/1.4/src/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloConfig.java - copied, changed from r1484915, accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/mini/MiniAccumuloConfig.java accumulo/branches/1.4/src/minicluster/src/test/ accumulo/branches/1.4/src/minicluster/src/test/java/ accumulo/branches/1.4/src/minicluster/src/test/java/org/ accumulo/branches/1.4/src/minicluster/src/test/java/org/apache/ accumulo/branches/1.4/src/minicluster/src/test/java/org/apache/accumulo/ accumulo/branches/1.4/src/minicluster/src/test/java/org/apache/accumulo/minicluster/ accumulo/branches/1.4/src/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterTest.java - copied, changed from r1484915, accumulo/branches/1.4/src/server/src/test/java/org/apache/accumulo/server/mini/MiniAccumuloClusterTest.java Removed: accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/mini/MiniAccumuloCluster.java accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/mini/MiniAccumuloConfig.java accumulo/branches/1.4/src/server/src/test/java/org/apache/accumulo/server/mini/MiniAccumuloClusterTest.java Modified: accumulo/branches/1.4/docs/src/user_manual/chapters/clients.tex accumulo/branches/1.4/pom.xml accumulo/branches/1.4/src/proxy/pom.xml accumulo/branches/1.4/src/proxy/src/main/java/org/apache/accumulo/proxy/Proxy.java accumulo/branches/1.4/src/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java Modified: accumulo/branches/1.4/docs/src/user_manual/chapters/clients.tex URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/docs/src/user_manual/chapters/clients.tex?rev=1484935&r1=1484934&r2=1484935&view=diff ============================================================================== --- accumulo/branches/1.4/docs/src/user_manual/chapters/clients.tex (original) +++ accumulo/branches/1.4/docs/src/user_manual/chapters/clients.tex Tue May 21 20:17:35 2013 @@ -202,3 +202,133 @@ for(Entry entry : scan) An example of the BatchScanner can be found at\\ accumulo/docs/examples/README.batch + +\section{Proxy} + +The proxy API allows the interaction with Accumulo with languages other than Java. +A proxy server is provided in the codebase and a client can further be generated. + +\subsection{Prequisites} + +The proxy server can live on any node in which the basic client API would work. That +means it must be able to communicate with the Master, ZooKeepers, NameNode, and the +Data nodes. A proxy client only needs the ability to communicate with the proxy server. + + +\subsection{Configuration} + +The configuration options for the proxy server live inside of a properties file. At +the very least, you need to supply the following properties: + +\small +\begin{verbatim} +protocolFactory=org.apache.thrift.protocol.TCompactProtocol$Factory +tokenClass=org.apache.accumulo.core.client.security.tokens.PasswordToken +port=42424 +instance=test +zookeepers=localhost:2181 +\end{verbatim} +\normalsize + +You can find a sample configuration file in your distribution: + +\small +\begin{verbatim} +$ACCUMULO_HOME/proxy/proxy.properties. +\end{verbatim} +\normalsize + +This sample configuration file further demonstrates an abilty to back the proxy server +by MockAccumulo or the MiniAccumuloCluster. + +\subsection{Running the Proxy Server} + +After the properties file holding the configuration is created, the proxy server +can be started using the following command in the Accumulo distribution (assuming +you your properties file is named config.properties): + +\small +\begin{verbatim} +$ACCUMULO_HOME/bin/accumulo proxy -p config.properties +\end{verbatim} +\normalsize + +\subsection{Creating a Proxy Client} + +Aside from installing the Thrift compiler, you will also need the language-specific library +for Thrift installed to generate client code in that language. Typically, your operating +system's package manager will be able to automatically install these for you in an expected +location such as /usr/lib/python/site-packages/thrift. + +You can find the thrift file for generating the client: + +\small +\begin{verbatim} +$ACCUMULO_HOME/proxy/proxy.thrift. +\end{verbatim} +\normalsize + +After a client is generated, the port specified in the configuration properties above will be +used to connect to the server. + +\subsection{Using a Proxy Client} + +The following examples have been written in Java and the method signatures may be +slightly different depending on the language specified when generating client with +the Thrift compiler. After initiating a connection to the Proxy (see Apache Thrift's +documentation for examples of connecting to a Thrift service), the methods on the +proxy client will be available. The first thing to do is log in: + +\small +\begin{verbatim} +Map password = new HashMap(); +password.put("password", "secret"); +ByteBuffer token = client.login("root", password); +\end{verbatim} +\normalsize + +Once logged in, the token returned will be used for most subsequent calls to the client. +Let's create a table, add some data, scan the table, and delete it. + + +First, create a table. + +\small +\begin{verbatim} +client.createTable(token, "myTable", true, TimeType.MILLIS); +\end{verbatim} +\normalsize + + +Next, add some data: + +\small +\begin{verbatim} +// first, create a writer on the server +String writer = client.createWriter(token, "myTable", new WriterOptions()); + +// build column updates +Map cells> cellsToUpdate = //... + +// send updates to the server +client.updateAndFlush(writer, "myTable", cellsToUpdate); + +client.closeWriter(writer); +\end{verbatim} +\normalsize + + +Scan for the data and batch the return of the results on the server: + +\small +\begin{verbatim} +String scanner = client.createScanner(token, "myTable", new ScanOptions()); +ScanResult results = client.nextK(scanner, 100); + +for(KeyValue keyValue : results.getResultsIterator()) { + // do something with results +} + +client.closeScanner(scanner); +\end{verbatim} +\normalsize \ No newline at end of file Modified: accumulo/branches/1.4/pom.xml URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/pom.xml?rev=1484935&r1=1484934&r2=1484935&view=diff ============================================================================== --- accumulo/branches/1.4/pom.xml (original) +++ accumulo/branches/1.4/pom.xml Tue May 21 20:17:35 2013 @@ -37,6 +37,7 @@ src/start src/examples src/proxy + src/minicluster @@ -698,6 +699,11 @@ accumulo-server 1.4.4-SNAPSHOT + + org.apache.accumulo + accumulo-minicluster + 1.4.4-SNAPSHOT + Propchange: accumulo/branches/1.4/src/minicluster/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Tue May 21 20:17:35 2013 @@ -0,0 +1,4 @@ +target +.settings +.classpath +.project Added: accumulo/branches/1.4/src/minicluster/pom.xml URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/minicluster/pom.xml?rev=1484935&view=auto ============================================================================== Binary file - no diff available. Propchange: accumulo/branches/1.4/src/minicluster/pom.xml ------------------------------------------------------------------------------ svn:mime-type = application/xml Copied: accumulo/branches/1.4/src/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java (from r1484915, accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/mini/MiniAccumuloCluster.java) URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java?p2=accumulo/branches/1.4/src/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java&p1=accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/mini/MiniAccumuloCluster.java&r1=1484915&r2=1484935&rev=1484935&view=diff ============================================================================== --- accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/mini/MiniAccumuloCluster.java (original) +++ accumulo/branches/1.4/src/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java Tue May 21 20:17:35 2013 @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.accumulo.server.mini; +package org.apache.accumulo.minicluster; import java.io.BufferedReader; import java.io.BufferedWriter; Copied: accumulo/branches/1.4/src/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloConfig.java (from r1484915, accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/mini/MiniAccumuloConfig.java) URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloConfig.java?p2=accumulo/branches/1.4/src/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloConfig.java&p1=accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/mini/MiniAccumuloConfig.java&r1=1484915&r2=1484935&rev=1484935&view=diff ============================================================================== --- accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/mini/MiniAccumuloConfig.java (original) +++ accumulo/branches/1.4/src/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloConfig.java Tue May 21 20:17:35 2013 @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.accumulo.server.mini; +package org.apache.accumulo.minicluster; import java.io.File; import java.util.Collections; Copied: accumulo/branches/1.4/src/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterTest.java (from r1484915, accumulo/branches/1.4/src/server/src/test/java/org/apache/accumulo/server/mini/MiniAccumuloClusterTest.java) URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterTest.java?p2=accumulo/branches/1.4/src/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterTest.java&p1=accumulo/branches/1.4/src/server/src/test/java/org/apache/accumulo/server/mini/MiniAccumuloClusterTest.java&r1=1484915&r2=1484935&rev=1484935&view=diff ============================================================================== --- accumulo/branches/1.4/src/server/src/test/java/org/apache/accumulo/server/mini/MiniAccumuloClusterTest.java (original) +++ accumulo/branches/1.4/src/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterTest.java Tue May 21 20:17:35 2013 @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.accumulo.server.mini; +package org.apache.accumulo.minicluster; import java.util.Collections; import java.util.Map.Entry; @@ -36,7 +36,6 @@ import org.apache.accumulo.core.security import org.apache.accumulo.core.security.ColumnVisibility; import org.apache.accumulo.core.security.TablePermission; import org.apache.accumulo.core.util.UtilWaitThread; -import org.apache.accumulo.server.mini.MiniAccumuloCluster; import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.junit.AfterClass; Modified: accumulo/branches/1.4/src/proxy/pom.xml URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/proxy/pom.xml?rev=1484935&r1=1484934&r2=1484935&view=diff ============================================================================== --- accumulo/branches/1.4/src/proxy/pom.xml (original) +++ accumulo/branches/1.4/src/proxy/pom.xml Tue May 21 20:17:35 2013 @@ -77,6 +77,11 @@ compile + org.apache.accumulo + accumulo-minicluster + compile + + org.apache.hadoop hadoop-core compile Modified: accumulo/branches/1.4/src/proxy/src/main/java/org/apache/accumulo/proxy/Proxy.java URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/proxy/src/main/java/org/apache/accumulo/proxy/Proxy.java?rev=1484935&r1=1484934&r2=1484935&view=diff ============================================================================== --- accumulo/branches/1.4/src/proxy/src/main/java/org/apache/accumulo/proxy/Proxy.java (original) +++ accumulo/branches/1.4/src/proxy/src/main/java/org/apache/accumulo/proxy/Proxy.java Tue May 21 20:17:35 2013 @@ -23,7 +23,7 @@ import java.lang.reflect.Constructor; import java.util.Properties; import org.apache.accumulo.proxy.thrift.AccumuloProxy; -import org.apache.accumulo.server.mini.MiniAccumuloCluster; +import org.apache.accumulo.minicluster.MiniAccumuloCluster; import org.apache.log4j.Logger; import org.apache.thrift.TProcessor; import org.apache.thrift.protocol.TCompactProtocol; Modified: accumulo/branches/1.4/src/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java?rev=1484935&r1=1484934&r2=1484935&view=diff ============================================================================== --- accumulo/branches/1.4/src/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java (original) +++ accumulo/branches/1.4/src/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java Tue May 21 20:17:35 2013 @@ -49,6 +49,7 @@ import org.apache.accumulo.core.iterator import org.apache.accumulo.core.iterators.user.SummingCombiner; import org.apache.accumulo.core.util.UtilWaitThread; import org.apache.accumulo.examples.simple.constraints.NumericValueConstraint; +import org.apache.accumulo.minicluster.MiniAccumuloCluster; import org.apache.accumulo.proxy.thrift.AccumuloException; import org.apache.accumulo.proxy.thrift.AccumuloProxy.Client; import org.apache.accumulo.proxy.thrift.AccumuloSecurityException; @@ -74,7 +75,6 @@ import org.apache.accumulo.proxy.thrift. import org.apache.accumulo.proxy.thrift.UnknownScanner; import org.apache.accumulo.proxy.thrift.UnknownWriter; import org.apache.accumulo.proxy.thrift.WriterOptions; -import org.apache.accumulo.server.mini.MiniAccumuloCluster; import org.apache.accumulo.server.test.functional.SlowIterator; import org.apache.accumulo.server.util.PortUtils; import org.apache.hadoop.conf.Configuration; @@ -133,7 +133,7 @@ public class SimpleTest { Properties props = new Properties(); props.put("instance", accumulo.getInstanceName()); props.put("zookeepers", accumulo.getZooKeepers()); - + protocolClass = getRandomProtocol(); System.out.println(protocolClass.getName()); @@ -325,7 +325,7 @@ public class SimpleTest { client.hasNext(scanner); fail("exception not thrown"); } catch (UnknownScanner us) {} - + try { client.closeScanner(scanner); fail("exception not thrown"); @@ -365,7 +365,7 @@ public class SimpleTest { // this is a oneway call, so it does not throw exceptions client.update(writer, mutation("row2", "cf", "cq", "value2")); - + try { client.flush(writer); fail("exception not thrown");