http://git-wip-us.apache.org/repos/asf/ambari/blob/cc43870d/ambari-server/src/main/java/org/apache/ambari/server/configuration/index_template.md ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/configuration/index_template.md b/ambari-server/src/main/java/org/apache/ambari/server/configuration/index_template.md new file mode 100644 index 0000000..5c52013 --- /dev/null +++ b/ambari-server/src/main/java/org/apache/ambari/server/configuration/index_template.md @@ -0,0 +1,63 @@ +<!--- +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. +--> + +Ambari Server Configuration +--- +- [Introduction](#introduction) +- [Configuration Properties](#configuration-properties) +- [Baseline Values](#baseline-values) +- [Database And Persistence](#db-persistence) + +<a name="introduction"></a> +## Introduction +Ambari Server is configured using a flat text properties file. The file is read once when starting Ambari. Any changes made to the properties file are only reflected after restarting Ambari. + +``` +/etc/ambari-server/conf/ambari.properties +``` + +<a name="configuration-properties"></a> +## Configuration Properties +The following are the properties which can be used to configure Ambari. + +$configuration-properties + +<a name="baseline-values"></a> +## Baseline Values +As the size of a cluster grows, some of the default property values may no longer be sufficient. The below tables offer recommendations on the values of some configuration properties based on the size and usage of the cluster. + +$baseline-values + +<a name="db-persistence"></a> +## Database And Persistence +In addition to the static database connection properties, it's possible to supply custom properties for both EclipseLink and the database driver through `ambari.properties`. + +### Database Driver +Using the `server.jdbc.properties.` prefix, it's possible to supply specific properties to the database driver being used by Ambari. These properties do not affect JPA or any of the persistence-unit operations. They are solely to govern the behavior of the database driver. + +``` +server.jdbc.properties.lockTimeout=15000 +server.jdbc.properties.loginTimeout=15000 +``` + +### Persistence Unit +EclipseLink properties can also be configured using a prefix of `server.persistence.properties.`. The EclipseLink properties should be defined in their entirety with the prefix prepended in front of them. + +``` +server.persistence.properties.eclipselink.jdbc.batch-writing.size=25 +server.persistence.properties.eclipselink.profiler=QueryMonitor +``` \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/cc43870d/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java index 46f6ce5..097f01c 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java @@ -800,7 +800,7 @@ public class AmbariServer { users.createUser("user", "user"); MetainfoEntity schemaVersion = new MetainfoEntity(); - schemaVersion.setMetainfoName(Configuration.SERVER_VERSION.getKey()); + schemaVersion.setMetainfoName(Configuration.SERVER_VERSION_KEY); schemaVersion.setMetainfoValue(VersionUtils.getVersionSubstring(ambariMetaInfo.getServerVersion())); metainfoDAO.create(schemaVersion); http://git-wip-us.apache.org/repos/asf/ambari/blob/cc43870d/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/DatabaseChecker.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/DatabaseChecker.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/DatabaseChecker.java index 722e6f1..d35fc1a 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/DatabaseChecker.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/DatabaseChecker.java @@ -269,7 +269,7 @@ public class DatabaseChecker { metainfoDAO = injector.getInstance(MetainfoDAO.class); } - MetainfoEntity schemaVersionEntity = metainfoDAO.findByKey(Configuration.SERVER_VERSION.getKey()); + MetainfoEntity schemaVersionEntity = metainfoDAO.findByKey(Configuration.SERVER_VERSION_KEY); String schemaVersion = null; if (schemaVersionEntity != null) { http://git-wip-us.apache.org/repos/asf/ambari/blob/cc43870d/ambari-server/src/test/java/org/apache/ambari/server/configuration/ConfigurationTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/configuration/ConfigurationTest.java b/ambari-server/src/test/java/org/apache/ambari/server/configuration/ConfigurationTest.java index 22f4afa..f9b76f8 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/configuration/ConfigurationTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/configuration/ConfigurationTest.java @@ -28,11 +28,15 @@ import static org.powermock.api.easymock.PowerMock.verifyAll; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; +import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.Map; import java.util.Properties; +import org.apache.ambari.annotations.Markdown; import org.apache.ambari.server.AmbariException; +import org.apache.ambari.server.configuration.Configuration.ConfigurationMarkdown; +import org.apache.ambari.server.configuration.Configuration.ConfigurationProperty; import org.apache.ambari.server.configuration.Configuration.ConnectionPoolType; import org.apache.ambari.server.configuration.Configuration.DatabaseType; import org.apache.ambari.server.controller.metrics.ThreadPoolEnabledPropertyProvider; @@ -40,6 +44,7 @@ import org.apache.ambari.server.security.authorization.LdapServerProperties; import org.apache.ambari.server.state.services.MetricsRetrievalService; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.RandomStringUtils; +import org.apache.commons.lang.StringUtils; import org.junit.After; import org.junit.Before; import org.junit.Rule; @@ -178,8 +183,6 @@ public class ConfigurationTest { //Different certificates for two-way SSL and HTTPS Assert.assertFalse(conf.getConfigsMap().get(Configuration.KSTR_NAME.getKey()). equals(conf.getConfigsMap().get(Configuration.CLIENT_API_SSL_KSTR_NAME.getKey()))); - Assert.assertFalse(conf.getConfigsMap().get(Configuration.SRVR_CRT_NAME.getKey()). - equals(conf.getConfigsMap().get(Configuration.CLIENT_API_SSL_CRT_NAME.getKey()))); Assert.assertEquals("keystore.p12", conf.getConfigsMap().get( Configuration.KSTR_NAME.getKey())); @@ -437,7 +440,7 @@ public class ConfigurationTest { ambariProperties.setProperty(Configuration.LDAP_USER_OBJECT_CLASS.getKey(), "10"); ambariProperties.setProperty(Configuration.LDAP_GROUP_BASE.getKey(), "11"); ambariProperties.setProperty(Configuration.LDAP_GROUP_OBJECT_CLASS.getKey(), "12"); - ambariProperties.setProperty(Configuration.LDAP_GROUP_MEMEBERSHIP_ATTR.getKey(), "13"); + ambariProperties.setProperty(Configuration.LDAP_GROUP_MEMBERSHIP_ATTR.getKey(), "13"); ambariProperties.setProperty(Configuration.LDAP_GROUP_NAMING_ATTR.getKey(), "14"); ambariProperties.setProperty(Configuration.LDAP_ADMIN_GROUP_MAPPING_RULES.getKey(), "15"); ambariProperties.setProperty(Configuration.LDAP_GROUP_SEARCH_FILTER.getKey(), "16"); @@ -886,4 +889,35 @@ public class ConfigurationTest { Assert.assertTrue(maxPoolSize > 2 && maxPoolSize <= processorCount * 4); Assert.assertTrue(workerQueueSize >= processorCount * 10); } + + /** + * Tests that every {@link ConfigurationProperty} field in + * {@link Configuration} has a property {@link Markdown} annotation. + * + * @throws Exception + */ + @Test + public void testAllPropertiesHaveMarkdownDescriptions() throws Exception { + Field[] fields = Configuration.class.getDeclaredFields(); + for (Field field : fields) { + if (field.getType() != ConfigurationProperty.class) { + continue; + } + + ConfigurationProperty<?> configurationProperty = (ConfigurationProperty<?>) field.get(null); + Markdown markdown = field.getAnnotation(Markdown.class); + if( null == markdown ){ + ConfigurationMarkdown configMarkdown = field.getAnnotation(ConfigurationMarkdown.class); + markdown = configMarkdown.markdown(); + } + + Assert.assertNotNull("The configuration property " + configurationProperty.getKey() + + " is missing the Markdown annotation", markdown); + + Assert.assertFalse( + "The configuration property " + configurationProperty.getKey() + + " has a Markdown annotation with no description", + StringUtils.isEmpty(markdown.description())); + } + } } http://git-wip-us.apache.org/repos/asf/ambari/blob/cc43870d/ambari-server/src/test/java/org/apache/ambari/server/controller/utilities/DatabaseCheckerTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/utilities/DatabaseCheckerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/utilities/DatabaseCheckerTest.java index 2702fdf..f148da1 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/utilities/DatabaseCheckerTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/utilities/DatabaseCheckerTest.java @@ -69,9 +69,9 @@ public class DatabaseCheckerTest { MetainfoDAO metainfoDAO = createMock(MetainfoDAO.class); MetainfoEntity metainfoEntity = new MetainfoEntity(); String serverVersion = ambariMetaInfo.getServerVersion(); - metainfoEntity.setMetainfoName(Configuration.SERVER_VERSION.getKey()); + metainfoEntity.setMetainfoName(Configuration.SERVER_VERSION_KEY); metainfoEntity.setMetainfoValue(serverVersion); - expect(metainfoDAO.findByKey(Configuration.SERVER_VERSION.getKey())). + expect(metainfoDAO.findByKey(Configuration.SERVER_VERSION_KEY)). andReturn(metainfoEntity); replay(metainfoDAO); DatabaseChecker.metainfoDAO = metainfoDAO; @@ -88,9 +88,9 @@ public class DatabaseCheckerTest { public void testCheckDBVersionInvalid() throws Exception { MetainfoDAO metainfoDAO = createMock(MetainfoDAO.class); MetainfoEntity metainfoEntity = new MetainfoEntity(); - metainfoEntity.setMetainfoName(Configuration.SERVER_VERSION.getKey()); + metainfoEntity.setMetainfoName(Configuration.SERVER_VERSION_KEY); metainfoEntity.setMetainfoValue("0.0.0"); // Incompatible version - expect(metainfoDAO.findByKey(Configuration.SERVER_VERSION.getKey())). + expect(metainfoDAO.findByKey(Configuration.SERVER_VERSION_KEY)). andReturn(metainfoEntity); replay(metainfoDAO); DatabaseChecker.metainfoDAO = metainfoDAO; http://git-wip-us.apache.org/repos/asf/ambari/blob/cc43870d/ambari-server/src/test/java/org/apache/ambari/server/security/ldap/LdapPerformanceTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/security/ldap/LdapPerformanceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/security/ldap/LdapPerformanceTest.java index dbf28be..f770f4c 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/security/ldap/LdapPerformanceTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/security/ldap/LdapPerformanceTest.java @@ -67,7 +67,7 @@ public class LdapPerformanceTest { configuration.setProperty(Configuration.LDAP_USERNAME_ATTRIBUTE.getKey(), "uid"); configuration.setProperty(Configuration.LDAP_GROUP_OBJECT_CLASS.getKey(), "posixGroup"); configuration.setProperty(Configuration.LDAP_GROUP_NAMING_ATTR.getKey(), "cn"); - configuration.setProperty(Configuration.LDAP_GROUP_MEMEBERSHIP_ATTR.getKey(), "memberUid"); + configuration.setProperty(Configuration.LDAP_GROUP_MEMBERSHIP_ATTR.getKey(), "memberUid"); configuration.setProperty(Configuration.LDAP_BASE_DN.getKey(), "dc=apache,dc=org"); configuration.setProperty(Configuration.LDAP_BIND_ANONYMOUSLY.getKey(), String.valueOf(false)); configuration.setProperty(Configuration.LDAP_MANAGER_DN.getKey(), "uid=hdfs,ou=people,ou=dev,dc=apache,dc=org");