From 570d7f30720f1e7ac2f7fc7ec58952bed6c9555a Mon Sep 17 00:00:00 2001 From: Eric Yang Date: Wed, 28 Mar 2018 20:17:37 -0400 Subject: [PATCH] YARN-8069. Clean up example hostnames for RegistryDNS. Contributed by Billie Rinaldi (cherry picked from commit 3d185d62fc392dd5313f8e36b9674b9200638463) --- .../registry/server/dns/TestRegistryDNS.java | 66 +++++++++---------- .../test/resources/0.17.172.in-addr.arpa.zone | 24 +++---- .../markdown/yarn-service/Configurations.md | 4 +- 3 files changed, 47 insertions(+), 47 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/test/java/org/apache/hadoop/registry/server/dns/TestRegistryDNS.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/test/java/org/apache/hadoop/registry/server/dns/TestRegistryDNS.java index 9c369d0e2a5..bce73ad4de6 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/test/java/org/apache/hadoop/registry/server/dns/TestRegistryDNS.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/test/java/org/apache/hadoop/registry/server/dns/TestRegistryDNS.java @@ -156,7 +156,7 @@ public class TestRegistryDNS extends Assert { protected Configuration createConfiguration() { Configuration conf = new Configuration(); - conf.set(RegistryConstants.KEY_DNS_DOMAIN, "hwx.test"); + conf.set(RegistryConstants.KEY_DNS_DOMAIN, "dev.test"); conf.set(RegistryConstants.KEY_DNS_ZONE_SUBNET, "172.17.0"); conf.setTimeDuration(RegistryConstants.KEY_DNS_TTL, 30L, TimeUnit.SECONDS); return conf; @@ -179,39 +179,39 @@ public class TestRegistryDNS extends Assert { "/registry/users/root/services/org-apache-slider/test1/", record); // start assessing whether correct records are available - Record[] recs = assertDNSQuery("test1.root.hwx.test."); + Record[] recs = assertDNSQuery("test1.root.dev.test."); assertEquals("wrong result", "192.168.1.5", ((ARecord) recs[0]).getAddress().getHostAddress()); - recs = assertDNSQuery("management-api.test1.root.hwx.test.", 2); - assertEquals("wrong target name", "test1.root.hwx.test.", + recs = assertDNSQuery("management-api.test1.root.dev.test.", 2); + assertEquals("wrong target name", "test1.root.dev.test.", ((CNAMERecord) recs[0]).getTarget().toString()); assertTrue("not an ARecord", recs[isSecure() ? 2 : 1] instanceof ARecord); - recs = assertDNSQuery("appmaster-ipc-api.test1.root.hwx.test.", + recs = assertDNSQuery("appmaster-ipc-api.test1.root.dev.test.", Type.SRV, 1); assertTrue("not an SRV record", recs[0] instanceof SRVRecord); assertEquals("wrong port", 1026, ((SRVRecord) recs[0]).getPort()); - recs = assertDNSQuery("appmaster-ipc-api.test1.root.hwx.test.", 2); - assertEquals("wrong target name", "test1.root.hwx.test.", + recs = assertDNSQuery("appmaster-ipc-api.test1.root.dev.test.", 2); + assertEquals("wrong target name", "test1.root.dev.test.", ((CNAMERecord) recs[0]).getTarget().toString()); assertTrue("not an ARecord", recs[isSecure() ? 2 : 1] instanceof ARecord); - recs = assertDNSQuery("http-api.test1.root.hwx.test.", 2); - assertEquals("wrong target name", "test1.root.hwx.test.", + recs = assertDNSQuery("http-api.test1.root.dev.test.", 2); + assertEquals("wrong target name", "test1.root.dev.test.", ((CNAMERecord) recs[0]).getTarget().toString()); assertTrue("not an ARecord", recs[isSecure() ? 2 : 1] instanceof ARecord); - recs = assertDNSQuery("http-api.test1.root.hwx.test.", Type.SRV, + recs = assertDNSQuery("http-api.test1.root.dev.test.", Type.SRV, 1); assertTrue("not an SRV record", recs[0] instanceof SRVRecord); assertEquals("wrong port", 1027, ((SRVRecord) recs[0]).getPort()); - assertDNSQuery("test1.root.hwx.test.", Type.TXT, 3); - assertDNSQuery("appmaster-ipc-api.test1.root.hwx.test.", Type.TXT, 1); - assertDNSQuery("http-api.test1.root.hwx.test.", Type.TXT, 1); - assertDNSQuery("management-api.test1.root.hwx.test.", Type.TXT, 1); + assertDNSQuery("test1.root.dev.test.", Type.TXT, 3); + assertDNSQuery("appmaster-ipc-api.test1.root.dev.test.", Type.TXT, 1); + assertDNSQuery("http-api.test1.root.dev.test.", Type.TXT, 1); + assertDNSQuery("management-api.test1.root.dev.test.", Type.TXT, 1); } @Test @@ -225,11 +225,11 @@ public class TestRegistryDNS extends Assert { // start assessing whether correct records are available Record[] recs = - assertDNSQuery("ctr-e50-1451931954322-0016-01-000002.hwx.test."); + assertDNSQuery("ctr-e50-1451931954322-0016-01-000002.dev.test."); assertEquals("wrong result", "172.17.0.19", ((ARecord) recs[0]).getAddress().getHostAddress()); - recs = assertDNSQuery("comp-name.test1.root.hwx.test.", 1); + recs = assertDNSQuery("comp-name.test1.root.dev.test.", 1); assertTrue("not an ARecord", recs[0] instanceof ARecord); } @@ -243,7 +243,7 @@ public class TestRegistryDNS extends Assert { record); Name name = - Name.fromString("ctr-e50-1451931954322-0016-01-000002.hwx.test."); + Name.fromString("ctr-e50-1451931954322-0016-01-000002.dev.test."); Record question = Record.newRecord(name, Type.A, DClass.IN); Message query = Message.newQuery(question); byte[] responseBytes = registryDNS.generateReply(query, null); @@ -263,12 +263,12 @@ public class TestRegistryDNS extends Assert { // start assessing whether correct records are available Record[] recs = assertDNSQuery( - "ctr-e50-1451931954322-0016-01-000002.hwx.test."); + "ctr-e50-1451931954322-0016-01-000002.dev.test."); assertEquals("wrong result", "172.17.0.19", ((ARecord) recs[0]).getAddress().getHostAddress()); assertEquals("wrong ttl", 30L, recs[0].getTTL()); - recs = assertDNSQuery("comp-name.test1.root.hwx.test.", 1); + recs = assertDNSQuery("comp-name.test1.root.dev.test.", 1); assertTrue("not an ARecord", recs[0] instanceof ARecord); assertEquals("wrong ttl", 30L, recs[0].getTTL()); @@ -286,7 +286,7 @@ public class TestRegistryDNS extends Assert { // start assessing whether correct records are available Record[] recs = assertDNSQuery("19.0.17.172.in-addr.arpa.", Type.PTR, 1); assertEquals("wrong result", - "comp-name.test1.root.hwx.test.", + "comp-name.test1.root.dev.test.", ((PTRRecord) recs[0]).getTarget().toString()); } @@ -294,7 +294,7 @@ public class TestRegistryDNS extends Assert { public void testReverseLookupInLargeNetwork() throws Exception { setRegistryDNS(new RegistryDNS("TestRegistry")); Configuration conf = createConfiguration(); - conf.set(RegistryConstants.KEY_DNS_DOMAIN, "hwx.test"); + conf.set(RegistryConstants.KEY_DNS_DOMAIN, "dev.test"); conf.set(KEY_DNS_ZONE_SUBNET, "172.17.0.0"); conf.set(KEY_DNS_ZONE_MASK, "255.255.224.0"); conf.setTimeDuration(RegistryConstants.KEY_DNS_TTL, 30L, TimeUnit.SECONDS); @@ -312,7 +312,7 @@ public class TestRegistryDNS extends Assert { // start assessing whether correct records are available Record[] recs = assertDNSQuery("19.0.17.172.in-addr.arpa.", Type.PTR, 1); assertEquals("wrong result", - "comp-name.test1.root.hwx.test.", + "comp-name.test1.root.dev.test.", ((PTRRecord) recs[0]).getTarget().toString()); } @@ -348,7 +348,7 @@ public class TestRegistryDNS extends Assert { // start assessing whether correct records are available Name name = - Name.fromString("ctr-e50-1451931954322-0016-01-000002.hwx.test."); + Name.fromString("ctr-e50-1451931954322-0016-01-000002.dev.test."); Record question = Record.newRecord(name, Type.A, DClass.IN); Message query = Message.newQuery(question); @@ -431,7 +431,7 @@ public class TestRegistryDNS extends Assert { // KeyFactory keyFactory = KeyFactory.getInstance("RSA"); // PublicKey pubKey = keyFactory.generatePublic(keySpec); DNSKEYRecord dnskeyRecord = - new DNSKEYRecord(Name.fromString("hwxstg.site."), DClass.IN, 0, + new DNSKEYRecord(Name.fromString("dev.test."), DClass.IN, 0, DNSKEYRecord.Flags.ZONE_KEY, DNSKEYRecord.Protocol.DNSSEC, DNSSEC.Algorithm.RSASHA256, @@ -486,11 +486,11 @@ public class TestRegistryDNS extends Assert { // start assessing whether correct records are available Record[] recs = assertDNSQuery( - "ctr-e50-1451931954322-0016-01-000002.hwx.test.", Type.AAAA, 1); + "ctr-e50-1451931954322-0016-01-000002.dev.test.", Type.AAAA, 1); assertEquals("wrong result", "172.17.0.19", ((AAAARecord) recs[0]).getAddress().getHostAddress()); - recs = assertDNSQuery("comp-name.test1.root.hwx.test.", Type.AAAA, 1); + recs = assertDNSQuery("comp-name.test1.root.dev.test.", Type.AAAA, 1); assertTrue("not an ARecord", recs[0] instanceof AAAARecord); } @@ -504,7 +504,7 @@ public class TestRegistryDNS extends Assert { record); // start assessing whether correct records are available - Name name = Name.fromString("missing.hwx.test."); + Name name = Name.fromString("missing.dev.test."); Record question = Record.newRecord(name, Type.A, DClass.IN); Message query = Message.newQuery(question); @@ -533,7 +533,7 @@ public class TestRegistryDNS extends Assert { public void testReadMasterFile() throws Exception { setRegistryDNS(new RegistryDNS("TestRegistry")); Configuration conf = new Configuration(); - conf.set(RegistryConstants.KEY_DNS_DOMAIN, "hwx.test"); + conf.set(RegistryConstants.KEY_DNS_DOMAIN, "dev.test"); conf.set(RegistryConstants.KEY_DNS_ZONE_SUBNET, "172.17.0"); conf.setTimeDuration(RegistryConstants.KEY_DNS_TTL, 30L, TimeUnit.SECONDS); conf.set(RegistryConstants.KEY_DNS_ZONES_DIR, @@ -561,17 +561,17 @@ public class TestRegistryDNS extends Assert { // start assessing whether correct records are available Record[] recs = - assertDNSQuery("ctr-e50-1451931954322-0016-01-000002.hwx.test."); + assertDNSQuery("ctr-e50-1451931954322-0016-01-000002.dev.test."); assertEquals("wrong result", "172.17.0.19", ((ARecord) recs[0]).getAddress().getHostAddress()); - recs = assertDNSQuery("comp-name.test1.root.hwx.test.", 1); + recs = assertDNSQuery("comp-name.test1.root.dev.test.", 1); assertTrue("not an ARecord", recs[0] instanceof ARecord); // lookup dyanmic reverse records recs = assertDNSQuery("19.0.17.172.in-addr.arpa.", Type.PTR, 1); assertEquals("wrong result", - "comp-name.test1.root.hwx.test.", + "comp-name.test1.root.dev.test.", ((PTRRecord) recs[0]).getTarget().toString()); // now lookup static reverse records @@ -583,7 +583,7 @@ public class TestRegistryDNS extends Assert { byte[] responseBytes = getRegistryDNS().generateReply(query, null); Message response = new Message(responseBytes); recs = response.getSectionArray(Section.ANSWER); - assertEquals("wrong result", "cn005.hwx.test.", + assertEquals("wrong result", "cn005.dev.test.", ((PTRRecord) recs[0]).getTarget().toString()); } @@ -636,7 +636,7 @@ public class TestRegistryDNS extends Assert { public void testExternalCNAMERecord() throws Exception { setRegistryDNS(new RegistryDNS("TestRegistry")); Configuration conf = new Configuration(); - conf.set(RegistryConstants.KEY_DNS_DOMAIN, "hwx.test"); + conf.set(RegistryConstants.KEY_DNS_DOMAIN, "dev.test"); conf.set(RegistryConstants.KEY_DNS_ZONE_SUBNET, "172.17.0"); conf.setTimeDuration(RegistryConstants.KEY_DNS_TTL, 30L, TimeUnit.SECONDS); conf.set(RegistryConstants.KEY_DNS_ZONES_DIR, diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/test/resources/0.17.172.in-addr.arpa.zone b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/test/resources/0.17.172.in-addr.arpa.zone index 0165f0de25a..08071e2728e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/test/resources/0.17.172.in-addr.arpa.zone +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-registry/src/test/resources/0.17.172.in-addr.arpa.zone @@ -19,18 +19,18 @@ $ORIGIN . $TTL 1800 ; 30 minutes 0.17.172.in-addr.arpa IN SOA ns.hwhq.hortonworks.com. it.hortonworks.com. ( - 2015081000 ; serial - 10800 ; refresh (3 hours) - 900 ; retry (15 minutes) - 1814400 ; expire (3 weeks) - 10800 ; minimum (3 hours) + 2015081000 ; serial + 10800 ; refresh (3 hours) + 900 ; retry (15 minutes) + 1814400 ; expire (3 weeks) + 10800 ; minimum (3 hours) ) - NS ns.hwhq.hortonworks.com. - NS ns2.hwhq.hortonworks.com. + NS ns.hwhq.hortonworks.com. + NS ns2.hwhq.hortonworks.com. $ORIGIN 0.17.172.in-addr.arpa. -5 PTR cn005.hwx.test. -6 PTR cn006.hwx.test. -7 PTR cn007.hwx.test. -8 PTR cn008.hwx.test. -9 PTR cn009.hwx.test. +5 PTR cn005.dev.test. +6 PTR cn006.dev.test. +7 PTR cn007.dev.test. +8 PTR cn008.dev.test. +9 PTR cn009.dev.test. diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/yarn-service/Configurations.md b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/yarn-service/Configurations.md index c2e6d260f0f..88550757645 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/yarn-service/Configurations.md +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/yarn-service/Configurations.md @@ -141,12 +141,12 @@ User can use these constants in their configurations to be dynamically substitut ``` Here, `COMPONENT_INSTANCE_NAME` and `SERVICE_NAME` are the constants to be substituted by the system. -Suppose the `COMPONENT_INSTANCE_NAME` is `regionserver-0` and `SERVICE_NAME` is defined by user as `hbase`, user name is `devuser` and domain name is `hwxdev.site`. +Suppose the `COMPONENT_INSTANCE_NAME` is `regionserver-0` and `SERVICE_NAME` is defined by user as `hbase`, user name is `devuser` and domain name is `dev.test`. Then, the config will be substituted by the service AM and written in the config file `/etc/hadoop/hbase-site.xml` inside the container as below: ``` hbase.regionserver.hostname - regionserver-0.hbase.devuser.hwxdev.site + regionserver-0.hbase.devuser.dev.test ``` where `regionserver-0` is the actual component instance name assigned by the system for this container.