accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cjno...@apache.org
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 GMT
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<Key,Value> 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<String,String>();
+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<ByteBuffer, List<ColumnUpdate> 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 @@
     <module>src/start</module>
     <module>src/examples</module>
     <module>src/proxy</module>
+    <module>src/minicluster</module>
   </modules>
 
   <build>
@@ -698,6 +699,11 @@
         <artifactId>accumulo-server</artifactId>
         <version>1.4.4-SNAPSHOT</version>
       </dependency>
+    <dependency>
+        <groupId>org.apache.accumulo</groupId>
+        <artifactId>accumulo-minicluster</artifactId>
+        <version>1.4.4-SNAPSHOT</version>
+    </dependency>
 
       <!-- additional dependencies we need to provide -->
       <dependency>

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 @@
         <scope>compile</scope>
     </dependency>
     <dependency>
+      <groupId>org.apache.accumulo</groupId>
+      <artifactId>accumulo-minicluster</artifactId>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
         <groupId>org.apache.hadoop</groupId>
         <artifactId>hadoop-core</artifactId>
         <scope>compile</scope>

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");



Mime
View raw message