You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by mw...@apache.org on 2019/11/12 22:18:01 UTC
[accumulo-proxy] branch master updated: Fixes #5 Create tarball
with scripts for running proxy (#9)
This is an automated email from the ASF dual-hosted git repository.
mwalch pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo-proxy.git
The following commit(s) were added to refs/heads/master by this push:
new 7a74561 Fixes #5 Create tarball with scripts for running proxy (#9)
7a74561 is described below
commit 7a74561253313562ad8fbe256d3588bbb456b010
Author: Mike Walch <mw...@apache.org>
AuthorDate: Tue Nov 12 17:17:54 2019 -0500
Fixes #5 Create tarball with scripts for running proxy (#9)
---
README.md | 17 +++
pom.xml | 25 ++++
.../main/assemble/bin/accumulo-proxy | 16 +--
src/main/assemble/binary-release.xml | 27 ++++
src/main/assemble/component.xml | 69 +++++++++++
.../main/assemble/conf/proxy-env.sh | 14 +--
src/main/assemble/conf/proxy.properties | 137 +++++++++++++++++++++
src/main/java/org/apache/accumulo/proxy/Proxy.java | 13 +-
8 files changed, 293 insertions(+), 25 deletions(-)
diff --git a/README.md b/README.md
index 5468b42..ab23767 100644
--- a/README.md
+++ b/README.md
@@ -24,6 +24,23 @@ an Apache [Thrift] service so that users can use their preferred programming
language to communicate with Accumulo (provided that language has a supported
Thrift language binding).
+# Running the Accumulo proxy
+
+1. Build the proxy tarball and install it.
+
+ ```
+ cd /path/to/accumulo-proxy
+ mvn clean package -Ptarball
+ tar xzvf ./target/accumulo-proxy-2.0.0-SNAPSHOT-bin.tar.gz -C /path/to/install
+ ```
+
+2. Edit `proxy.properties` and `accumulo-client.properties` and run the proxy.
+
+ ```
+ cd /path/to/install/accumulo-proxy-2.0.0-SNAPSHOT
+ ./bin/accumulo-proxy -p conf/proxy.properties -c $ACCUMULO_HOME/conf/accumulo-client.properties
+ ```
+
[accumulo]: https://accumulo.apache.org
[Thrift]: https://thrift.apache.org
[li]: https://img.shields.io/badge/license-ASL-blue.svg
diff --git a/pom.xml b/pom.xml
index a1d6d26..ac9a20f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -663,6 +663,31 @@
</build>
<profiles>
<profile>
+ <id>tarball</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>binary-assembly</id>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assemble/binary-release.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
<id>thrift</id>
<build>
<plugins>
diff --git a/proxy.properties b/src/main/assemble/bin/accumulo-proxy
old mode 100644
new mode 100755
similarity index 74%
copy from proxy.properties
copy to src/main/assemble/bin/accumulo-proxy
index 3bb3b28..cec23e9
--- a/proxy.properties
+++ b/src/main/assemble/bin/accumulo-proxy
@@ -1,3 +1,5 @@
+#! /usr/bin/env bash
+
# 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.
@@ -13,10 +15,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# Port to run proxy on
-port=42424
-# Set to true if you wish to use an Mini Accumulo Cluster
-useMiniAccumulo=false
-protocolFactory=org.apache.thrift.protocol.TCompactProtocol$Factory
-tokenClass=org.apache.accumulo.core.client.security.tokens.PasswordToken
-maxFrameSize=16M
+BIN_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+
+cd $BIN_DIR/..
+
+. conf/proxy-env.sh
+
+java org.apache.accumulo.proxy.Proxy "${@}"
diff --git a/src/main/assemble/binary-release.xml b/src/main/assemble/binary-release.xml
new file mode 100644
index 0000000..bc9862f
--- /dev/null
+++ b/src/main/assemble/binary-release.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+ <id>bin</id>
+ <formats>
+ <format>tar.gz</format>
+ </formats>
+ <componentDescriptors>
+ <componentDescriptor>src/main/assemble/component.xml</componentDescriptor>
+ </componentDescriptors>
+</assembly>
diff --git a/src/main/assemble/component.xml b/src/main/assemble/component.xml
new file mode 100644
index 0000000..4dca57d
--- /dev/null
+++ b/src/main/assemble/component.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<component xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/component/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/component/1.1.2 http://maven.apache.org/xsd/component-1.1.2.xsd">
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>lib</outputDirectory>
+ <directoryMode>0755</directoryMode>
+ <fileMode>0644</fileMode>
+ <useProjectArtifact>true</useProjectArtifact>
+ <useTransitiveDependencies>false</useTransitiveDependencies>
+ <includes>
+ <!-- if you update this list, you should also update the assembly
+ pom.xml section which executes the maven-dependency-plugin to generate a
+ version listing for packaged artifacts -->
+ <include>${groupId}:${artifactId}</include>
+ <include>com.google.guava:guava</include>
+ <include>commons-lang:commons-lang</include>
+ <include>org.apache.thrift:libthrift</include>
+ <include>org.slf4j:slf4j-api</include>
+ <include>org.slf4j:slf4j-log4j12</include>
+ </includes>
+ </dependencySet>
+ </dependencySets>
+ <fileSets>
+ <fileSet>
+ <outputDirectory>bin</outputDirectory>
+ <directory>src/main/assemble/bin</directory>
+ <directoryMode>0755</directoryMode>
+ <fileMode>0755</fileMode>
+ </fileSet>
+ <fileSet>
+ <outputDirectory>conf</outputDirectory>
+ <directory>src/main/assemble/conf</directory>
+ <directoryMode>0755</directoryMode>
+ <fileMode>0644</fileMode>
+ </fileSet>
+ <fileSet>
+ <directory>./</directory>
+ <fileMode>0644</fileMode>
+ <includes>
+ <include>README.md</include>
+ <include>LICENSE</include>
+ <include>NOTICE</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <outputDirectory>thrift</outputDirectory>
+ <directory>src/main/thrift</directory>
+ <directoryMode>0755</directoryMode>
+ <fileMode>0755</fileMode>
+ </fileSet>
+ </fileSets>
+</component>
diff --git a/proxy.properties b/src/main/assemble/conf/proxy-env.sh
similarity index 74%
rename from proxy.properties
rename to src/main/assemble/conf/proxy-env.sh
index 3bb3b28..2afa3b9 100644
--- a/proxy.properties
+++ b/src/main/assemble/conf/proxy-env.sh
@@ -1,3 +1,5 @@
+#! /usr/bin/env bash
+
# 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.
@@ -13,10 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# Port to run proxy on
-port=42424
-# Set to true if you wish to use an Mini Accumulo Cluster
-useMiniAccumulo=false
-protocolFactory=org.apache.thrift.protocol.TCompactProtocol$Factory
-tokenClass=org.apache.accumulo.core.client.security.tokens.PasswordToken
-maxFrameSize=16M
+CONF_DIR=$(readlink -f ./conf)
+LIB_DIR=./lib
+
+CLASSPATH="$CONF_DIR:$LIB_DIR/*:$(accumulo classpath)"
+export CLASSPATH
diff --git a/src/main/assemble/conf/proxy.properties b/src/main/assemble/conf/proxy.properties
new file mode 100644
index 0000000..0e4e94c
--- /dev/null
+++ b/src/main/assemble/conf/proxy.properties
@@ -0,0 +1,137 @@
+# 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.
+
+###############################
+## Accumulo Proxy configuration
+###############################
+
+# Port to run proxy on
+port=42424
+# Set to true if you wish to use an Mini Accumulo Cluster
+useMiniAccumulo=false
+protocolFactory=org.apache.thrift.protocol.TCompactProtocol$Factory
+tokenClass=org.apache.accumulo.core.client.security.tokens.PasswordToken
+maxFrameSize=16M
+
+########################################################################
+
+################################
+## Accumulo client configuration
+################################
+
+## NOTE - All properties that have a default are set with it. Properties that
+## are uncommented must be set by the user.
+
+## Instance properties
+## --------------
+## Name of Accumulo instance to connect to
+instance.name=myinstance
+
+## Zookeeper connection information for Accumulo instance
+instance.zookeepers=localhost:2181
+
+## Zookeeper session timeout
+#instance.zookeepers.timeout=30s
+
+
+## Authentication properties
+## --------------
+## Authentication method (i.e password, kerberos, PasswordToken, KerberosToken, etc)
+auth.type=password
+
+## Accumulo principal/username for chosen authentication method
+auth.principal=root
+
+## Authentication token (ex. mypassword, /path/to/keytab)
+auth.token=secret
+
+
+## Batch Writer properties
+## --------------
+## The durability used to write to the write-ahead log. Legal values are: none, which skips the write-ahead log; log, which sends the data to the write-ahead log, but does nothing to make it durable; flush, which pushes data to the file system; and sync, which ensures the data is written to disk. Setting this property will change the durability for the BatchWriter session. A value of "default" will use the table's durability setting.
+#batch.writer.durability=default
+
+## Max amount of time (in seconds) to hold data in memory before flushing it
+#batch.writer.latency.max=120s
+
+## Max memory (in bytes) to batch before writing
+#batch.writer.memory.max=50M
+
+## Maximum number of threads to use for writing data to tablet servers.
+#batch.writer.threads.max=3
+
+## Max amount of time (in seconds) an unresponsive server will be re-tried. An exception is thrown when this timeout is exceeded. Set to zero for no timeout.
+#batch.writer.timeout.max=0
+
+
+## Batch Scanner properties
+## --------------
+## Number of concurrent query threads to spawn for querying
+#batch.scanner.num.query.threads=3
+
+
+## Scanner properties
+## --------------
+## Number of key/value pairs that will be fetched at time from tablet server
+#scanner.batch.size=1000
+
+
+## SSL properties
+## --------------
+## Enable SSL for client RPC
+#ssl.enabled=false
+
+## Password used to encrypt keystore
+#ssl.keystore.password=
+
+## Path to SSL keystore file
+#ssl.keystore.path=
+
+## Type of SSL keystore
+#ssl.keystore.type=jks
+
+## Password used to encrypt truststore
+#ssl.truststore.password=
+
+## Path to SSL truststore file
+#ssl.truststore.path=
+
+## Type of SSL truststore
+#ssl.truststore.type=jks
+
+## Use JSSE system properties to configure SSL
+#ssl.use.jsse=false
+
+
+## SASL properties
+## --------------
+## Enable SASL for client RPC
+#sasl.enabled=false
+
+## Kerberos principal/primary that Accumulo servers use to login
+#sasl.kerberos.server.primary=accumulo
+
+## SASL quality of protection. Valid values are 'auth', 'auth-int', and 'auth-conf'
+#sasl.qop=auth
+
+
+## Tracing properties
+## --------------
+## A list of span receiver classes to send trace spans
+#trace.span.receivers=org.apache.accumulo.tracer.ZooTraceClient
+
+## The zookeeper node where tracers are registered
+#trace.zookeeper.path=/tracers
+
diff --git a/src/main/java/org/apache/accumulo/proxy/Proxy.java b/src/main/java/org/apache/accumulo/proxy/Proxy.java
index b7575e3..676cb6e 100644
--- a/src/main/java/org/apache/accumulo/proxy/Proxy.java
+++ b/src/main/java/org/apache/accumulo/proxy/Proxy.java
@@ -101,12 +101,9 @@ public class Proxy implements KeywordExecutable {
}
public static class Opts extends Help {
- @Parameter(names = "-p", description = "proxy.properties path",
+ @Parameter(names = "-p", description = "proxy.properties path", required = true,
converter = PropertiesConverter.class)
Properties proxyProps;
- @Parameter(names = "-c", description = "accumulo-client.properties path",
- converter = PropertiesConverter.class)
- Properties clientProps;
}
@Override
@@ -131,7 +128,6 @@ public class Proxy implements KeywordExecutable {
opts.parseArgs(Proxy.class.getName(), args);
Properties proxyProps = opts.proxyProps;
- Properties clientProps = opts.clientProps;
boolean useMini = Boolean
.parseBoolean(proxyProps.getProperty(USE_MINI_ACCUMULO_KEY, USE_MINI_ACCUMULO_DEFAULT));
@@ -146,7 +142,7 @@ public class Proxy implements KeywordExecutable {
final File folder = Files.createTempDirectory(System.currentTimeMillis() + "").toFile();
final MiniAccumuloCluster accumulo = new MiniAccumuloCluster(folder, "secret");
accumulo.start();
- clientProps = accumulo.getClientProperties();
+ proxyProps.putAll(accumulo.getClientProperties());
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
try {
accumulo.stop();
@@ -158,10 +154,6 @@ public class Proxy implements KeywordExecutable {
}
}
}));
- } else if (clientProps == null) {
- System.err.println("The '-c' option must be set with an accumulo-client.properties file or"
- + " proxy.properties must contain either useMiniAccumulo=true");
- System.exit(1);
}
Class<? extends TProtocolFactory> protoFactoryClass = Class
@@ -173,7 +165,6 @@ public class Proxy implements KeywordExecutable {
String hostname = proxyProps.getProperty(THRIFT_SERVER_HOSTNAME,
THRIFT_SERVER_HOSTNAME_DEFAULT);
HostAndPort address = HostAndPort.fromParts(hostname, port);
- proxyProps.putAll(clientProps);
ServerAddress server = createProxyServer(address, protoFactory, proxyProps);
// Wait for the server to come up
while (!server.server.isServing()) {