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 2018/08/31 15:05:41 UTC
[accumulo] 01/04: Converted accumulo-site.xml from XML to
properties file (#623)
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.git
commit b5ea706e8846fdc9374d39be8c95b5a5965b4226
Author: Mike Walch <mw...@apache.org>
AuthorDate: Mon Aug 27 11:28:51 2018 -0400
Converted accumulo-site.xml from XML to properties file (#623)
* Renamed file to accumulo.properties
* SiteConfiguration now uses commons-configuration
* created 'accumulo convert-config' command to convert
old accumulo-site.xml files to accumulo.properties.
---
INSTALL.md | 4 +-
assemble/bin/accumulo-util | 32 ++----
assemble/conf/accumulo-site.xml | 51 ---------
assemble/conf/accumulo.properties | 36 ++++++
.../core/client/mapreduce/InputTableConfig.java | 4 +-
.../org/apache/accumulo/core/cli/ConfigOpts.java | 16 +--
.../core/client/admin/InstanceOperations.java | 10 +-
.../core/client/impl/ClientConfConverter.java | 2 +-
.../accumulo/core/conf/ConfigurationDocGen.java | 4 +-
.../org/apache/accumulo/core/conf/Property.java | 2 +-
.../accumulo/core/conf/SiteConfiguration.java | 121 +++++++++++++--------
.../accumulo/core/volume/NonConfiguredVolume.java | 14 +--
.../apache/accumulo/core/file/rfile/RFileTest.java | 57 +++++-----
.../accumulo/core/security/crypto/CryptoTest.java | 18 +--
.../resources/accumulo-credentialprovider-site.xml | 26 -----
core/src/test/resources/accumulo-site.xml | 24 ----
core/src/test/resources/accumulo.properties | 16 +++
.../test/resources/crypto-off-accumulo-site.xml | 74 -------------
.../src/test/resources/crypto-on-accumulo-site.xml | 72 ------------
.../test/resources/crypto-on-accumulo.properties | 18 +++
minicluster/pom.xml | 4 +
.../apache/accumulo/cluster/AccumuloCluster.java | 8 +-
.../standalone/StandaloneAccumuloCluster.java | 6 +-
.../accumulo/minicluster/MiniAccumuloConfig.java | 2 +-
.../accumulo/minicluster/MiniAccumuloInstance.java | 16 +--
.../accumulo/minicluster/MiniAccumuloRunner.java | 8 +-
.../minicluster/impl/MiniAccumuloClusterImpl.java | 14 +--
.../minicluster/impl/MiniAccumuloConfigImpl.java | 27 ++---
.../minicluster/MiniAccumuloClusterTest.java | 10 +-
server/base/pom.xml | 9 +-
.../apache/accumulo/server/init/Initialize.java | 18 +--
.../org/apache/accumulo/server/util/Admin.java | 22 ++--
.../apache/accumulo/server/util/ChangeSecret.java | 2 +-
.../accumulo/server/util/CleanZookeeper.java | 2 +-
.../apache/accumulo/server/util/ConvertConfig.java | 100 +++++++++++++++++
server/base/src/test/resources/accumulo-site.xml | 32 ------
server/base/src/test/resources/accumulo.properties | 19 ++++
server/gc/src/test/resources/accumulo-site.xml | 24 ----
server/gc/src/test/resources/accumulo.properties | 16 +++
server/master/src/test/resources/accumulo-site.xml | 24 ----
.../master/src/test/resources/accumulo.properties | 16 +++
.../org/apache/accumulo/tserver/NativeMap.java | 2 +-
.../org/apache/accumulo/tserver/TabletServer.java | 2 +-
.../tserver/src/test/resources/accumulo-site.xml | 24 ----
shell/src/test/resources/accumulo-site.xml | 28 -----
start/pom.xml | 4 +
.../start/classloader/AccumuloClassLoader.java | 42 ++-----
.../vfs/AccumuloVFSClassLoaderTest.java | 61 +++--------
.../org/apache/accumulo/test/DumpConfigIT.java | 2 +-
.../org/apache/accumulo/test/ExistingMacIT.java | 6 +-
.../accumulo/test/RewriteTabletDirectoriesIT.java | 4 +-
.../org/apache/accumulo/test/ShellConfigIT.java | 2 +-
.../java/org/apache/accumulo/test/VolumeIT.java | 16 +--
.../accumulo/test/functional/ReadWriteIT.java | 16 +--
.../org/apache/accumulo/test/util/CertUtils.java | 9 +-
55 files changed, 491 insertions(+), 707 deletions(-)
diff --git a/INSTALL.md b/INSTALL.md
index a310142..7863659 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -42,10 +42,10 @@ For convenience, consider adding `accumulo-X.Y.Z/bin/` to your shell's path.
Accumulo requires running [Zookeeper] and [HDFS] instances which should be set up
before configuring Accumulo.
-The primary configuration files for Accumulo are `accumulo-site.xml`, `accumulo-env.sh`,
+The primary configuration files for Accumulo are `accumulo.properties`, `accumulo-env.sh`,
and `accumulo-client.properties` which are located in the `conf/` directory.
-The `accumulo-site.xml` file configures Accumulo server processes (i.e tablet server, master,
+The `accumulo.properties` file configures Accumulo server processes (i.e tablet server, master,
monitor, etc). Follow these steps to set it up:
1. Run `accumulo-util build-native` to build native code. If this command fails, disable
diff --git a/assemble/bin/accumulo-util b/assemble/bin/accumulo-util
index fe62ad3..1a3fb7c 100755
--- a/assemble/bin/accumulo-util
+++ b/assemble/bin/accumulo-util
@@ -113,24 +113,12 @@ function gen_monitor_cert() {
"${JAVA_HOME}/bin/keytool" -import -v -trustcacerts -alias "$ALIAS" -file "$CERTPATH" -keystore "$TRUSTSTOREPATH" -storepass "$STOREPASS" <<< "yes"
echo
- echo "keystore and truststore generated. now add the following to accumulo-site.xml:"
+ echo "keystore and truststore generated. now add the following to accumulo.properties:"
echo
- echo " <property>"
- echo " <name>monitor.ssl.keyStore</name>"
- echo " <value>$KEYSTOREPATH</value>"
- echo " </property>"
- echo " <property>"
- echo " <name>monitor.ssl.keyStorePassword</name>"
- echo " <value>$KEYPASS</value>"
- echo " </property>"
- echo " <property>"
- echo " <name>monitor.ssl.trustStore</name>"
- echo " <value>$TRUSTSTOREPATH</value>"
- echo " </property>"
- echo " <property>"
- echo " <name>monitor.ssl.trustStorePassword</name>"
- echo " <value>$STOREPASS</value>"
- echo " </property>"
+ echo "monitor.ssl.keyStore=$KEYSTOREPATH"
+ echo "monitor.ssl.keyStorePassword=$KEYPASS"
+ echo "monitor.ssl.trustStore=$TRUSTSTOREPATH"
+ echo "monitor.ssl.trustStorePassword=$STOREPASS"
echo
}
@@ -147,20 +135,16 @@ function load_jars_hdfs() {
fi
# Find the system context directory in HDFS
- SYSTEM_CONTEXT_HDFS_DIR=$(grep -A1 "general.vfs.classpaths" "$conf/accumulo-site.xml" | tail -1 | perl -pe 's/\s+<value>//; s/<\/value>//; s/,.+$//; s|[^/]+$||; print $ARGV[1]')
+ SYSTEM_CONTEXT_HDFS_DIR=$(grep "general.vfs.classpaths" "$conf/accumulo.properties" | cut -d '=' -f 2)
if [ -z "$SYSTEM_CONTEXT_HDFS_DIR" ]
then
- echo "Your accumulo-site.xml file is not set up for the HDFS Classloader. Please add the following to your accumulo-site.xml file where ##CLASSPATH## is one of the following formats:"
+ echo "Your accumulo.properties file is not set up for the HDFS Classloader. Please add the following to your accumulo.properties file where ##CLASSPATH## is one of the following formats:"
echo "A single directory: hdfs://host:port/directory/"
echo "A single directory with a regex: hdfs://host:port/directory/.*.jar"
echo "Multiple directories: hdfs://host:port/directory/.*.jar,hdfs://host:port/directory2/"
echo ""
- echo "<property>"
- echo " <name>general.vfs.classpaths</name>"
- echo " <value>##CLASSPATH##</value>"
- echo " <description>location of the jars for the default (system) context</description>"
- echo "</property>"
+ echo "general.vfs.classpaths=##CLASSPATH##"
exit 1
fi
diff --git a/assemble/conf/accumulo-site.xml b/assemble/conf/accumulo-site.xml
deleted file mode 100644
index 6be99e7..0000000
--- a/assemble/conf/accumulo-site.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?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.
--->
-<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
-<!-- This is the main configuration file for Apache Accumulo. Available configuration properties can be
- found in the Accumulo documentation on the Accumulo project website (https://accumulo.apache.org/) -->
-<configuration>
- <!-- Set location in HDFS where Accumulo will store data -->
- <property>
- <name>instance.volumes</name>
- <value>hdfs://localhost:8020/accumulo</value>
- </property>
- <!-- Set location of Zookeepers -->
- <property>
- <name>instance.zookeeper.host</name>
- <value>localhost:2181</value>
- </property>
- <!-- Change secret before initialization. All servers must have same secret -->
- <property>
- <name>instance.secret</name>
- <value>DEFAULT</value>
- </property>
- <!-- Set to false if 'accumulo-util build-native' fails -->
- <property>
- <name>tserver.memory.maps.native.enabled</name>
- <value>true</value>
- </property>
- <!-- Set a correct user/password below -->
- <property>
- <name>trace.user</name>
- <value>root</value>
- </property>
- <property>
- <name>trace.password</name>
- <value>secret</value>
- </property>
-</configuration>
diff --git a/assemble/conf/accumulo.properties b/assemble/conf/accumulo.properties
new file mode 100644
index 0000000..c864424
--- /dev/null
+++ b/assemble/conf/accumulo.properties
@@ -0,0 +1,36 @@
+# 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.
+
+# This is the main configuration file for Apache Accumulo. Available configuration properties can be
+# found in the Accumulo documentation on the Accumulo project website (https://accumulo.apache.org/)
+# Link for Accumulo 2.0: https://accumulo.apache.org/docs/2.0/administration/properties
+
+## Sets location in HDFS where Accumulo will store data
+instance.volumes=hdfs://localhost:8020/accumulo
+
+## Sets location of Zookeepers
+instance.zookeeper.host=localhost:2181
+
+## Change secret before initialization. All Accumulo servers must have same secret
+instance.secret=DEFAULT
+
+## Set to false if 'accumulo-util build-native' fails
+tserver.memory.maps.native.enabled=true
+
+## Trace user
+trace.user=root
+
+## Trace password
+trace.password=secret
diff --git a/client/mapreduce/src/main/java/org/apache/accumulo/core/client/mapreduce/InputTableConfig.java b/client/mapreduce/src/main/java/org/apache/accumulo/core/client/mapreduce/InputTableConfig.java
index 7fd04e2..9dcfdd2 100644
--- a/client/mapreduce/src/main/java/org/apache/accumulo/core/client/mapreduce/InputTableConfig.java
+++ b/client/mapreduce/src/main/java/org/apache/accumulo/core/client/mapreduce/InputTableConfig.java
@@ -197,8 +197,8 @@ public class InputTableConfig implements Writable {
* <p>
* Reading the offline table will create the scan time iterator stack in the map process. So any
* iterators that are configured for the table will need to be on the mapper's classpath. The
- * accumulo-site.xml may need to be on the mapper's classpath if HDFS or the Accumulo directory in
- * HDFS are non-standard.
+ * accumulo.properties may need to be on the mapper's classpath if HDFS or the Accumulo directory
+ * in HDFS are non-standard.
*
* <p>
* One way to use this feature is to clone a table, take the clone offline, and use the clone as
diff --git a/core/src/main/java/org/apache/accumulo/core/cli/ConfigOpts.java b/core/src/main/java/org/apache/accumulo/core/cli/ConfigOpts.java
index 37d6824..4e09504 100644
--- a/core/src/main/java/org/apache/accumulo/core/cli/ConfigOpts.java
+++ b/core/src/main/java/org/apache/accumulo/core/cli/ConfigOpts.java
@@ -35,12 +35,12 @@ public class ConfigOpts extends Help {
private static final Logger log = LoggerFactory.getLogger(ConfigOpts.class);
- @Parameter(names = {"--site", "-site"}, description = "Sets path to accumulo-site.xml. The"
- + " classpath will be searched if this property is not set")
- private String sitePath;
+ @Parameter(names = {"-p", "-props", "--props"}, description = "Sets path to accumulo.properties."
+ + "The classpath will be searched if this property is not set")
+ private String propsPath;
public String getSitePath() {
- return sitePath;
+ return propsPath;
}
public static class NullSplitter implements IParameterSplitter {
@@ -51,7 +51,7 @@ public class ConfigOpts extends Help {
}
@Parameter(names = "-o", splitter = NullSplitter.class,
- description = "Overrides configuration set in accumulo-site.xml (but NOT system-wide config"
+ description = "Overrides configuration set in accumulo.properties (but NOT system-wide config"
+ " set in Zookeeper). Expected format: -o <key>=<value>")
private List<String> overrides = new ArrayList<>();
@@ -59,10 +59,10 @@ public class ConfigOpts extends Help {
public synchronized SiteConfiguration getSiteConfiguration() {
if (siteConfig == null) {
- if (sitePath != null) {
- siteConfig = new SiteConfiguration(new File(sitePath), getOverrides());
+ if (propsPath != null) {
+ siteConfig = new SiteConfiguration(new File(propsPath), getOverrides());
} else {
- siteConfig = new SiteConfiguration(SiteConfiguration.getAccumuloSiteLocation(),
+ siteConfig = new SiteConfiguration(SiteConfiguration.getAccumuloPropsLocation(),
getOverrides());
}
}
diff --git a/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperations.java b/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperations.java
index 6773f12..b9be310 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperations.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperations.java
@@ -26,7 +26,7 @@ public interface InstanceOperations {
/**
* Sets an system property in zookeeper. Tablet servers will pull this setting and override the
- * equivalent setting in accumulo-site.xml. Changes can be seen using
+ * equivalent setting in accumulo.properties. Changes can be seen using
* {@link #getSystemConfiguration()}.
* <p>
* Only some properties can be changed by this method, an IllegalArgumentException will be thrown
@@ -60,16 +60,16 @@ public interface InstanceOperations {
/**
*
* @return A map of system properties set in zookeeper. If a property is not set in zookeeper,
- * then it will return the value set in accumulo-site.xml on some server. If nothing is
- * set in an accumulo-site.xml file it will return the default value for each property.
+ * then it will return the value set in accumulo.properties on some server. If nothing is
+ * set in an accumulo.properties file it will return the default value for each property.
*/
Map<String,String> getSystemConfiguration() throws AccumuloException, AccumuloSecurityException;
/**
*
- * @return A map of system properties set in accumulo-site.xml on some server. If nothing is set
- * in an accumulo-site.xml file it will return the default value for each property.
+ * @return A map of system properties set in accumulo.properties on some server. If nothing is set
+ * in an accumulo.properties file it will return the default value for each property.
*/
Map<String,String> getSiteConfiguration() throws AccumuloException, AccumuloSecurityException;
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ClientConfConverter.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ClientConfConverter.java
index 1b4c530..f2bc74c 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ClientConfConverter.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ClientConfConverter.java
@@ -248,7 +248,7 @@ public class ClientConfConverter {
}
} catch (IOException e) {
log.warn("Failed to extract sensitive properties from Hadoop CredentialProvider, "
- + "falling back to accumulo-site.xml", e);
+ + "falling back to accumulo.properties", e);
}
}
}
diff --git a/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationDocGen.java b/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationDocGen.java
index 4de11f5..ab48996 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationDocGen.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationDocGen.java
@@ -87,7 +87,7 @@ class ConfigurationDocGen {
doc.println("---\n");
doc.println("<!-- WARNING: Do not edit this file. It is a generated file"
+ " that is copied from Accumulo build (from core/target/generated-docs)" + " -->\n");
- doc.println("Below are properties set in `accumulo-site.xml` or the"
+ doc.println("Below are properties set in `accumulo.properties` or the"
+ " Accumulo shell that configure Accumulo servers (i.e tablet server,"
+ " master, etc):\n");
}
@@ -172,7 +172,7 @@ class ConfigurationDocGen {
}
/**
- * Generates documentation for accumulo-site.xml file usage. Arguments are: "--generate-markdown
+ * Generates documentation for accumulo.properties file usage. Arguments are: "--generate-markdown
* filename"
*
* @param args
diff --git a/core/src/main/java/org/apache/accumulo/core/conf/Property.java b/core/src/main/java/org/apache/accumulo/core/conf/Property.java
index 2aaeaeb..a9a4372 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/Property.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/Property.java
@@ -112,7 +112,7 @@ public enum Property {
"A secret unique to a given instance that all servers must know in order"
+ " to communicate with one another. It should be changed prior to the"
+ " initialization of Accumulo. To change it after Accumulo has been"
- + " initialized, use the ChangeSecret tool and then update accumulo-site.xml"
+ + " initialized, use the ChangeSecret tool and then update accumulo.properties"
+ " everywhere. Before using the ChangeSecret tool, make sure Accumulo is not"
+ " running and you are logged in as the user that controls Accumulo files in"
+ " HDFS. To use the ChangeSecret tool, run the command: ./bin/accumulo"
diff --git a/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java b/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java
index 1373444..6e4842a 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java
@@ -24,12 +24,15 @@ import java.net.URISyntaxException;
import java.net.URL;
import java.util.Collections;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.Map;
-import java.util.Map.Entry;
import java.util.function.Predicate;
import org.apache.accumulo.core.util.CachedConfiguration;
-import org.apache.hadoop.conf.Configuration;
+import org.apache.commons.configuration.CompositeConfiguration;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.PropertiesConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -37,13 +40,13 @@ import com.google.common.base.Preconditions;
/**
* An {@link AccumuloConfiguration} which first loads any properties set on the command-line (using
- * the -o option) and then from an XML file, usually accumulo-site.xml. This implementation supports
- * defaulting undefined property values to a parent configuration's definitions.
+ * the -o option) and then from accumulo.properties. This implementation supports defaulting
+ * undefined property values to a parent configuration's definitions.
* <p>
- * The system property "accumulo.configuration" can be used to specify the location of the XML
- * configuration file on the classpath or filesystem if the path is prefixed with 'file://'. If the
- * system property is not defined, it defaults to "accumulo-site.xml" and will look on classpath for
- * file.
+ * The system property "accumulo.configuration" can be used to specify the location of the
+ * properties file on the classpath or filesystem if the path is prefixed with 'file://'. If the
+ * system property is not defined, it defaults to "accumulo.properties" and will look on classpath
+ * for file.
* <p>
* This class is a singleton.
* <p>
@@ -54,42 +57,47 @@ public class SiteConfiguration extends AccumuloConfiguration {
private static final AccumuloConfiguration parent = DefaultConfiguration.getInstance();
+ private CompositeConfiguration internalConfig;
+
private final Map<String,String> overrides;
- private final Configuration xmlConfig;
private final Map<String,String> staticConfigs;
public SiteConfiguration() {
- this(getAccumuloSiteLocation());
+ this(getAccumuloPropsLocation());
}
- public SiteConfiguration(File accumuloSiteFile) {
- this(accumuloSiteFile, Collections.emptyMap());
+ public SiteConfiguration(File accumuloPropsFile) {
+ this(accumuloPropsFile, Collections.emptyMap());
}
- public SiteConfiguration(File accumuloSiteFile, Map<String,String> overrides) {
- this(toURL(accumuloSiteFile), overrides);
+ public SiteConfiguration(File accumuloPropsFile, Map<String,String> overrides) {
+ this(toURL(accumuloPropsFile), overrides);
}
- public SiteConfiguration(URL accumuloSiteLocation) {
- this(accumuloSiteLocation, Collections.emptyMap());
+ public SiteConfiguration(URL accumuloPropsLocation) {
+ this(accumuloPropsLocation, Collections.emptyMap());
}
- public SiteConfiguration(URL accumuloSiteLocation, Map<String,String> overrides) {
+ public SiteConfiguration(URL accumuloPropsLocation, Map<String,String> overrides) {
this.overrides = overrides;
- /*
- * Make a read-only copy of static configs so we can avoid lock contention on the Hadoop
- * Configuration object
- */
- xmlConfig = new Configuration(false);
- if (accumuloSiteLocation != null) {
- xmlConfig.addResource(accumuloSiteLocation);
- }
- final Configuration conf = xmlConfig;
- Map<String,String> temp = new HashMap<>((int) (Math.ceil(conf.size() / 0.75f)), 0.75f);
- for (Entry<String,String> entry : conf) {
- temp.put(entry.getKey(), entry.getValue());
+ init();
+ PropertiesConfiguration config = new PropertiesConfiguration();
+ config.setDelimiterParsingDisabled(true);
+ if (accumuloPropsLocation != null) {
+ try {
+ config.load(accumuloPropsLocation.openStream());
+ } catch (IOException | ConfigurationException e) {
+ throw new IllegalArgumentException(e);
+ }
}
+ internalConfig.addConfiguration(config);
+
+ Map<String,String> temp = new HashMap<>();
+
+ Iterator<String> iter = internalConfig.getKeys();
+ iter.forEachRemaining(key -> temp.put(key, internalConfig.getString(key)));
+
/*
* If any of the configs used in hot codepaths are unset here, set a null so that we'll default
* to the parent config without contending for the Hadoop Configuration object
@@ -110,8 +118,15 @@ public class SiteConfiguration extends AccumuloConfiguration {
}
}
- public static URL getAccumuloSiteLocation() {
- String configFile = System.getProperty("accumulo.configuration", "accumulo-site.xml");
+ public static URL getAccumuloPropsLocation() {
+
+ URL siteUrl = SiteConfiguration.class.getClassLoader().getResource("accumulo-site.xml");
+ if (siteUrl != null) {
+ throw new IllegalArgumentException("Found deprecated config file 'accumulo-site.xml' on "
+ + "classpath. Since 2.0.0, this file was replaced by 'accumulo.properties'.");
+ }
+
+ String configFile = System.getProperty("accumulo.configuration", "accumulo.properties");
if (configFile.startsWith("file://")) {
try {
File f = new File(new URI(configFile));
@@ -138,11 +153,17 @@ public class SiteConfiguration extends AccumuloConfiguration {
}
}
- private Configuration getXmlConfig() {
- if (xmlConfig == null) {
- return new Configuration(false);
+ private void init() {
+ internalConfig = new CompositeConfiguration();
+ internalConfig.setThrowExceptionOnMissing(false);
+ internalConfig.setDelimiterParsingDisabled(true);
+ }
+
+ private synchronized Configuration getConfiguration() {
+ if (internalConfig == null) {
+ init();
}
- return xmlConfig;
+ return internalConfig;
}
@Override
@@ -154,7 +175,7 @@ public class SiteConfiguration extends AccumuloConfiguration {
String key = property.getKey();
// If the property is sensitive, see if CredentialProvider was configured.
if (property.isSensitive()) {
- Configuration hadoopConf = getHadoopConfiguration();
+ org.apache.hadoop.conf.Configuration hadoopConf = getHadoopConfiguration();
if (null != hadoopConf) {
// Try to find the sensitive value from the CredentialProvider
try {
@@ -165,7 +186,7 @@ public class SiteConfiguration extends AccumuloConfiguration {
}
} catch (IOException e) {
log.warn("Failed to extract sensitive property (" + key
- + ") from Hadoop CredentialProvider, falling back to accumulo-site.xml", e);
+ + ") from Hadoop CredentialProvider, falling back to accumulo.properties", e);
}
}
}
@@ -175,7 +196,7 @@ public class SiteConfiguration extends AccumuloConfiguration {
* object.
*/
String value = staticConfigs.containsKey(key) ? staticConfigs.get(key)
- : getXmlConfig().get(key);
+ : getConfiguration().getString(key);
if (value == null || !property.getType().isValidFormat(value)) {
if (value != null)
@@ -192,7 +213,7 @@ public class SiteConfiguration extends AccumuloConfiguration {
Preconditions.checkArgument(!prop.isSensitive(),
"This method not implemented for sensitive props");
return overrides.containsKey(prop.getKey()) || staticConfigs.containsKey(prop.getKey())
- || getXmlConfig().get(prop.getKey()) != null || parent.isPropertySet(prop);
+ || getConfiguration().containsKey(prop.getKey()) || parent.isPropertySet(prop);
}
@Override
@@ -206,12 +227,15 @@ public class SiteConfiguration extends AccumuloConfiguration {
parent.getProperties(props, filter);
}
- for (Entry<String,String> entry : getXmlConfig())
- if (filter.test(entry.getKey()))
- props.put(entry.getKey(), entry.getValue());
+ Iterator<String> iter = getConfiguration().getKeys();
+ iter.forEachRemaining(key -> {
+ if (filter.test(key)) {
+ props.put(key, getConfiguration().getString(key));
+ }
+ });
// CredentialProvider should take precedence over site
- Configuration hadoopConf = getHadoopConfiguration();
+ org.apache.hadoop.conf.Configuration hadoopConf = getHadoopConfiguration();
if (null != hadoopConf) {
try {
for (String key : CredentialProviderFactoryShim.getKeys(hadoopConf)) {
@@ -229,7 +253,7 @@ public class SiteConfiguration extends AccumuloConfiguration {
}
} catch (IOException e) {
log.warn("Failed to extract sensitive properties from Hadoop"
- + " CredentialProvider, falling back to accumulo-site.xml", e);
+ + " CredentialProvider, falling back to accumulo.properties", e);
}
}
if (overrides != null) {
@@ -241,14 +265,15 @@ public class SiteConfiguration extends AccumuloConfiguration {
}
}
- protected Configuration getHadoopConfiguration() {
+ protected org.apache.hadoop.conf.Configuration getHadoopConfiguration() {
String credProviderPathsKey = Property.GENERAL_SECURITY_CREDENTIAL_PROVIDER_PATHS.getKey();
- String credProviderPathsValue = getXmlConfig().get(credProviderPathsKey);
+ String credProviderPathsValue = getConfiguration().getString(credProviderPathsKey);
if (null != credProviderPathsValue) {
// We have configuration for a CredentialProvider
// Try to pull the sensitive password from there
- Configuration conf = new Configuration(CachedConfiguration.getInstance());
+ org.apache.hadoop.conf.Configuration conf = new org.apache.hadoop.conf.Configuration(
+ CachedConfiguration.getInstance());
conf.set(CredentialProviderFactoryShim.CREDENTIAL_PROVIDER_PATH, credProviderPathsValue);
return conf;
}
@@ -277,6 +302,6 @@ public class SiteConfiguration extends AccumuloConfiguration {
* property value
*/
public void set(String key, String value) {
- getXmlConfig().set(key, value);
+ getConfiguration().setProperty(key, value);
}
}
diff --git a/core/src/main/java/org/apache/accumulo/core/volume/NonConfiguredVolume.java b/core/src/main/java/org/apache/accumulo/core/volume/NonConfiguredVolume.java
index 3f319c4..7ca9953 100644
--- a/core/src/main/java/org/apache/accumulo/core/volume/NonConfiguredVolume.java
+++ b/core/src/main/java/org/apache/accumulo/core/volume/NonConfiguredVolume.java
@@ -24,9 +24,9 @@ import org.apache.hadoop.fs.Path;
* Volume implementation which represents a Volume for which we have a FileSystem but no base path
* because it is not configured via {@link Property#INSTANCE_VOLUMES}
*
- * This is useful to handle volumes that have been removed from accumulo-site.xml but references to
- * these volumes have not been updated. This Volume should never be used to create new files, only
- * to read existing files.
+ * This is useful to handle volumes that have been removed from accumulo.properties but references
+ * to these volumes have not been updated. This Volume should never be used to create new files,
+ * only to read existing files.
*/
public class NonConfiguredVolume implements Volume {
private FileSystem fs;
@@ -43,25 +43,25 @@ public class NonConfiguredVolume implements Volume {
@Override
public String getBasePath() {
throw new UnsupportedOperationException(
- "No base path known because this Volume isn't configured in accumulo-site.xml");
+ "No base path known because this Volume isn't configured in accumulo.properties");
}
@Override
public Path prefixChild(Path p) {
throw new UnsupportedOperationException(
- "Cannot prefix path because this Volume isn't configured in accumulo-site.xml");
+ "Cannot prefix path because this Volume isn't configured in accumulo.properties");
}
@Override
public Path prefixChild(String p) {
throw new UnsupportedOperationException(
- "Cannot prefix path because this Volume isn't configured in accumulo-site.xml");
+ "Cannot prefix path because this Volume isn't configured in accumulo.properties");
}
@Override
public boolean isValidPath(Path p) {
throw new UnsupportedOperationException("Cannot determine if path is valid"
- + " because this Volume isn't configured in accumulo-site.xml");
+ + " because this Volume isn't configured in accumulo.properties");
}
@Override
diff --git a/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java b/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
index faf9910..52895b4 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
@@ -53,6 +53,7 @@ import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.conf.ConfigurationCopy;
import org.apache.accumulo.core.conf.DefaultConfiguration;
import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.conf.SiteConfiguration;
import org.apache.accumulo.core.data.ArrayByteSequence;
import org.apache.accumulo.core.data.ByteSequence;
import org.apache.accumulo.core.data.Key;
@@ -1720,7 +1721,7 @@ public class RFileTest {
@Test
public void testOldVersionsWithCrypto() throws Exception {
- AccumuloConfiguration cryptoOnConf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
+ AccumuloConfiguration cryptoOnConf = getAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
runVersionTest(3, cryptoOnConf);
runVersionTest(4, cryptoOnConf);
runVersionTest(6, cryptoOnConf);
@@ -1786,143 +1787,137 @@ public class RFileTest {
reader.close();
}
- public static AccumuloConfiguration setAndGetAccumuloConfig(String cryptoConfSetting) {
- ConfigurationCopy result = new ConfigurationCopy(DefaultConfiguration.getInstance());
- Configuration conf = new Configuration(false);
- conf.addResource(cryptoConfSetting);
- for (Entry<String,String> e : conf) {
- result.set(e.getKey(), e.getValue());
- }
- return result;
+ public static AccumuloConfiguration getAccumuloConfig(String cryptoConfSetting) {
+ return new SiteConfiguration(CryptoTest.class.getClassLoader().getResource(cryptoConfSetting));
}
@Test
public void testEncRFile1() throws Exception {
- conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
+ conf = getAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test1();
conf = null;
}
@Test
public void testEncRFile2() throws Exception {
- conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
+ conf = getAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test2();
conf = null;
}
@Test
public void testEncRFile3() throws Exception {
- conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
+ conf = getAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test3();
conf = null;
}
@Test
public void testEncRFile4() throws Exception {
- conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
+ conf = getAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test4();
conf = null;
}
@Test
public void testEncRFile5() throws Exception {
- conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
+ conf = getAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test5();
conf = null;
}
@Test
public void testEncRFile6() throws Exception {
- conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
+ conf = getAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test6();
conf = null;
}
@Test
public void testEncRFile7() throws Exception {
- conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
+ conf = getAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test7();
conf = null;
}
@Test
public void testEncRFile8() throws Exception {
- conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
+ conf = getAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test8();
conf = null;
}
@Test
public void testEncRFile9() throws Exception {
- conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
+ conf = getAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test9();
conf = null;
}
@Test
public void testEncRFile10() throws Exception {
- conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
+ conf = getAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test10();
conf = null;
}
@Test
public void testEncRFile11() throws Exception {
- conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
+ conf = getAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test11();
conf = null;
}
@Test
public void testEncRFile12() throws Exception {
- conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
+ conf = getAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test12();
conf = null;
}
@Test
public void testEncRFile13() throws Exception {
- conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
+ conf = getAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test13();
conf = null;
}
@Test
public void testEncRFile14() throws Exception {
- conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
+ conf = getAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test14();
conf = null;
}
@Test
public void testEncRFile16() throws Exception {
- conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
+ conf = getAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test16();
}
@Test
public void testEncRFile17() throws Exception {
- conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
+ conf = getAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test17();
}
@Test
public void testEncRFile18() throws Exception {
- conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
+ conf = getAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test18();
conf = null;
}
@Test
public void testEncRFile19() throws Exception {
- conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
+ conf = getAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test19();
conf = null;
}
@Test
public void testEncryptedRFiles() throws Exception {
- conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
+ conf = getAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
test1();
test2();
test3();
@@ -2225,7 +2220,7 @@ public class RFileTest {
@Test
public void testEncSample() throws IOException {
- conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
+ conf = getAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
testSample();
testSampleLG();
conf = null;
@@ -2283,7 +2278,7 @@ public class RFileTest {
@Test
public void testCryptoDoesntLeakSensitive() throws IOException {
- conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
+ conf = getAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
// test an empty file
TestRFile trf = new TestRFile(conf);
@@ -2306,7 +2301,7 @@ public class RFileTest {
public void testRootTabletEncryption() throws Exception {
// This tests that the normal set of operations used to populate a root tablet
- conf = setAndGetAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
+ conf = getAccumuloConfig(CryptoTest.CRYPTO_ON_CONF);
// populate the root tablet with info about the default tablet
// the root tablet contains the key extent and locations of all the
diff --git a/core/src/test/java/org/apache/accumulo/core/security/crypto/CryptoTest.java b/core/src/test/java/org/apache/accumulo/core/security/crypto/CryptoTest.java
index ae284c2..d5496fb 100644
--- a/core/src/test/java/org/apache/accumulo/core/security/crypto/CryptoTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/security/crypto/CryptoTest.java
@@ -17,7 +17,7 @@
package org.apache.accumulo.core.security.crypto;
-import static org.apache.accumulo.core.file.rfile.RFileTest.setAndGetAccumuloConfig;
+import static org.apache.accumulo.core.file.rfile.RFileTest.getAccumuloConfig;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
@@ -76,8 +76,8 @@ public class CryptoTest {
public static final int MARKER_INT = 0xCADEFEDD;
public static final String MARKER_STRING = "1 2 3 4 5 6 7 8 a b c d e f g h ";
- public static final String CRYPTO_ON_CONF = "crypto-on-accumulo-site.xml";
- public static final String CRYPTO_OFF_CONF = "crypto-off-accumulo-site.xml";
+ public static final String CRYPTO_ON_CONF = "crypto-on-accumulo.properties";
+ public static final String CRYPTO_OFF_CONF = "accumulo.properties";
@Rule
public ExpectedException exception = ExpectedException.none();
@@ -104,7 +104,7 @@ public class CryptoTest {
@Test
public void simpleGCMTest() throws Exception {
- AccumuloConfiguration conf = setAndGetAccumuloConfig(CRYPTO_ON_CONF);
+ AccumuloConfiguration conf = getAccumuloConfig(CRYPTO_ON_CONF);
CryptoService cryptoService = new AESCryptoService();
cryptoService.init(conf.getAllPropertiesWithPrefix(Property.INSTANCE_CRYPTO_PREFIX));
@@ -199,7 +199,7 @@ public class CryptoTest {
@Test
public void testRFileEncrypted() throws Exception {
- AccumuloConfiguration cryptoOnConf = setAndGetAccumuloConfig(CRYPTO_ON_CONF);
+ AccumuloConfiguration cryptoOnConf = getAccumuloConfig(CRYPTO_ON_CONF);
FileSystem fs = FileSystem.getLocal(CachedConfiguration.getInstance());
ArrayList<Key> keys = testData();
@@ -224,8 +224,8 @@ public class CryptoTest {
@Test
// This test is to ensure when Crypto is configured that it can read unencrypted files
public void testReadNoCryptoWithCryptoConfigured() throws Exception {
- AccumuloConfiguration cryptoOffConf = setAndGetAccumuloConfig(CRYPTO_OFF_CONF);
- AccumuloConfiguration cryptoOnConf = setAndGetAccumuloConfig(CRYPTO_ON_CONF);
+ AccumuloConfiguration cryptoOffConf = getAccumuloConfig(CRYPTO_OFF_CONF);
+ AccumuloConfiguration cryptoOnConf = getAccumuloConfig(CRYPTO_ON_CONF);
FileSystem fs = FileSystem.getLocal(CachedConfiguration.getInstance());
ArrayList<Key> keys = testData();
@@ -316,7 +316,7 @@ public class CryptoTest {
private <C extends CryptoService> byte[] encrypt(C cs, Scope scope, String configFile)
throws Exception {
- AccumuloConfiguration conf = setAndGetAccumuloConfig(configFile);
+ AccumuloConfiguration conf = getAccumuloConfig(configFile);
cs.init(conf.getAllPropertiesWithPrefix(Property.INSTANCE_CRYPTO_PREFIX));
CryptoEnvironmentImpl env = new CryptoEnvironmentImpl(scope, null);
FileEncrypter encrypter = cs.getFileEncrypter(env);
@@ -344,7 +344,7 @@ public class CryptoTest {
DataInputStream dataIn = new DataInputStream(in);
byte[] params = CryptoUtils.readParams(dataIn);
- AccumuloConfiguration conf = setAndGetAccumuloConfig(configFile);
+ AccumuloConfiguration conf = getAccumuloConfig(configFile);
CryptoService cryptoService = CryptoServiceFactory.newInstance(conf);
CryptoEnvironment env = new CryptoEnvironmentImpl(scope, params);
diff --git a/core/src/test/resources/accumulo-credentialprovider-site.xml b/core/src/test/resources/accumulo-credentialprovider-site.xml
deleted file mode 100644
index a88ef27..0000000
--- a/core/src/test/resources/accumulo-credentialprovider-site.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?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.
--->
-<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
-
-<configuration>
- <property>
- <name>general.security.credential.provider.paths</name>
- <value>file:///</value>
- </property>
-
-</configuration>
diff --git a/core/src/test/resources/accumulo-site.xml b/core/src/test/resources/accumulo-site.xml
deleted file mode 100644
index 9618efb..0000000
--- a/core/src/test/resources/accumulo-site.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
-<!--
- 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.
--->
-
-<configuration>
-
- <!-- This file needs to exists for unit tests -->
-
-</configuration>
diff --git a/core/src/test/resources/accumulo.properties b/core/src/test/resources/accumulo.properties
new file mode 100644
index 0000000..787d51d
--- /dev/null
+++ b/core/src/test/resources/accumulo.properties
@@ -0,0 +1,16 @@
+# 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.
+
+# File needs to exist for unit tests
diff --git a/core/src/test/resources/crypto-off-accumulo-site.xml b/core/src/test/resources/crypto-off-accumulo-site.xml
deleted file mode 100644
index 7896544..0000000
--- a/core/src/test/resources/crypto-off-accumulo-site.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?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.
--->
-<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
-
-<configuration>
-
- <property>
- <name>instance.zookeeper.host</name>
- <value>localhost:2181</value>
- <description>comma separated list of zookeeper servers</description>
- </property>
-
- <property>
- <name>instance.secret</name>
- <value>DEFAULT</value>
- <description>A secret unique to a given instance that all servers must know in order to communicate with one another.
- Change it before initialization. To change it later use ./bin/accumulo org.apache.accumulo.server.util.ChangeSecret [oldpasswd] [newpasswd],
- and then update this file.
- </description>
- </property>
-
- <property>
- <name>tserver.memory.maps.max</name>
- <value>80M</value>
- </property>
-
- <property>
- <name>tserver.cache.data.size</name>
- <value>7M</value>
- </property>
-
- <property>
- <name>tserver.cache.index.size</name>
- <value>20M</value>
- </property>
-
- <property>
- <name>trace.password</name>
- <!--
- change this to the root user's password, and/or change the user below
- -->
- <value>password</value>
- </property>
-
- <property>
- <name>trace.user</name>
- <value>root</value>
- </property>
-
- <property>
- <name>tserver.sort.buffer.size</name>
- <value>50M</value>
- </property>
-
- <property>
- <name>tserver.walog.max.size</name>
- <value>100M</value>
- </property>
-</configuration>
diff --git a/core/src/test/resources/crypto-on-accumulo-site.xml b/core/src/test/resources/crypto-on-accumulo-site.xml
deleted file mode 100644
index 6aab2c2..0000000
--- a/core/src/test/resources/crypto-on-accumulo-site.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
-<!--
- 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.
--->
-
-<configuration>
- <property>
- <name>instance.crypto.service</name>
- <value>org.apache.accumulo.core.security.crypto.impl.AESCryptoService</value>
- </property>
- <property>
- <name>instance.crypto.opts.kekId</name>
- <value>file:///tmp/testAESFile</value>
- </property>
- <property>
- <name>instance.crypto.opts.keyManager</name>
- <value>uri</value>
- </property>
-
- <property>
- <name>instance.zookeeper.host</name>
- <value>localhost:2181</value>
- <description>comma separated list of zookeeper servers</description>
- </property>
- <property>
- <name>instance.secret</name>
- <value>DEFAULT</value>
- <description>A secret unique to a given instance that all servers must know in order to communicate with one another.
- Change it before initialization. To change it later use ./bin/accumulo org.apache.accumulo.server.util.ChangeSecret [oldpasswd] [newpasswd],
- and then update this file.
- </description>
- </property>
-
- <property>
- <name>tserver.memory.maps.max</name>
- <value>80M</value>
- </property>
-
- <property>
- <name>tserver.cache.data.size</name>
- <value>7M</value>
- </property>
-
- <property>
- <name>tserver.cache.index.size</name>
- <value>20M</value>
- </property>
-
- <property>
- <name>tserver.sort.buffer.size</name>
- <value>50M</value>
- </property>
-
- <property>
- <name>tserver.walog.max.size</name>
- <value>512M</value>
- </property>
-</configuration>
diff --git a/core/src/test/resources/crypto-on-accumulo.properties b/core/src/test/resources/crypto-on-accumulo.properties
new file mode 100644
index 0000000..6623b94
--- /dev/null
+++ b/core/src/test/resources/crypto-on-accumulo.properties
@@ -0,0 +1,18 @@
+# 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.
+
+instance.crypto.service=org.apache.accumulo.core.security.crypto.impl.AESCryptoService
+instance.crypto.opts.kekId=file:///tmp/testAESFile
+instance.crypto.opts.keyManager=uri
diff --git a/minicluster/pom.xml b/minicluster/pom.xml
index d3fecf5..bf73807 100644
--- a/minicluster/pom.xml
+++ b/minicluster/pom.xml
@@ -40,6 +40,10 @@
<artifactId>guava</artifactId>
</dependency>
<dependency>
+ <groupId>commons-configuration</groupId>
+ <artifactId>commons-configuration</artifactId>
+ </dependency>
+ <dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
diff --git a/minicluster/src/main/java/org/apache/accumulo/cluster/AccumuloCluster.java b/minicluster/src/main/java/org/apache/accumulo/cluster/AccumuloCluster.java
index 759028d..285f051 100644
--- a/minicluster/src/main/java/org/apache/accumulo/cluster/AccumuloCluster.java
+++ b/minicluster/src/main/java/org/apache/accumulo/cluster/AccumuloCluster.java
@@ -72,14 +72,16 @@ public interface AccumuloCluster {
ClientInfo getClientInfo();
/**
- * Get server side config derived from accumulo-site.xml
+ * Get server side config derived from accumulo.properties
*/
AccumuloConfiguration getSiteConfiguration();
/**
- * Get path to accumulo-site.xml
+ * Get path to accumulo.properties
+ *
+ * @since 2.0.0
*/
- String getSitePath();
+ String getAccumuloPropertiesPath();
/**
* Get an object that can manage a cluster
diff --git a/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneAccumuloCluster.java b/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneAccumuloCluster.java
index b99feed..a309f81 100644
--- a/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneAccumuloCluster.java
+++ b/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneAccumuloCluster.java
@@ -71,7 +71,7 @@ public class StandaloneAccumuloCluster implements AccumuloCluster {
this.tmp = tmp;
this.users = users;
this.serverAccumuloConfDir = serverAccumuloConfDir;
- siteConfig = new SiteConfiguration(new File(serverAccumuloConfDir, "accumulo-site.xml"));
+ siteConfig = new SiteConfiguration(new File(serverAccumuloConfDir, "accumulo.properties"));
}
public String getAccumuloHome() {
@@ -217,7 +217,7 @@ public class StandaloneAccumuloCluster implements AccumuloCluster {
}
@Override
- public String getSitePath() {
- return new File(serverAccumuloConfDir, "accumulo-site.xml").toString();
+ public String getAccumuloPropertiesPath() {
+ return new File(serverAccumuloConfDir, "accumulo.properties").toString();
}
}
diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloConfig.java b/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloConfig.java
index ae6b98f..46489b9 100644
--- a/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloConfig.java
+++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloConfig.java
@@ -76,7 +76,7 @@ public class MiniAccumuloConfig {
* Calling this method is optional. If not set, it defaults to an empty map.
*
* @param siteConfig
- * key/values that you normally put in accumulo-site.xml can be put here.
+ * key/values that you normally put in accumulo.properties can be put here.
*/
public MiniAccumuloConfig setSiteConfig(Map<String,String> siteConfig) {
impl.setSiteConfig(siteConfig);
diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloInstance.java b/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloInstance.java
index c263fa5..bb758d8 100644
--- a/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloInstance.java
+++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloInstance.java
@@ -18,10 +18,9 @@ package org.apache.accumulo.minicluster;
import java.io.File;
import java.io.FileNotFoundException;
-import java.net.MalformedURLException;
import org.apache.accumulo.core.conf.Property;
-import org.apache.hadoop.conf.Configuration;
+import org.apache.accumulo.core.conf.SiteConfiguration;
/**
* @since 1.6.0
@@ -41,16 +40,11 @@ public class MiniAccumuloInstance extends org.apache.accumulo.core.client.ZooKee
}
// Keep this private to avoid bringing it into the public API
- private static String getZooKeepersFromDir(File directory) throws FileNotFoundException {
+ private static String getZooKeepersFromDir(File directory) {
if (!directory.isDirectory())
throw new IllegalArgumentException("Not a directory " + directory.getPath());
- File configFile = new File(new File(directory, "conf"), "accumulo-site.xml");
- Configuration conf = new Configuration(false);
- try {
- conf.addResource(configFile.toURI().toURL());
- } catch (MalformedURLException e) {
- throw new FileNotFoundException("Missing file: " + configFile.getPath());
- }
- return conf.get(Property.INSTANCE_ZK_HOST.getKey());
+ File configFile = new File(new File(directory, "conf"), "accumulo.properties");
+ SiteConfiguration conf = new SiteConfiguration(configFile);
+ return conf.get(Property.INSTANCE_ZK_HOST);
}
}
diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloRunner.java b/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloRunner.java
index 1b3636a..71910b4 100644
--- a/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloRunner.java
+++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloRunner.java
@@ -56,8 +56,8 @@ import com.beust.jcommander.Parameter;
* </pre>
*
* All items in the properties file above are optional and a default value will be provided in their
- * absence. Any site configuration properties (typically found in the accumulo-site.xml file) should
- * be prefixed with "site." in the properties file.
+ * absence. Any site configuration properties (typically found in the accumulo.properties file)
+ * should be prefixed with "site." in the properties file.
*
* @since 1.6.0
*/
@@ -99,8 +99,8 @@ public class MiniAccumuloRunner {
System.out.println("#" + EXISTING_ZOO_KEEPERS_PROP + "=localhost:2181");
System.out.println();
- System.out.println(
- "# Configuration normally placed in accumulo-site.xml can be added using a site. prefix.");
+ System.out.println("# Configuration normally placed in accumulo.properties can be added using"
+ + " a site.* prefix.");
System.out.println(
"# For example the following line will set tserver.compaction.major.concurrent.max");
System.out.println();
diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java
index ac7db48..0d2fb08 100644
--- a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java
+++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java
@@ -350,12 +350,12 @@ public class MiniAccumuloClusterImpl implements AccumuloCluster {
List<String> jvmOpts = new ArrayList<>();
jvmOpts.add("-Xmx" + config.getMemory(serverType));
if (configOverrides != null && !configOverrides.isEmpty()) {
- File siteFile = Files.createTempFile(config.getConfDir().toPath(), "accumulo-site", ".xml")
+ File siteFile = Files.createTempFile(config.getConfDir().toPath(), "accumulo", ".properties")
.toFile();
Map<String,String> confMap = new HashMap<>();
confMap.putAll(config.getSiteConfig());
confMap.putAll(configOverrides);
- writeConfig(siteFile, confMap.entrySet());
+ writeConfigProperties(siteFile, confMap);
jvmOpts.add("-Daccumulo.configuration=" + siteFile.getName());
}
@@ -458,8 +458,8 @@ public class MiniAccumuloClusterImpl implements AccumuloCluster {
File clientPropsFile = config.getClientPropsFile();
writeConfigProperties(clientPropsFile, clientProps);
- File siteFile = new File(config.getConfDir(), "accumulo-site.xml");
- writeConfig(siteFile, config.getSiteConfig().entrySet());
+ File siteFile = new File(config.getConfDir(), "accumulo.properties");
+ writeConfigProperties(siteFile, config.getSiteConfig());
siteConfig = new SiteConfiguration(siteFile);
if (!config.useExistingInstance() && !config.useExistingZooKeepers()) {
@@ -524,7 +524,7 @@ public class MiniAccumuloClusterImpl implements AccumuloCluster {
MiniAccumuloClusterControl control = getClusterControl();
if (config.useExistingInstance()) {
- Configuration acuConf = config.getAccumuloConfiguration();
+ AccumuloConfiguration acuConf = config.getAccumuloConfiguration();
Configuration hadoopConf = config.getHadoopConfiguration();
ConfigurationCopy cc = new ConfigurationCopy(acuConf);
@@ -883,7 +883,7 @@ public class MiniAccumuloClusterImpl implements AccumuloCluster {
}
@Override
- public String getSitePath() {
- return new File(config.getConfDir(), "accumulo-site.xml").toString();
+ public String getAccumuloPropertiesPath() {
+ return new File(config.getConfDir(), "accumulo.properties").toString();
}
}
diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloConfigImpl.java b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloConfigImpl.java
index bd2cddb..7c0e3b7 100644
--- a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloConfigImpl.java
+++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloConfigImpl.java
@@ -24,10 +24,11 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
+import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.conf.ClientProperty;
import org.apache.accumulo.core.conf.CredentialProviderFactoryShim;
-import org.apache.accumulo.core.conf.DefaultConfiguration;
import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.conf.SiteConfiguration;
import org.apache.accumulo.minicluster.MemoryUnit;
import org.apache.accumulo.minicluster.MiniAccumuloCluster;
import org.apache.accumulo.minicluster.ServerType;
@@ -90,7 +91,7 @@ public class MiniAccumuloConfigImpl {
// These are only used on top of existing instances
private Configuration hadoopConf;
- private Configuration accumuloConf;
+ private SiteConfiguration accumuloConf;
/**
* @param dir
@@ -282,7 +283,7 @@ public class MiniAccumuloConfigImpl {
* Calling this method is optional. If not set, it defaults to an empty map.
*
* @param siteConfig
- * key/values that you normally put in accumulo-site.xml can be put here.
+ * key/values that you normally put in accumulo.properties can be put here.
*/
public MiniAccumuloConfigImpl setSiteConfig(Map<String,String> siteConfig) {
if (existingInstance != null && existingInstance)
@@ -573,8 +574,8 @@ public class MiniAccumuloConfigImpl {
return new File(getConfDir(), "client.conf");
}
- public File getAccumuloSiteFile() {
- return new File(getConfDir(), "accumulo-site.xml");
+ public File getAccumuloPropsFile() {
+ return new File(getConfDir(), "accumulo.properties");
}
/**
@@ -690,8 +691,8 @@ public class MiniAccumuloConfigImpl {
* Informs MAC that it's running against an existing accumulo instance. It is assumed that it's
* already initialized and hdfs/zookeeper are already running.
*
- * @param accumuloSite
- * a File representation of the accumulo-site.xml file for the instance being run
+ * @param accumuloProps
+ * a File representation of the accumulo.properties file for the instance being run
* @param hadoopConfDir
* a File representation of the hadoop configuration directory containing core-site.xml
* and hdfs-site.xml
@@ -703,7 +704,7 @@ public class MiniAccumuloConfigImpl {
* @throws IOException
* when there are issues converting the provided Files to URLs
*/
- public MiniAccumuloConfigImpl useExistingInstance(File accumuloSite, File hadoopConfDir)
+ public MiniAccumuloConfigImpl useExistingInstance(File accumuloProps, File hadoopConfDir)
throws IOException {
if (existingInstance != null && !existingInstance)
throw new UnsupportedOperationException(
@@ -711,15 +712,14 @@ public class MiniAccumuloConfigImpl {
this.existingInstance = Boolean.TRUE;
- System.setProperty("accumulo.configuration", "accumulo-site.xml");
+ System.setProperty("accumulo.configuration", "accumulo.properties");
this.hadoopConfDir = hadoopConfDir;
hadoopConf = new Configuration(false);
- accumuloConf = new Configuration(false);
+ accumuloConf = new SiteConfiguration(accumuloProps);
File coreSite = new File(hadoopConfDir, "core-site.xml");
File hdfsSite = new File(hadoopConfDir, "hdfs-site.xml");
try {
- accumuloConf.addResource(accumuloSite.toURI().toURL());
hadoopConf.addResource(coreSite.toURI().toURL());
hadoopConf.addResource(hdfsSite.toURI().toURL());
} catch (MalformedURLException e1) {
@@ -732,9 +732,6 @@ public class MiniAccumuloConfigImpl {
}
_setSiteConfig(siteConfigMap);
- for (Entry<String,String> entry : DefaultConfiguration.getInstance())
- accumuloConf.setIfUnset(entry.getKey(), entry.getValue());
-
return this;
}
@@ -761,7 +758,7 @@ public class MiniAccumuloConfigImpl {
*
* @since 1.6.2
*/
- public Configuration getAccumuloConfiguration() {
+ public AccumuloConfiguration getAccumuloConfiguration() {
return accumuloConf;
}
diff --git a/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterTest.java b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterTest.java
index 909f949..5b5f828 100644
--- a/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterTest.java
+++ b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterTest.java
@@ -43,8 +43,8 @@ import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.security.ColumnVisibility;
import org.apache.accumulo.core.security.TablePermission;
import org.apache.accumulo.core.util.Pair;
+import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.commons.io.FileUtils;
-import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hdfs.DFSConfigKeys;
import org.junit.AfterClass;
import org.junit.Assert;
@@ -229,13 +229,13 @@ public class MiniAccumuloClusterTest {
@Test
public void testRandomPorts() throws Exception {
File confDir = new File(testDir, "conf");
- File accumuloSite = new File(confDir, "accumulo-site.xml");
- Configuration conf = new Configuration(false);
- conf.addResource(accumuloSite.toURI().toURL());
+ File accumuloProps = new File(confDir, "accumulo.properties");
+ PropertiesConfiguration conf = new PropertiesConfiguration();
+ conf.load(accumuloProps);
for (Property randomPortProp : new Property[] {Property.TSERV_CLIENTPORT, Property.MONITOR_PORT,
Property.MONITOR_LOG4J_PORT, Property.MASTER_CLIENTPORT, Property.TRACE_PORT,
Property.GC_PORT}) {
- String value = conf.get(randomPortProp.getKey());
+ String value = conf.getString(randomPortProp.getKey());
Assert.assertNotNull("Found no value for " + randomPortProp, value);
Assert.assertEquals("0", value);
}
diff --git a/server/base/pom.xml b/server/base/pom.xml
index 96523a3..c6cfea2 100644
--- a/server/base/pom.xml
+++ b/server/base/pom.xml
@@ -101,6 +101,10 @@
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client-runtime</artifactId>
<scope>runtime</scope>
@@ -115,11 +119,6 @@
<artifactId>easymock</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
<testResources>
diff --git a/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java b/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java
index 592dd55..365e1bb 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java
@@ -267,7 +267,7 @@ public class Initialize implements KeywordExecutable {
c.println(" bin/accumulo " + org.apache.accumulo.server.util.ChangeSecret.class.getName());
c.println("You will also need to edit your secret in your configuration"
+ " file by adding the property instance.secret to your"
- + " accumulo-site.xml. Without this accumulo will not operate" + " correctly");
+ + " accumulo.properties. Without this accumulo will not operate" + " correctly");
}
try {
if (isInitialized(fs, sconf)) {
@@ -381,7 +381,7 @@ public class Initialize implements KeywordExecutable {
+ " 'fs.default.name') of '{}' was found in the Hadoop configuration",
defaultFsUri);
log.error("FATAL: Please ensure that the Hadoop core-site.xml is on"
- + " the classpath using 'general.classpaths' in accumulo-site.xml");
+ + " the classpath using 'general.classpaths' in accumulo.properties");
}
}
@@ -392,7 +392,7 @@ public class Initialize implements KeywordExecutable {
// When we're using Kerberos authentication, we need valid credentials to perform
// initialization. If the user provided some, use them.
- // If they did not, fall back to the credentials present in accumulo-site.xml that the servers
+ // If they did not, fall back to the credentials present in accumulo.properties that the servers
// will use themselves.
try {
final SiteConfiguration siteConf = context.getServerConfFactory().getSiteConfiguration();
@@ -429,9 +429,9 @@ public class Initialize implements KeywordExecutable {
return false;
}
- if (opts.uploadAccumuloSite) {
+ if (opts.uploadAccumuloProps) {
try {
- log.info("Uploading properties in accumulo-site.xml to Zookeeper."
+ log.info("Uploading properties in accumulo.properties to Zookeeper."
+ " Properties that cannot be set in Zookeeper will be skipped:");
Map<String,String> entries = new TreeMap<>();
siteConfig.getProperties(entries, x -> true, false);
@@ -446,7 +446,7 @@ public class Initialize implements KeywordExecutable {
}
}
} catch (Exception e) {
- log.error("FATAL: Failed to upload accumulo-site.xml to Zookeeper", e);
+ log.error("FATAL: Failed to upload accumulo.properties to Zookeeper", e);
return false;
}
}
@@ -885,9 +885,9 @@ public class Initialize implements KeywordExecutable {
@Parameter(names = "--clear-instance-name",
description = "delete any existing instance name without prompting")
boolean clearInstanceName = false;
- @Parameter(names = "--upload-accumulo-site",
- description = "Uploads properties in accumulo-site.xml to Zookeeper")
- boolean uploadAccumuloSite = false;
+ @Parameter(names = "--upload-accumulo-props",
+ description = "Uploads properties in accumulo.properties to Zookeeper")
+ boolean uploadAccumuloProps = false;
@Parameter(names = "--instance-name",
description = "the instance name, if not provided, will prompt")
String cliInstanceName;
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java b/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java
index 24cf730..7231b8f 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java
@@ -19,7 +19,6 @@ package org.apache.accumulo.server.util;
import static java.util.Objects.requireNonNull;
import java.io.File;
-import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.text.MessageFormat;
@@ -59,7 +58,6 @@ import org.apache.accumulo.server.ServerContext;
import org.apache.accumulo.server.cli.ClientOpts;
import org.apache.accumulo.server.security.SecurityUtil;
import org.apache.accumulo.start.spi.KeywordExecutable;
-import org.apache.hadoop.conf.Configuration;
import org.apache.zookeeper.KeeperException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -415,7 +413,7 @@ public class Admin implements KeywordExecutable {
}
}
- private static final String ACCUMULO_SITE_BACKUP_FILE = "accumulo-site.xml.bak";
+ private static final String ACCUMULO_SITE_BACKUP_FILE = "accumulo.properties.bak";
private static final String NS_FILE_SUFFIX = "_ns.cfg";
private static final String USER_FILE_SUFFIX = "_user.cfg";
private static final MessageFormat configFormat = new MessageFormat("config -t {0} -s {1}\n");
@@ -460,7 +458,7 @@ public class Admin implements KeywordExecutable {
if (opts.allConfiguration) {
// print accumulo site
- printSystemConfiguration(connector, outputDirectory);
+ printSystemConfiguration(outputDirectory);
// print namespaces
for (String namespace : connector.namespaceOperations().list()) {
printNameSpaceConfiguration(connector, namespace, outputDirectory);
@@ -476,7 +474,7 @@ public class Admin implements KeywordExecutable {
}
} else {
if (opts.systemConfiguration) {
- printSystemConfiguration(connector, outputDirectory);
+ printSystemConfiguration(outputDirectory);
}
if (opts.namespaceConfiguration) {
for (String namespace : connector.namespaceOperations().list()) {
@@ -565,26 +563,28 @@ public class Admin implements KeywordExecutable {
userWriter.close();
}
- private void printSystemConfiguration(Connector connector, File outputDirectory)
+ private void printSystemConfiguration(File outputDirectory)
throws IOException, AccumuloException, AccumuloSecurityException {
- Configuration conf = new Configuration(false);
+ TreeMap<String,String> conf = new TreeMap<>();
TreeMap<String,String> site = new TreeMap<>(siteConfig);
for (Entry<String,String> prop : site.entrySet()) {
String defaultValue = getDefaultConfigValue(prop.getKey());
if (!prop.getValue().equals(defaultValue) && !systemConfig.containsKey(prop.getKey())) {
- conf.set(prop.getKey(), prop.getValue());
+ conf.put(prop.getKey(), prop.getValue());
}
}
TreeMap<String,String> system = new TreeMap<>(systemConfig);
for (Entry<String,String> prop : system.entrySet()) {
String defaultValue = getDefaultConfigValue(prop.getKey());
if (!prop.getValue().equals(defaultValue)) {
- conf.set(prop.getKey(), prop.getValue());
+ conf.put(prop.getKey(), prop.getValue());
}
}
File siteBackup = new File(outputDirectory, ACCUMULO_SITE_BACKUP_FILE);
- try (FileOutputStream fos = new FileOutputStream(siteBackup)) {
- conf.writeXml(fos);
+ try (FileWriter fw = new FileWriter(siteBackup)) {
+ for (Entry<String,String> prop : conf.entrySet()) {
+ fw.write(prop.getKey() + "=" + prop.getValue() + "\n");
+ }
}
}
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/ChangeSecret.java b/server/base/src/main/java/org/apache/accumulo/server/util/ChangeSecret.java
index 4817fa4..d6e47c7 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/ChangeSecret.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/ChangeSecret.java
@@ -80,7 +80,7 @@ public class ChangeSecret {
deleteInstance(context, opts.oldPass);
}
System.out.println("New instance id is " + newInstanceId);
- System.out.println("Be sure to put your new secret in accumulo-site.xml");
+ System.out.println("Be sure to put your new secret in accumulo.properties");
}
interface Visitor {
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/CleanZookeeper.java b/server/base/src/main/java/org/apache/accumulo/server/util/CleanZookeeper.java
index 6af70e1..eef44b7 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/CleanZookeeper.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/CleanZookeeper.java
@@ -36,7 +36,7 @@ public class CleanZookeeper {
static class Opts extends Help {
@Parameter(names = {"--password"},
- description = "The system secret, if different than instance.secret in accumulo-site.xml",
+ description = "The system secret, if different than instance.secret in accumulo.properties",
password = true)
String auth;
}
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/ConvertConfig.java b/server/base/src/main/java/org/apache/accumulo/server/util/ConvertConfig.java
new file mode 100644
index 0000000..4e16e28
--- /dev/null
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/ConvertConfig.java
@@ -0,0 +1,100 @@
+/*
+ * 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.
+ */
+package org.apache.accumulo.server.util;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Map;
+import java.util.stream.StreamSupport;
+
+import org.apache.accumulo.core.cli.Help;
+import org.apache.accumulo.start.spi.KeywordExecutable;
+import org.apache.hadoop.conf.Configuration;
+
+import com.beust.jcommander.Parameter;
+import com.google.auto.service.AutoService;
+
+@AutoService(KeywordExecutable.class)
+public class ConvertConfig implements KeywordExecutable {
+
+ @Override
+ public String keyword() {
+ return "convert-config";
+ }
+
+ @Override
+ public UsageGroup usageGroup() {
+ return UsageGroup.OTHER;
+ }
+
+ @Override
+ public String description() {
+ return "Convert Accumulo configuration from XML to properties";
+ }
+
+ static class Opts extends Help {
+
+ @Parameter(names = {"-x", "-xml", "--xml"},
+ description = "Path of accumulo-site.xml to convert from")
+ String xmlPath = "./accumulo-site.xml";
+
+ @Parameter(names = {"-p", "-props", "--props"},
+ description = "Path to create new accumulo.properties")
+ String propsPath = "./accumulo.properties";
+ }
+
+ private static void writeLine(BufferedWriter w, String value) {
+ try {
+ w.write(value + "\n");
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+ }
+
+ @Override
+ public void execute(String[] args) throws Exception {
+ Opts opts = new Opts();
+ opts.parseArgs("accumulo convert-config", args);
+
+ File xmlFile = new File(opts.xmlPath);
+ if (!xmlFile.exists()) {
+ throw new IllegalArgumentException("xml site file does not exist at " + opts.xmlPath);
+ }
+
+ Path propsPath = Paths.get(opts.propsPath);
+ if (propsPath.toFile().exists()) {
+ throw new IllegalArgumentException("properties file already exists at " + opts.propsPath);
+ }
+
+ Configuration xmlConfig = new Configuration(false);
+ xmlConfig.addResource(xmlFile.toURI().toURL());
+
+ try (BufferedWriter w = Files.newBufferedWriter(propsPath, Charset.forName("UTF-8"))) {
+ StreamSupport.stream(xmlConfig.spliterator(), false).sorted(Map.Entry.comparingByKey())
+ .forEach(e -> writeLine(w, e.toString()));
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ new ConvertConfig().execute(args);
+ }
+}
diff --git a/server/base/src/test/resources/accumulo-site.xml b/server/base/src/test/resources/accumulo-site.xml
deleted file mode 100644
index 2aa9fff..0000000
--- a/server/base/src/test/resources/accumulo-site.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?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.
--->
-<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
-
-<configuration>
-
- <property>
- <name>instance.dfs.dir</name>
- <value>${project.build.directory}/instanceTest</value>
- </property>
-
- <property>
- <name>instance.secret</name>
- <value>TEST_SYSTEM_SECRET</value>
- </property>
-
-</configuration>
diff --git a/server/base/src/test/resources/accumulo.properties b/server/base/src/test/resources/accumulo.properties
new file mode 100644
index 0000000..bc14f4a
--- /dev/null
+++ b/server/base/src/test/resources/accumulo.properties
@@ -0,0 +1,19 @@
+# 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.
+
+# File needs to exist for unit tests
+
+instance.dfs.dir=${project.build.directory}/instanceTest
+instance.secret=TEST_SYSTEM_SECRET
diff --git a/server/gc/src/test/resources/accumulo-site.xml b/server/gc/src/test/resources/accumulo-site.xml
deleted file mode 100644
index 9618efb..0000000
--- a/server/gc/src/test/resources/accumulo-site.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
-<!--
- 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.
--->
-
-<configuration>
-
- <!-- This file needs to exists for unit tests -->
-
-</configuration>
diff --git a/server/gc/src/test/resources/accumulo.properties b/server/gc/src/test/resources/accumulo.properties
new file mode 100644
index 0000000..787d51d
--- /dev/null
+++ b/server/gc/src/test/resources/accumulo.properties
@@ -0,0 +1,16 @@
+# 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.
+
+# File needs to exist for unit tests
diff --git a/server/master/src/test/resources/accumulo-site.xml b/server/master/src/test/resources/accumulo-site.xml
deleted file mode 100644
index 9618efb..0000000
--- a/server/master/src/test/resources/accumulo-site.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
-<!--
- 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.
--->
-
-<configuration>
-
- <!-- This file needs to exists for unit tests -->
-
-</configuration>
diff --git a/server/master/src/test/resources/accumulo.properties b/server/master/src/test/resources/accumulo.properties
new file mode 100644
index 0000000..787d51d
--- /dev/null
+++ b/server/master/src/test/resources/accumulo.properties
@@ -0,0 +1,16 @@
+# 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.
+
+# File needs to exist for unit tests
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/NativeMap.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/NativeMap.java
index caff10b..9c6e46b 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/NativeMap.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/NativeMap.java
@@ -98,7 +98,7 @@ public class NativeMap implements Iterable<Map.Entry<Key,Value>> {
if (!isLoaded()) {
log.error(
"FATAL! Accumulo native libraries were requested but could not"
- + " be be loaded. Either set '{}' to false in accumulo-site.xml or make"
+ + " be be loaded. Either set '{}' to false in accumulo.properties or make"
+ " sure native libraries are created in directories set by the JVM"
+ " system property 'accumulo.native.lib.path' in accumulo-env.sh!",
Property.TSERV_NATIVEMAP_ENABLED);
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
index 2ce12d7..fa93c08 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
@@ -2723,7 +2723,7 @@ public class TabletServer implements Runnable {
} catch (KeeperException e) {
if (KeeperException.Code.NOAUTH == e.code()) {
log.error("Failed to write to ZooKeeper. Ensure that"
- + " accumulo-site.xml, specifically instance.secret, is consistent.");
+ + " accumulo.properties, specifically instance.secret, is consistent.");
}
throw e;
}
diff --git a/server/tserver/src/test/resources/accumulo-site.xml b/server/tserver/src/test/resources/accumulo-site.xml
deleted file mode 100644
index 9618efb..0000000
--- a/server/tserver/src/test/resources/accumulo-site.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
-<!--
- 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.
--->
-
-<configuration>
-
- <!-- This file needs to exists for unit tests -->
-
-</configuration>
diff --git a/shell/src/test/resources/accumulo-site.xml b/shell/src/test/resources/accumulo-site.xml
deleted file mode 100644
index b468957..0000000
--- a/shell/src/test/resources/accumulo-site.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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.
--->
-<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
-
-<!-- Test configuration file used for org.apache.accumulo.shell.ShellConfigTest -->
-<configuration>
-
- <property>
- <name>instance.zookeeper.host</name>
- <value>ShellConfigTestZKHostValue</value>
- </property>
-
-</configuration>
diff --git a/start/pom.xml b/start/pom.xml
index c90f493..a61d3ce 100644
--- a/start/pom.xml
+++ b/start/pom.xml
@@ -27,6 +27,10 @@
<description>A library for launching Apache Accumulo services.</description>
<dependencies>
<dependency>
+ <groupId>commons-configuration</groupId>
+ <artifactId>commons-configuration</artifactId>
+ </dependency>
+ <dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
diff --git a/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java b/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java
index 1e4dc14..ae33f58 100644
--- a/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java
+++ b/start/src/main/java/org/apache/accumulo/start/classloader/AccumuloClassLoader.java
@@ -28,15 +28,9 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
+import org.apache.commons.configuration.PropertiesConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
public class AccumuloClassLoader {
@@ -47,7 +41,7 @@ public class AccumuloClassLoader {
private static final Logger log = LoggerFactory.getLogger(AccumuloClassLoader.class);
static {
- String configFile = System.getProperty("accumulo.configuration", "accumulo-site.xml");
+ String configFile = System.getProperty("accumulo.configuration", "accumulo.properties");
if (configFile.startsWith("file://")) {
try {
File f = new File(new URI(configFile));
@@ -69,29 +63,6 @@ public class AccumuloClassLoader {
}
/**
- * Parses an XML Document for a property node for a <name> with the value propertyName if it
- * finds one the function return that property's value for its <value> node. If not found
- * the function will return null.
- *
- * @param d
- * XMLDocument to search through
- */
- private static String getAccumuloProperty(Document d, String propertyName) {
- NodeList pnodes = d.getElementsByTagName("property");
- for (int i = pnodes.getLength() - 1; i >= 0; i--) {
- Element current_property = (Element) pnodes.item(i);
- Node cname = current_property.getElementsByTagName("name").item(0);
- if (cname != null && cname.getTextContent().compareTo(propertyName) == 0) {
- Node cvalue = current_property.getElementsByTagName("value").item(0);
- if (cvalue != null) {
- return cvalue.getTextContent();
- }
- }
- }
- return null;
- }
-
- /**
* Looks for the site configuration file for Accumulo and if it has a property for propertyName
* return it otherwise returns defaultValue Should throw an exception if the default configuration
* can not be read;
@@ -110,10 +81,11 @@ public class AccumuloClassLoader {
return defaultValue;
}
try {
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- DocumentBuilder db = dbf.newDocumentBuilder();
- Document siteDoc = db.parse(accumuloConfigUrl.getFile());
- String value = getAccumuloProperty(siteDoc, propertyName);
+ PropertiesConfiguration config = new PropertiesConfiguration();
+ config.setDelimiterParsingDisabled(true);
+ config.setThrowExceptionOnMissing(false);
+ config.load(accumuloConfigUrl);
+ String value = config.getString(propertyName);
if (value != null)
return value;
return defaultValue;
diff --git a/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoaderTest.java b/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoaderTest.java
index bc066c5..6712414 100644
--- a/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoaderTest.java
+++ b/start/src/test/java/org/apache/accumulo/start/classloader/vfs/AccumuloVFSClassLoaderTest.java
@@ -68,19 +68,10 @@ public class AccumuloVFSClassLoaderTest {
Whitebox.setInternalState(AccumuloVFSClassLoader.class, "loader",
(AccumuloReloadingVFSClassLoader) null);
- File conf = folder1.newFile("accumulo-site.xml");
+ File conf = folder1.newFile("accumulo.properties");
FileWriter out = new FileWriter(conf);
- out.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
- out.append("<configuration>\n");
- out.append("<property>\n");
- out.append("<name>general.classpaths</name>\n");
- out.append("<value></value>\n");
- out.append("</property>\n");
- out.append("<property>\n");
- out.append("<name>general.vfs.classpaths</name>\n");
- out.append("<value></value>\n");
- out.append("</property>\n");
- out.append("</configuration>\n");
+ out.append("general.classpaths=\n");
+ out.append("general.vfs.classpaths=\n");
out.close();
Whitebox.setInternalState(AccumuloClassLoader.class, "accumuloConfigUrl", conf.toURI().toURL());
@@ -103,19 +94,11 @@ public class AccumuloVFSClassLoaderTest {
FileUtils.copyURLToFile(this.getClass().getResource("/HelloWorld.jar"),
folder1.newFile("HelloWorld.jar"));
- File conf = folder1.newFile("accumulo-site.xml");
+ File conf = folder1.newFile("accumulo.properties");
FileWriter out = new FileWriter(conf);
- out.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
- out.append("<configuration>\n");
- out.append("<property>\n");
- out.append("<name>general.classpaths</name>\n");
- out.append("<value></value>\n");
- out.append("</property>\n");
- out.append("<property>\n");
- out.append("<name>general.vfs.classpaths</name>\n");
- out.append("<value>" + new File(folder1.getRoot(), "HelloWorld.jar").toURI() + "</value>\n");
- out.append("</property>\n");
- out.append("</configuration>\n");
+ out.append("general.classpaths=\n");
+ out.append(
+ "general.vfs.classpaths=" + new File(folder1.getRoot(), "HelloWorld.jar").toURI() + "\n");
out.close();
Whitebox.setInternalState(AccumuloClassLoader.class, "accumuloConfigUrl", conf.toURI().toURL());
@@ -140,19 +123,10 @@ public class AccumuloVFSClassLoaderTest {
Whitebox.setInternalState(AccumuloVFSClassLoader.class, "loader",
(AccumuloReloadingVFSClassLoader) null);
- File conf = folder1.newFile("accumulo-site.xml");
+ File conf = folder1.newFile("accumulo.properties");
FileWriter out = new FileWriter(conf);
- out.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
- out.append("<configuration>\n");
- out.append("<property>\n");
- out.append("<name>general.classpaths</name>\n");
- out.append("<value></value>\n");
- out.append("</property>\n");
- out.append("<property>\n");
- out.append("<name>general.vfs.classpaths</name>\n");
- out.append("<value></value>\n");
- out.append("</property>\n");
- out.append("</configuration>\n");
+ out.append("general.classpaths=\n");
+ out.append("general.vfs.classpaths=\n");
out.close();
Whitebox.setInternalState(AccumuloClassLoader.class, "accumuloConfigUrl", conf.toURI().toURL());
@@ -185,19 +159,10 @@ public class AccumuloVFSClassLoaderTest {
(AccumuloReloadingVFSClassLoader) null);
String cacheDir = "/some/random/cache/dir";
- File conf = folder1.newFile("accumulo-site.xml");
+ File conf = folder1.newFile("accumulo.properties");
FileWriter out = new FileWriter(conf);
- out.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
- out.append("<configuration>\n");
- out.append("<property>\n");
- out.append("<name>general.classpaths</name>\n");
- out.append("<value></value>\n");
- out.append("</property>\n");
- out.append("<property>\n");
- out.append("<name>" + AccumuloVFSClassLoader.VFS_CACHE_DIR + "</name>\n");
- out.append("<value>" + cacheDir + "</value>\n");
- out.append("</property>\n");
- out.append("</configuration>\n");
+ out.append("general.classpaths=\n");
+ out.append(AccumuloVFSClassLoader.VFS_CACHE_DIR + "=" + cacheDir + "\n");
out.close();
Whitebox.setInternalState(AccumuloClassLoader.class, "accumuloConfigUrl", conf.toURI().toURL());
diff --git a/test/src/main/java/org/apache/accumulo/test/DumpConfigIT.java b/test/src/main/java/org/apache/accumulo/test/DumpConfigIT.java
index 92c7d1c..a6b88fa 100644
--- a/test/src/main/java/org/apache/accumulo/test/DumpConfigIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/DumpConfigIT.java
@@ -52,7 +52,7 @@ public class DumpConfigIT extends ConfigurableMacBase {
assertTrue(target.exists() || target.mkdirs());
TemporaryFolder folder = new TemporaryFolder(target);
folder.create();
- File siteFileBackup = new File(folder.getRoot(), "accumulo-site.xml.bak");
+ File siteFileBackup = new File(folder.getRoot(), "accumulo.properties.bak");
assertFalse(siteFileBackup.exists());
assertEquals(0,
exec(Admin.class, "dumpConfig", "-a", "-d", folder.getRoot().getPath()).waitFor());
diff --git a/test/src/main/java/org/apache/accumulo/test/ExistingMacIT.java b/test/src/main/java/org/apache/accumulo/test/ExistingMacIT.java
index dc1f5ca..d741b95 100644
--- a/test/src/main/java/org/apache/accumulo/test/ExistingMacIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ExistingMacIT.java
@@ -135,7 +135,7 @@ public class ExistingMacIT extends ConfigurableMacBase {
MiniAccumuloConfigImpl macConfig2 = new MiniAccumuloConfigImpl(testDir2, "notused");
macConfig2.useExistingInstance(
- new File(getCluster().getConfig().getConfDir(), "accumulo-site.xml"), hadoopConfDir);
+ new File(getCluster().getConfig().getConfDir(), "accumulo.properties"), hadoopConfDir);
MiniAccumuloClusterImpl accumulo2 = new MiniAccumuloClusterImpl(macConfig2);
accumulo2.start();
@@ -176,10 +176,10 @@ public class ExistingMacIT extends ConfigurableMacBase {
MiniAccumuloConfigImpl macConfig2 = new MiniAccumuloConfigImpl(testDir2, "notused");
macConfig2.useExistingInstance(
- new File(getCluster().getConfig().getConfDir(), "accumulo-site.xml"), hadoopConfDir);
+ new File(getCluster().getConfig().getConfDir(), "accumulo.properties"), hadoopConfDir);
System.out
- .println("conf " + new File(getCluster().getConfig().getConfDir(), "accumulo-site.xml"));
+ .println("conf " + new File(getCluster().getConfig().getConfDir(), "accumulo.properties"));
MiniAccumuloClusterImpl accumulo2 = new MiniAccumuloClusterImpl(macConfig2);
try {
diff --git a/test/src/main/java/org/apache/accumulo/test/RewriteTabletDirectoriesIT.java b/test/src/main/java/org/apache/accumulo/test/RewriteTabletDirectoriesIT.java
index 4961b6d..42a1189 100644
--- a/test/src/main/java/org/apache/accumulo/test/RewriteTabletDirectoriesIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/RewriteTabletDirectoriesIT.java
@@ -132,10 +132,10 @@ public class RewriteTabletDirectoriesIT extends ConfigurableMacBase {
// add the 2nd volume
Configuration conf = new Configuration(false);
conf.addResource(
- new Path(cluster.getConfig().getConfDir().toURI().toString(), "accumulo-site.xml"));
+ new Path(cluster.getConfig().getConfDir().toURI().toString(), "accumulo.properties"));
conf.set(Property.INSTANCE_VOLUMES.getKey(), v1 + "," + v2);
BufferedOutputStream fos = new BufferedOutputStream(
- new FileOutputStream(new File(cluster.getConfig().getConfDir(), "accumulo-site.xml")));
+ new FileOutputStream(new File(cluster.getConfig().getConfDir(), "accumulo.properties")));
conf.writeXml(fos);
fos.close();
diff --git a/test/src/main/java/org/apache/accumulo/test/ShellConfigIT.java b/test/src/main/java/org/apache/accumulo/test/ShellConfigIT.java
index 6c1d2e8..9841059 100644
--- a/test/src/main/java/org/apache/accumulo/test/ShellConfigIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ShellConfigIT.java
@@ -51,7 +51,7 @@ public class ShellConfigIT extends AccumuloClusterHarness {
// TABLE_VOLUME_CHOOSER is a valid property that can be updated in ZK, whereas the crypto
// properties are not.
// This lets us run this test more generically rather than forcibly needing to update some
- // property in accumulo-site.xml
+ // property in accumulo.properties
origPropValue = conn.instanceOperations().getSystemConfiguration()
.get(PerTableVolumeChooser.TABLE_VOLUME_CHOOSER);
conn.instanceOperations().setProperty(PerTableVolumeChooser.TABLE_VOLUME_CHOOSER,
diff --git a/test/src/main/java/org/apache/accumulo/test/VolumeIT.java b/test/src/main/java/org/apache/accumulo/test/VolumeIT.java
index 0689c62..70619a0 100644
--- a/test/src/main/java/org/apache/accumulo/test/VolumeIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/VolumeIT.java
@@ -287,7 +287,7 @@ public class VolumeIT extends ConfigurableMacBase {
Configuration conf = new Configuration(false);
conf.addResource(
- new Path(cluster.getConfig().getConfDir().toURI().toString(), "accumulo-site.xml"));
+ new Path(cluster.getConfig().getConfDir().toURI().toString(), "accumulo.properties"));
File v3f = new File(volDirBase, "v3");
assertTrue(v3f.mkdir() || v3f.isDirectory());
@@ -295,7 +295,7 @@ public class VolumeIT extends ConfigurableMacBase {
conf.set(Property.INSTANCE_VOLUMES.getKey(), v1 + "," + v2 + "," + v3);
BufferedOutputStream fos = new BufferedOutputStream(
- new FileOutputStream(new File(cluster.getConfig().getConfDir(), "accumulo-site.xml")));
+ new FileOutputStream(new File(cluster.getConfig().getConfDir(), "accumulo.properties")));
conf.writeXml(fos);
fos.close();
@@ -332,7 +332,7 @@ public class VolumeIT extends ConfigurableMacBase {
Configuration conf = new Configuration(false);
conf.addResource(
- new Path(cluster.getConfig().getConfDir().toURI().toString(), "accumulo-site.xml"));
+ new Path(cluster.getConfig().getConfDir().toURI().toString(), "accumulo.properties"));
File v3f = new File(volDirBase, "v3");
assertTrue(v3f.mkdir() || v3f.isDirectory());
@@ -340,7 +340,7 @@ public class VolumeIT extends ConfigurableMacBase {
conf.set(Property.INSTANCE_VOLUMES.getKey(), v2 + "," + v3);
BufferedOutputStream fos = new BufferedOutputStream(
- new FileOutputStream(new File(cluster.getConfig().getConfDir(), "accumulo-site.xml")));
+ new FileOutputStream(new File(cluster.getConfig().getConfDir(), "accumulo.properties")));
conf.writeXml(fos);
fos.close();
@@ -496,11 +496,11 @@ public class VolumeIT extends ConfigurableMacBase {
Configuration conf = new Configuration(false);
conf.addResource(
- new Path(cluster.getConfig().getConfDir().toURI().toString(), "accumulo-site.xml"));
+ new Path(cluster.getConfig().getConfDir().toURI().toString(), "accumulo.properties"));
conf.set(Property.INSTANCE_VOLUMES.getKey(), v2.toString());
BufferedOutputStream fos = new BufferedOutputStream(
- new FileOutputStream(new File(cluster.getConfig().getConfDir(), "accumulo-site.xml")));
+ new FileOutputStream(new File(cluster.getConfig().getConfDir(), "accumulo.properties")));
conf.writeXml(fos);
fos.close();
@@ -554,12 +554,12 @@ public class VolumeIT extends ConfigurableMacBase {
Configuration conf = new Configuration(false);
conf.addResource(
- new Path(cluster.getConfig().getConfDir().toURI().toString(), "accumulo-site.xml"));
+ new Path(cluster.getConfig().getConfDir().toURI().toString(), "accumulo.properties"));
conf.set(Property.INSTANCE_VOLUMES.getKey(), v8 + "," + v9);
conf.set(Property.INSTANCE_VOLUMES_REPLACEMENTS.getKey(), v1 + " " + v8 + "," + v2 + " " + v9);
BufferedOutputStream fos = new BufferedOutputStream(
- new FileOutputStream(new File(cluster.getConfig().getConfDir(), "accumulo-site.xml")));
+ new FileOutputStream(new File(cluster.getConfig().getConfDir(), "accumulo.properties")));
conf.writeXml(fos);
fos.close();
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ReadWriteIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ReadWriteIT.java
index cac9843..7e59edf 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ReadWriteIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ReadWriteIT.java
@@ -149,16 +149,16 @@ public class ReadWriteIT extends AccumuloClusterHarness {
String scheme = "http://";
if (getCluster() instanceof StandaloneAccumuloCluster) {
StandaloneAccumuloCluster standaloneCluster = (StandaloneAccumuloCluster) getCluster();
- File accumuloSite = new File(standaloneCluster.getServerAccumuloConfDir(),
- "accumulo-site.xml");
- if (accumuloSite.isFile()) {
+ File accumuloProps = new File(standaloneCluster.getServerAccumuloConfDir(),
+ "accumulo.properties");
+ if (accumuloProps.isFile()) {
Configuration conf = new Configuration(false);
- conf.addResource(new Path(accumuloSite.toURI()));
+ conf.addResource(new Path(accumuloProps.toURI()));
String monitorSslKeystore = conf.get(Property.MONITOR_SSL_KEYSTORE.getKey());
if (null != monitorSslKeystore) {
log.info(
"Setting scheme to HTTPS since monitor ssl keystore configuration was observed in {}",
- accumuloSite);
+ accumuloProps);
scheme = "https://";
SSLContext ctx = SSLContext.getInstance("SSL");
TrustManager[] tm = {new TestTrustManager()};
@@ -169,7 +169,7 @@ public class ReadWriteIT extends AccumuloClusterHarness {
}
} else {
log.info("{} is not a normal file, not checking for monitor running with SSL",
- accumuloSite);
+ accumuloProps);
}
}
URL url = new URL(scheme + monitorLocation);
@@ -448,8 +448,8 @@ public class ReadWriteIT extends AccumuloClusterHarness {
System.setOut(newOut);
List<String> args = new ArrayList<>();
args.add(entry.getKey().getColumnQualifier().toString());
- args.add("--site");
- args.add(getCluster().getSitePath());
+ args.add("--props");
+ args.add(getCluster().getAccumuloPropertiesPath());
if (ClusterType.STANDALONE == getClusterType() && saslEnabled()) {
args.add("--config");
StandaloneAccumuloCluster sac = (StandaloneAccumuloCluster) cluster;
diff --git a/test/src/main/java/org/apache/accumulo/test/util/CertUtils.java b/test/src/main/java/org/apache/accumulo/test/util/CertUtils.java
index bc86cc5..ef5013a 100644
--- a/test/src/main/java/org/apache/accumulo/test/util/CertUtils.java
+++ b/test/src/main/java/org/apache/accumulo/test/util/CertUtils.java
@@ -109,8 +109,9 @@ public class CertUtils {
description = "RDN string for issuer, for example: 'c=US,o=My Organization,cn=My Name'")
String issuerDirString = "o=Apache Accumulo";
- @Parameter(names = "--site-file", description = "Load configuration from the given site file")
- public String siteFile = null;
+ @Parameter(names = "--accumulo-props",
+ description = "Path to accumulo.properties to load " + "Accumulo configuration from")
+ public String accumuloPropsFile = null;
@Parameter(names = "--signing-algorithm", description = "Algorithm used to sign certificates")
public String signingAlg = "SHA256WITHRSA";
@@ -123,10 +124,10 @@ public class CertUtils {
public int keysize = 2048;
public SiteConfiguration getSiteConfiguration() {
- if (siteFile == null) {
+ if (accumuloPropsFile == null) {
return new SiteConfiguration();
} else {
- return new SiteConfiguration(new File(siteFile));
+ return new SiteConfiguration(new File(accumuloPropsFile));
}
}
}