瀏覽代碼

AMBARI-14680. Journal node https results JournalsStatus not available in the API (aonishuk)

Andrew Onishuk 9 年之前
父節點
當前提交
b9226d3ea9

+ 8 - 1
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java

@@ -115,6 +115,7 @@ public abstract class AbstractProviderModule implements ProviderModule,
 
 
     componentServiceMap.put("NAMENODE", Service.Type.HDFS);
     componentServiceMap.put("NAMENODE", Service.Type.HDFS);
     componentServiceMap.put("DATANODE", Service.Type.HDFS);
     componentServiceMap.put("DATANODE", Service.Type.HDFS);
+    componentServiceMap.put("JOURNALNODE", Service.Type.HDFS);
     componentServiceMap.put("JOBTRACKER", Service.Type.MAPREDUCE);
     componentServiceMap.put("JOBTRACKER", Service.Type.MAPREDUCE);
     componentServiceMap.put("TASKTRACKER", Service.Type.MAPREDUCE);
     componentServiceMap.put("TASKTRACKER", Service.Type.MAPREDUCE);
     componentServiceMap.put("HBASE_MASTER", Service.Type.HBASE);
     componentServiceMap.put("HBASE_MASTER", Service.Type.HBASE);
@@ -126,6 +127,8 @@ public abstract class AbstractProviderModule implements ProviderModule,
     initPropMap.put("NAMENODE", new String[]{"dfs.http.address", "dfs.namenode.http-address"});
     initPropMap.put("NAMENODE", new String[]{"dfs.http.address", "dfs.namenode.http-address"});
     initPropMap.put("DATANODE", new String[]{"dfs.datanode.http.address"});
     initPropMap.put("DATANODE", new String[]{"dfs.datanode.http.address"});
     initPropMap.put("NAMENODE-HTTPS", new String[]{"dfs.namenode.https-address", "dfs.https.port"});
     initPropMap.put("NAMENODE-HTTPS", new String[]{"dfs.namenode.https-address", "dfs.https.port"});
+    initPropMap.put("JOURNALNODE-HTTPS", new String[]{"dfs.journalnode.https-address"});
+    initPropMap.put("JOURNALNODE", new String[]{"dfs.journalnode.http-address"});
     serviceDesiredProperties.put(Service.Type.HDFS, initPropMap);
     serviceDesiredProperties.put(Service.Type.HDFS, initPropMap);
 
 
     initPropMap = new HashMap<String, String[]>();
     initPropMap = new HashMap<String, String[]>();
@@ -151,6 +154,10 @@ public abstract class AbstractProviderModule implements ProviderModule,
     initPropMap.put("NAMENODE", new String[]{"dfs.http.policy"});
     initPropMap.put("NAMENODE", new String[]{"dfs.http.policy"});
     jmxDesiredProperties.put("NAMENODE", initPropMap);
     jmxDesiredProperties.put("NAMENODE", initPropMap);
 
 
+    initPropMap = new HashMap<String, String[]>();
+    initPropMap.put("JOURNALNODE", new String[]{"dfs.http.policy"});
+    jmxDesiredProperties.put("JOURNALNODE", initPropMap);
+
     initPropMap = new HashMap<String, String[]>();
     initPropMap = new HashMap<String, String[]>();
     initPropMap.put("RESOURCEMANAGER", new String[]{"yarn.http.policy"});
     initPropMap.put("RESOURCEMANAGER", new String[]{"yarn.http.policy"});
     jmxDesiredProperties.put("RESOURCEMANAGER", initPropMap);
     jmxDesiredProperties.put("RESOURCEMANAGER", initPropMap);
@@ -1036,7 +1043,7 @@ public abstract class AbstractProviderModule implements ProviderModule,
     String jmxProtocolString = clusterJmxProtocolMap.get(clusterName);
     String jmxProtocolString = clusterJmxProtocolMap.get(clusterName);
 
 
     try {
     try {
-      if (componentName.equals("NAMENODE") || componentName.equals("RESOURCEMANAGER")) {
+      if (componentName.equals("NAMENODE") || componentName.equals("RESOURCEMANAGER") || componentName.equals("JOURNALNODE")) {
         Service.Type service = componentServiceMap.get(componentName);
         Service.Type service = componentServiceMap.get(componentName);
         String config = serviceConfigTypes.get(service);
         String config = serviceConfigTypes.get(service);
         String newSiteConfigVersion = getDesiredConfigVersion(clusterName, config);
         String newSiteConfigVersion = getDesiredConfigVersion(clusterName, config);

+ 24 - 0
ambari-server/src/test/java/org/apache/ambari/server/controller/internal/JMXHostProviderTest.java

@@ -75,6 +75,8 @@ public class JMXHostProviderTest {
   private static final String RESOURCEMANAGER_HTTPS_PORT = "yarn.resourcemanager.webapp.https.address";
   private static final String RESOURCEMANAGER_HTTPS_PORT = "yarn.resourcemanager.webapp.https.address";
   private static final String YARN_HTTPS_POLICY = "yarn.http.policy";
   private static final String YARN_HTTPS_POLICY = "yarn.http.policy";
   private static final String NODEMANAGER_PORT = "yarn.nodemanager.webapp.address";
   private static final String NODEMANAGER_PORT = "yarn.nodemanager.webapp.address";
+  private static final String JOURNALNODE_HTTPS_PORT = "dfs.journalnode.https-address";
+  private static final String HDFS_HTTPS_POLICY = "dfs.http.policy";
 
 
   @Before
   @Before
   public void setup() throws Exception {
   public void setup() throws Exception {
@@ -227,6 +229,7 @@ public class JMXHostProviderTest {
     String componentName2 = "DATANODE";
     String componentName2 = "DATANODE";
     String componentName3 = "HDFS_CLIENT";
     String componentName3 = "HDFS_CLIENT";
     String componentName4 = "RESOURCEMANAGER";
     String componentName4 = "RESOURCEMANAGER";
+    String componentName5 = "JOURNALNODE";
 
 
     createServiceComponent(clusterName, serviceName, componentName1,
     createServiceComponent(clusterName, serviceName, componentName1,
       State.INIT);
       State.INIT);
@@ -236,6 +239,8 @@ public class JMXHostProviderTest {
       State.INIT);
       State.INIT);
     createServiceComponent(clusterName, serviceName2, componentName4,
     createServiceComponent(clusterName, serviceName2, componentName4,
       State.INIT);
       State.INIT);
+    createServiceComponent(clusterName, serviceName, componentName5,
+        State.INIT);
 
 
     String host1 = "h1";
     String host1 = "h1";
     clusters.addHost(host1);
     clusters.addHost(host1);
@@ -262,6 +267,10 @@ public class JMXHostProviderTest {
       host2, null);
       host2, null);
     createServiceComponentHost(clusterName, serviceName, componentName3,
     createServiceComponentHost(clusterName, serviceName, componentName3,
       host1, null);
       host1, null);
+    createServiceComponentHost(clusterName, serviceName, componentName5,
+      host1, null);
+    createServiceComponentHost(clusterName, serviceName, componentName5,
+      host2, null);
     createServiceComponentHost(clusterName, serviceName, componentName3,
     createServiceComponentHost(clusterName, serviceName, componentName3,
       host2, null);
       host2, null);
     createServiceComponentHost(clusterName, serviceName2, componentName4,
     createServiceComponentHost(clusterName, serviceName2, componentName4,
@@ -272,6 +281,8 @@ public class JMXHostProviderTest {
     configs.put(NAMENODE_PORT_V1, "localhost:${ambari.dfs.datanode.http.port}");
     configs.put(NAMENODE_PORT_V1, "localhost:${ambari.dfs.datanode.http.port}");
     configs.put(DATANODE_PORT, "localhost:70075");
     configs.put(DATANODE_PORT, "localhost:70075");
     configs.put("ambari.dfs.datanode.http.port", "70070");
     configs.put("ambari.dfs.datanode.http.port", "70070");
+    configs.put(JOURNALNODE_HTTPS_PORT, "localhost:8481");
+    configs.put(HDFS_HTTPS_POLICY, "HTTPS_ONLY");
 
 
     Map<String, String> yarnConfigs = new HashMap<String, String>();
     Map<String, String> yarnConfigs = new HashMap<String, String>();
     yarnConfigs.put(RESOURCEMANAGER_PORT, "8088");
     yarnConfigs.put(RESOURCEMANAGER_PORT, "8088");
@@ -404,6 +415,19 @@ public class JMXHostProviderTest {
 
 
   }
   }
 
 
+  @Test
+  public void testJMXJournalNodeHttpsPort() throws
+    NoSuchParentResourceException,
+    ResourceAlreadyExistsException, UnsupportedPropertyException,
+    SystemException, AmbariException, NoSuchResourceException {
+    createConfigs();
+    JMXHostProviderModule providerModule = new JMXHostProviderModule();
+    providerModule.registerResourceProvider(Resource.Type.Cluster);
+    providerModule.registerResourceProvider(Resource.Type.Configuration);
+    Assert.assertEquals("https", providerModule.getJMXProtocol("c1", "JOURNALNODE"));
+    Assert.assertEquals("8481", providerModule.getPort("c1", "JOURNALNODE", true));
+  }
+
   @Test
   @Test
   public void testJMXPortMapUpdate() throws
   public void testJMXPortMapUpdate() throws
     NoSuchParentResourceException,
     NoSuchParentResourceException,