From d2e2869ade51fb7db8d86da42ef1ffef0db5dd06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elek=20M=C3=A1rton?= Date: Thu, 25 Jun 2020 11:36:35 +0200 Subject: [PATCH 01/21] fix1 --- .../java/org/apache/hadoop/ozone/OmUtils.java | 4 +- .../hadoop/ozone/shell/TestOzoneShellHA.java | 36 ++++++++---------- .../fs/ozone/BasicOzoneClientAdapterImpl.java | 20 ++++++---- .../BasicRootedOzoneClientAdapterImpl.java | 37 +++++++++---------- .../hadoop/ozone/shell/OzoneAddress.java | 12 ++++-- 5 files changed, 58 insertions(+), 51 deletions(-) diff --git a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/OmUtils.java b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/OmUtils.java index 94bd33e4b603..a2b3fe229fd4 100644 --- a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/OmUtils.java +++ b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/OmUtils.java @@ -167,6 +167,7 @@ public static InetSocketAddress getOmAddressForClients( /** * Returns true if OZONE_OM_SERVICE_IDS_KEY is defined and not empty. + * * @param conf Configuration * @return true if OZONE_OM_SERVICE_IDS_KEY is defined and not empty; * else false. @@ -178,7 +179,8 @@ public static boolean isServiceIdsDefined(ConfigurationSource conf) { /** * Returns true if HA for OzoneManager is configured for the given service id. - * @param conf Configuration + * + * @param conf Configuration * @param serviceId OM HA cluster service ID * @return true if HA is configured in the configuration; else false. */ diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneShellHA.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneShellHA.java index e340d40b6f55..a8d01d8439c8 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneShellHA.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneShellHA.java @@ -17,7 +17,14 @@ */ package org.apache.hadoop.ozone.shell; -import com.google.common.base.Strings; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.PrintStream; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; + import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.FileUtil; @@ -33,9 +40,15 @@ import org.apache.hadoop.ozone.om.OzoneManager; import org.apache.hadoop.test.GenericTestUtils; import org.apache.hadoop.util.ToolRunner; + +import com.google.common.base.Strings; +import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.FS_TRASH_INTERVAL_KEY; +import static org.apache.hadoop.fs.FileSystem.FS_DEFAULT_NAME_KEY; +import static org.apache.hadoop.ozone.OzoneConsts.OZONE_OFS_URI_SCHEME; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; +import static org.junit.Assert.fail; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Rule; @@ -50,19 +63,6 @@ import picocli.CommandLine.ParseResult; import picocli.CommandLine.RunLast; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.PrintStream; -import java.util.Arrays; -import java.util.List; -import java.util.UUID; - -import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.FS_TRASH_INTERVAL_KEY; -import static org.apache.hadoop.fs.FileSystem.FS_DEFAULT_NAME_KEY; -import static org.apache.hadoop.ozone.OzoneConsts.OZONE_OFS_URI_SCHEME; -import static org.junit.Assert.fail; - /** * This class tests Ozone sh shell command. * Inspired by TestS3Shell @@ -345,11 +345,7 @@ private int getNumOfBuckets(String bucketPrefix) { */ @Test public void testOzoneShCmdURIs() { - // Test case 1: ozone sh volume create /volume - // Expectation: Failure. - String[] args = new String[] {"volume", "create", "/volume"}; - executeWithError(ozoneShell, args, - "Service ID or host name must not be omitted"); + // Get leader OM node RPC address from ozone.om.address.omServiceId.omNode String omLeaderNodeId = getLeaderOMNodeId(); @@ -366,7 +362,7 @@ public void testOzoneShCmdURIs() { // TODO: Fix this behavior, then uncomment the execute() below. String setOmAddress = "--set=" + OMConfigKeys.OZONE_OM_ADDRESS_KEY + "=" + omLeaderNodeAddr; - args = new String[] {setOmAddress, + String[] args = new String[] {setOmAddress, "volume", "create", "o3://" + omLeaderNodeAddrWithoutPort + "/volume2"}; //execute(ozoneShell, args); diff --git a/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneClientAdapterImpl.java b/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneClientAdapterImpl.java index a2f4c174b964..1e032c3eab19 100644 --- a/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneClientAdapterImpl.java +++ b/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneClientAdapterImpl.java @@ -59,6 +59,7 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import static org.apache.hadoop.ozone.OzoneConsts.OZONE_URI_DELIMITER; +import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_SERVICE_IDS_KEY; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -106,14 +107,17 @@ public BasicOzoneClientAdapterImpl(String omHost, int omPort, throws IOException { OzoneConfiguration conf = OzoneConfiguration.of(hadoopConf); - if (omHost == null && OmUtils.isServiceIdsDefined(conf)) { - // When the host name or service id isn't given - // but ozone.om.service.ids is defined, declare failure. - - // This is a safety precaution that prevents the client from - // accidentally failing over to an unintended OM. - throw new IllegalArgumentException("Service ID or host name must not" - + " be omitted when ozone.om.service.ids is defined."); + if (omHost == null) { + String[] omServiceIds = + conf.getTrimmedStrings(OZONE_OM_SERVICE_IDS_KEY); + + // When host is not specified + if (omServiceIds.length != 1) { + throw new IllegalArgumentException("Service ID or host name must not" + + " be omitted when multiple ozone.om.service.ids is defined."); + } + + omHost = omServiceIds[0]; } if (omPort != -1) { diff --git a/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java b/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java index b4bb16f06721..d3b5c4277eae 100644 --- a/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java +++ b/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java @@ -27,8 +27,6 @@ import java.util.Iterator; import java.util.List; -import com.google.common.base.Preconditions; -import org.apache.commons.collections.CollectionUtils; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.crypto.key.KeyProvider; @@ -62,20 +60,18 @@ import org.apache.hadoop.security.token.Token; import org.apache.hadoop.security.token.TokenRenewer; +import com.google.common.base.Preconditions; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import static org.apache.hadoop.ozone.OzoneConsts.OZONE_URI_DELIMITER; +import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_SERVICE_IDS_KEY; +import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes.BUCKET_ALREADY_EXISTS; +import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes.BUCKET_NOT_FOUND; +import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes.VOLUME_ALREADY_EXISTS; +import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes.VOLUME_NOT_FOUND; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import static org.apache.hadoop.ozone.OzoneConsts.OZONE_URI_DELIMITER; -import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes - .BUCKET_ALREADY_EXISTS; -import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes - .VOLUME_ALREADY_EXISTS; -import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes - .VOLUME_NOT_FOUND; -import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes - .BUCKET_NOT_FOUND; - /** * Basic Implementation of the RootedOzoneFileSystem calls. *

@@ -132,14 +128,17 @@ public BasicRootedOzoneClientAdapterImpl(String omHost, int omPort, try { OzoneConfiguration conf = OzoneConfiguration.of(hadoopConf); - if (omHost == null && OmUtils.isServiceIdsDefined(conf)) { - // When the host name or service id isn't given - // but ozone.om.service.ids is defined, declare failure. + if (omHost == null) { + String[] omServiceIds = + conf.getTrimmedStrings(OZONE_OM_SERVICE_IDS_KEY); + + // When host is not specified + if (omServiceIds.length != 1) { + throw new IllegalArgumentException("Service ID or host name must not" + + " be omitted when multiple ozone.om.service.ids is defined."); + } - // This is a safety precaution that prevents the client from - // accidentally failing over to an unintended OM. - throw new IllegalArgumentException("Service ID or host name must not" - + " be omitted when ozone.om.service.ids is defined."); + omHost = omServiceIds[0]; } if (omPort != -1) { diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/OzoneAddress.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/OzoneAddress.java index 1d753287cf0c..2bb31c82ca31 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/OzoneAddress.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/OzoneAddress.java @@ -21,6 +21,7 @@ import java.io.PrintStream; import java.net.URI; import java.net.URISyntaxException; +import java.util.Collection; import org.apache.hadoop.hdds.conf.OzoneConfiguration; import org.apache.hadoop.ozone.OmUtils; @@ -116,12 +117,17 @@ public OzoneClient createClient(OzoneConfiguration conf) .getRpcClient(ozoneURI.getHost(), ozoneURI.getPort(), conf); } } else { + + Collection omServiceIds = conf.getTrimmedStringCollection( + OZONE_OM_SERVICE_IDS_KEY); + // When host is not specified - if (OmUtils.isServiceIdsDefined(conf)) { + if (omServiceIds.size() != 1) { throw new OzoneClientException("Service ID or host name must not" - + " be omitted when ozone.om.service.ids is defined."); + + " be omitted when multiple ozone.om.service.ids is defined."); } - client = OzoneClientFactory.getRpcClient(conf); + client = OzoneClientFactory + .getRpcClient(omServiceIds.iterator().next(), conf); } } else { throw new OzoneClientException( From bd8b353f9157183c92d6fdcfed237532cd68a3e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elek=20M=C3=A1rton?= Date: Thu, 25 Jun 2020 12:27:11 +0200 Subject: [PATCH 02/21] update om ha compose fix --- .../compose/{ozone-om-ha-s3 => ozone-ha}/.env | 0 .../main/compose/ozone-ha/docker-compose.yaml | 93 ++++++++++++ .../docker-config | 24 ++-- .../{ozone-om-ha-s3 => ozone-ha}/test.sh | 9 +- .../ozone-om-ha-s3/docker-compose.yaml | 90 ------------ .../dist/src/main/compose/ozone-om-ha/.env | 18 --- .../compose/ozone-om-ha/.ssh/authorized_keys | 16 --- .../src/main/compose/ozone-om-ha/.ssh/config | 18 --- .../main/compose/ozone-om-ha/.ssh/environment | 16 --- .../src/main/compose/ozone-om-ha/.ssh/id_rsa | 27 ---- .../main/compose/ozone-om-ha/.ssh/id_rsa.pub | 1 - .../src/main/compose/ozone-om-ha/Dockerfile | 49 ------- .../compose/ozone-om-ha/docker-compose.yaml | 99 ------------- .../main/compose/ozone-om-ha/docker-config | 88 ------------ .../src/main/compose/ozone-om-ha/startOM.sh | 28 ---- .../src/main/compose/ozone-om-ha/stopOM.sh | 20 --- .../main/compose/ozone-om-ha/test_disabled.sh | 41 ------ .../smoketest/basic/ozone-shell-lib.robot | 136 ++++++++++++++++++ .../smoketest/basic/ozone-shell-single.robot | 27 ++++ .../main/smoketest/basic/ozone-shell.robot | 119 +-------------- 20 files changed, 270 insertions(+), 649 deletions(-) rename hadoop-ozone/dist/src/main/compose/{ozone-om-ha-s3 => ozone-ha}/.env (100%) create mode 100644 hadoop-ozone/dist/src/main/compose/ozone-ha/docker-compose.yaml rename hadoop-ozone/dist/src/main/compose/{ozone-om-ha-s3 => ozone-ha}/docker-config (66%) rename hadoop-ozone/dist/src/main/compose/{ozone-om-ha-s3 => ozone-ha}/test.sh (91%) mode change 100644 => 100755 delete mode 100644 hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/docker-compose.yaml delete mode 100644 hadoop-ozone/dist/src/main/compose/ozone-om-ha/.env delete mode 100644 hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/authorized_keys delete mode 100644 hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/config delete mode 100644 hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/environment delete mode 100644 hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/id_rsa delete mode 100644 hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/id_rsa.pub delete mode 100644 hadoop-ozone/dist/src/main/compose/ozone-om-ha/Dockerfile delete mode 100644 hadoop-ozone/dist/src/main/compose/ozone-om-ha/docker-compose.yaml delete mode 100644 hadoop-ozone/dist/src/main/compose/ozone-om-ha/docker-config delete mode 100755 hadoop-ozone/dist/src/main/compose/ozone-om-ha/startOM.sh delete mode 100755 hadoop-ozone/dist/src/main/compose/ozone-om-ha/stopOM.sh delete mode 100644 hadoop-ozone/dist/src/main/compose/ozone-om-ha/test_disabled.sh create mode 100644 hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell-lib.robot create mode 100644 hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell-single.robot diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/.env b/hadoop-ozone/dist/src/main/compose/ozone-ha/.env similarity index 100% rename from hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/.env rename to hadoop-ozone/dist/src/main/compose/ozone-ha/.env diff --git a/hadoop-ozone/dist/src/main/compose/ozone-ha/docker-compose.yaml b/hadoop-ozone/dist/src/main/compose/ozone-ha/docker-compose.yaml new file mode 100644 index 000000000000..b9f4b60702c6 --- /dev/null +++ b/hadoop-ozone/dist/src/main/compose/ozone-ha/docker-compose.yaml @@ -0,0 +1,93 @@ +# 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. + +version: "3.4" + +# reusable fragments (see https://docs.docker.com/compose/compose-file/#extension-fields) +x-common-config: + &common-config + image: apache/ozone-runner:${OZONE_RUNNER_VERSION} + volumes: + - ../..:/opt/hadoop + env_file: + - docker-config + +x-replication: + &replication + OZONE-SITE.XML_ozone.replication: ${OZONE_REPLICATION_FACTOR:-1} + +services: + datanode: + <<: *common-config + ports: + - 9864 + - 9882 + environment: + <<: *replication + command: ["ozone","datanode"] + om1: + <<: *common-config + environment: + ENSURE_OM_INITIALIZED: /data/metadata/om/current/VERSION + <<: *replication + ports: + - 9874 + - 9862 + hostname: om1 + command: ["ozone","om"] + om2: + <<: *common-config + environment: + ENSURE_OM_INITIALIZED: /data/metadata/om/current/VERSION + <<: *replication + ports: + - 9874 + - 9862 + hostname: om2 + command: ["ozone","om"] + om3: + <<: *common-config + environment: + ENSURE_OM_INITIALIZED: /data/metadata/om/current/VERSION + <<: *replication + ports: + - 9874 + - 9862 + hostname: om3 + command: ["ozone","om"] + scm: + <<: *common-config + ports: + - 9876:9876 + environment: + ENSURE_SCM_INITIALIZED: /data/metadata/scm/current/VERSION + OZONE-SITE.XML_hdds.scm.safemode.min.datanode: ${OZONE_SAFEMODE_MIN_DATANODES:-1} + <<: *replication + command: ["ozone","scm"] + s3g: + <<: *common-config + environment: + <<: *replication + ports: + - 9878:9878 + command: ["ozone","s3g"] + recon: + <<: *common-config + ports: + - 9888:9888 + environment: + <<: *replication + command: ["ozone","recon"] diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/docker-config b/hadoop-ozone/dist/src/main/compose/ozone-ha/docker-config similarity index 66% rename from hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/docker-config rename to hadoop-ozone/dist/src/main/compose/ozone-ha/docker-config index 69138d145deb..bfdc910e97a3 100644 --- a/hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/docker-config +++ b/hadoop-ozone/dist/src/main/compose/ozone-ha/docker-config @@ -14,24 +14,22 @@ # See the License for the specific language governing permissions and # limitations under the License. -CORE-SITE.XML_fs.o3fs.impl=org.apache.hadoop.fs.ozone.OzoneFileSystem -CORE-SITE.XML_fs.defaultFS=o3fs://bucket.volume.id1 -OZONE-SITE.XML_ozone.om.service.ids=id1 -OZONE-SITE.XML_ozone.om.nodes.id1=om1,om2,om3 -OZONE-SITE.XML_ozone.om.address.id1.om1=om1 -OZONE-SITE.XML_ozone.om.address.id1.om2=om2 -OZONE-SITE.XML_ozone.om.address.id1.om3=om3 +CORE-SITE.XML_fs.defaultFS=o3fs://bucket1.volume1.omservice + +OZONE-SITE.XML_ozone.om.service.ids=omservice +OZONE-SITE.XML_ozone.om.nodes.omservice=om1,om2,om3 +OZONE-SITE.XML_ozone.om.address.omservice.om1=om1 +OZONE-SITE.XML_ozone.om.address.omservice.om2=om2 +OZONE-SITE.XML_ozone.om.address.omservice.om3=om3 OZONE-SITE.XML_ozone.om.ratis.enable=true -OZONE-SITE.XML_ozone.scm.container.size=1GB -OZONE-SITE.XML_ozone.scm.pipeline.owner.container.count=1 + OZONE-SITE.XML_ozone.scm.names=scm OZONE-SITE.XML_ozone.scm.datanode.id.dir=/data OZONE-SITE.XML_ozone.scm.block.client.address=scm +OZONE-SITE.XML_ozone.scm.container.size=1GB OZONE-SITE.XML_ozone.metadata.dirs=/data/metadata -OZONE-SITE.XML_ozone.handler.type=distributed OZONE-SITE.XML_ozone.scm.client.address=scm -OZONE-SITE.XML_ozone.replication=3 +OZONE-SITE.XML_ozone.client.failover.max.attempts=6 OZONE-SITE.XML_hdds.datanode.dir=/data/hdds -OZONE-SITE.XML_hdds.profiler.endpoint.enabled=true -no_proxy=om,scm,s3g,kdc,localhost,127.0.0.1 +no_proxy=om1,om2,om3,scm,s3g,kdc,localhost,127.0.0.1 \ No newline at end of file diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/test.sh b/hadoop-ozone/dist/src/main/compose/ozone-ha/test.sh old mode 100644 new mode 100755 similarity index 91% rename from hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/test.sh rename to hadoop-ozone/dist/src/main/compose/ozone-ha/test.sh index 719ad4cbba21..491e8bb8fc9d --- a/hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/test.sh +++ b/hadoop-ozone/dist/src/main/compose/ozone-ha/test.sh @@ -19,18 +19,13 @@ COMPOSE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" export COMPOSE_DIR export SECURITY_ENABLED=false -export OM_SERVICE_ID="id1" +export OZONE_REPLICATION_FACTOR=3 # shellcheck source=/dev/null source "$COMPOSE_DIR/../testlib.sh" start_docker_env -execute_robot_test scm s3 - -execute_robot_test scm freon - -stop_docker_env +execute_robot_test scm basic/ozone-shell-single.robot generate_report - diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/docker-compose.yaml b/hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/docker-compose.yaml deleted file mode 100644 index ff7f260c44e0..000000000000 --- a/hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/docker-compose.yaml +++ /dev/null @@ -1,90 +0,0 @@ -# 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. - -version: "3" -services: - datanode: - image: apache/ozone-runner:${OZONE_RUNNER_VERSION} - privileged: true #required by the profiler - volumes: - - ../..:/opt/hadoop - ports: - - 9864 - command: ["/opt/hadoop/bin/ozone","datanode"] - env_file: - - ./docker-config - om1: - image: apache/ozone-runner:${OZONE_RUNNER_VERSION} - privileged: true #required by the profiler - volumes: - - ../..:/opt/hadoop - ports: - - 9880:9874 - - 9890:9872 - environment: - ENSURE_OM_INITIALIZED: /data/metadata/om/current/VERSION - env_file: - - ./docker-config - command: ["/opt/hadoop/bin/ozone","om"] - om2: - image: apache/ozone-runner:${OZONE_RUNNER_VERSION} - privileged: true #required by the profiler - volumes: - - ../..:/opt/hadoop - ports: - - 9882:9874 - - 9892:9872 - environment: - ENSURE_OM_INITIALIZED: /data/metadata/om/current/VERSION - env_file: - - ./docker-config - command: ["/opt/hadoop/bin/ozone","om"] - om3: - image: apache/ozone-runner:${OZONE_RUNNER_VERSION} - privileged: true #required by the profiler - volumes: - - ../..:/opt/hadoop - ports: - - 9884:9874 - - 9894:9872 - environment: - ENSURE_OM_INITIALIZED: /data/metadata/om/current/VERSION - env_file: - - ./docker-config - command: ["/opt/hadoop/bin/ozone","om"] - scm: - image: apache/ozone-runner:${OZONE_RUNNER_VERSION} - privileged: true #required by the profiler - volumes: - - ../..:/opt/hadoop - ports: - - 9876:9876 - env_file: - - ./docker-config - environment: - ENSURE_SCM_INITIALIZED: /data/metadata/scm/current/VERSION - OZONE-SITE.XML_hdds.scm.safemode.min.datanode: "${OZONE_SAFEMODE_MIN_DATANODES:-1}" - command: ["/opt/hadoop/bin/ozone","scm"] - s3g: - image: apache/ozone-runner:${OZONE_RUNNER_VERSION} - volumes: - - ../..:/opt/hadoop - ports: - - 9878:9878 - env_file: - - ./docker-config - command: ["ozone","s3g"] - diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.env b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.env deleted file mode 100644 index 96ab163b4747..000000000000 --- a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.env +++ /dev/null @@ -1,18 +0,0 @@ -# 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. - -HDDS_VERSION=${hdds.version} -OZONE_RUNNER_VERSION=${docker.ozone-runner.version} diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/authorized_keys b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/authorized_keys deleted file mode 100644 index ae390529c7eb..000000000000 --- a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/authorized_keys +++ /dev/null @@ -1,16 +0,0 @@ -# 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. -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDgEmLpYm4BrWtq1KG9hhZXCZgGrETntu0eNTo21U3VKc9nH9/ot7M6lAawsFcT9uXu4b58PTlnfvwH/TATlCFjC8n0Z7SOx+FU6L3Sn8URh9HaX4L0tF8u87oCAD4dBrUGhhB36eiuH9dBBWly6RKffYJvrjatbc7GxBO/e5OSUMtqk/DSVKksmBhZxutrKivCNjDish9ViGIf8b5yS/MlEGmaVKApik1fJ5iOlloM/GgpB60YV/hbqfCecbWgeiM1gK92gdOcA/Wx1C7fj8BSI5iDSE6eZeF80gM3421lvyPDWyVhFaGbka4rXBX/fb9QSRBA9RTqhRKAEmAIf49H hadoop@cdae967fa87a diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/config b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/config deleted file mode 100644 index 6506916ded0f..000000000000 --- a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/config +++ /dev/null @@ -1,18 +0,0 @@ -# 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. -Host * - UserKnownHostsFile /dev/null - StrictHostKeyChecking no diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/environment b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/environment deleted file mode 100644 index cbde0f2078df..000000000000 --- a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/environment +++ /dev/null @@ -1,16 +0,0 @@ -# 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. -JAVA_HOME=/usr/lib/jvm/jre diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/id_rsa b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/id_rsa deleted file mode 100644 index b4b1604f806e..000000000000 --- a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/id_rsa +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEA4BJi6WJuAa1ratShvYYWVwmYBqxE57btHjU6NtVN1SnPZx/f -6LezOpQGsLBXE/bl7uG+fD05Z378B/0wE5QhYwvJ9Ge0jsfhVOi90p/FEYfR2l+C -9LRfLvO6AgA+HQa1BoYQd+norh/XQQVpcukSn32Cb642rW3OxsQTv3uTklDLapPw -0lSpLJgYWcbrayorwjYw4rIfVYhiH/G+ckvzJRBpmlSgKYpNXyeYjpZaDPxoKQet -GFf4W6nwnnG1oHojNYCvdoHTnAP1sdQu34/AUiOYg0hOnmXhfNIDN+NtZb8jw1sl -YRWhm5GuK1wV/32/UEkQQPUU6oUSgBJgCH+PRwIDAQABAoIBAQDI1TH6ZNKchkck -9XgSWsBjOqIcOQN5fCeDT8nho8WjLVpL3/Hcr+ngsxRcAXHK3xyvw33r9SQic1qJ -/pC8u6RBFivo95qJ7vU0GXcp9TG4yLd6tui1U4WMm784U+dYNM7EDh1snSaECt3v -1V3yNJ0QfnoOh2NShn0zAkOA+M4H8Nx2SudMCsjcbK9+fYxzW3hX+sJpMKdjG1HW -DUz+I7cW7t0EGaVrgVSV+eR58LiXu+14YDNMrySiejB4nD2sKrx93XgiCBECCsBN -GLQGJCztaXoAY+5Kf/aJ9EEf2wBF3GecRk+XIAd87PeDmeahLQAVkAJ/rD1vsKFs -8kWi6CrhAoGBAP7leG/dMBhlfvROpBddIfWm2i8B+oZiAlSjdYGz+/ZhUaByXk18 -pupMGiiMQR1ziPnEg0gNgR2ZkH54qrXPn5WcQa4rlSEtUsZEp5v5WblhfX2QwKzY -G/uhA+mB7wXpQkSmXo0LclfPF2teROQrG1OyfWkWbxFH4i3+em7sL95jAoGBAOEK -v+wscqkMLW7Q8ONbWMCCBlmMHr6baB3VDCYZx25lr+GIF5zmJJFTmF2rq2VSAlts -qx1AGmaUSo78kC5FuJvSNTL6a1Us5ucdthQZM3N8pAz+OAE+QEU+BsdA27yAh3tO -yKDsMFNHKtXcgy5LeB5gzENLlNyw2jgkRv2Ef77NAoGAVH8DHqoHEH9Mx3XuRWR1 -JnaqKx0PzE5fEWmiQV3Fr5XxNivTgQJKXq7dmQVtbHLpPErdbhwz6fkHAjXD+UMb -VsAWscL2y6m3n8wQd87/5EkiDWbXyDRXimGE53pQHviFJDa2bzEVNXCMBeaZFb4I -cAViN1zdcrAOlUqfkXewIpsCgYB8wsXl/DpRB+RENGfn0+OfTjaQ/IKq72NIbq1+ -jfondQ6N/TICFQEe5HZrL9okoNOXteYjoD9CsWGoZdLVJGgVUvOVYImSvgMBDFK+ -T75bfzU/0sxfvBBLkviVDJsFpUf3D5VgybB86s6Po+HCD6r3RHjZshRESXOhflMx -B3z+3QKBgE2Lwo0DuwUGkm6k8psyn3x8EiXNsiNw12cojicFTyKUYLHxMBeVbCLW -3j3pxSggJgRuBLLzixUHbHp91r2ARTy28naK7R/la8yKVqK6ojcikN2mQsCHYtwB -nuFwXr42ytn6G+9Wn4xT64tGjRCqyZn0/v0XsPjVCyrZ6G7EtNHP ------END RSA PRIVATE KEY----- diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/id_rsa.pub b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/id_rsa.pub deleted file mode 100644 index 0e5cb14756d7..000000000000 --- a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/id_rsa.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDgEmLpYm4BrWtq1KG9hhZXCZgGrETntu0eNTo21U3VKc9nH9/ot7M6lAawsFcT9uXu4b58PTlnfvwH/TATlCFjC8n0Z7SOx+FU6L3Sn8URh9HaX4L0tF8u87oCAD4dBrUGhhB36eiuH9dBBWly6RKffYJvrjatbc7GxBO/e5OSUMtqk/DSVKksmBhZxutrKivCNjDish9ViGIf8b5yS/MlEGmaVKApik1fJ5iOlloM/GgpB60YV/hbqfCecbWgeiM1gK92gdOcA/Wx1C7fj8BSI5iDSE6eZeF80gM3421lvyPDWyVhFaGbka4rXBX/fb9QSRBA9RTqhRKAEmAIf49H hadoop@cdae967fa87a diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/Dockerfile b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/Dockerfile deleted file mode 100644 index 787fde0eef7f..000000000000 --- a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/Dockerfile +++ /dev/null @@ -1,49 +0,0 @@ -# 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. - -ARG OZONE_RUNNER_VERSION - -FROM apache/ozone-runner:${OZONE_RUNNER_VERSION} - -# Install ssh -RUN sudo yum install -y openssh-clients openssh-server - -RUN sudo ssh-keygen -A -RUN sudo mkdir -p /run/sshd -RUN sudo sed -i "s/.*UsePrivilegeSeparation.*/UsePrivilegeSeparation no/g" /etc/ssh/sshd_config -RUN sudo sed -i "s/.*PermitUserEnvironment.*/PermitUserEnvironment yes/g" /etc/ssh/sshd_config -RUN sudo sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd - -#/opt/hadoop is mounted, we can't use it as a home -RUN sudo usermod -d /opt hadoop -ADD .ssh /opt/.ssh -RUN sudo chown -R hadoop /opt/.ssh -RUN sudo chown hadoop /opt -RUN sudo chmod 600 /opt/.ssh/* -RUN sudo chmod 700 /opt/.ssh - -RUN sudo sh -c 'echo "export JAVA_HOME=/usr/lib/jvm/jre/" >> /etc/profile' - -# Install required robot framework libraries -RUN sudo pip3 install robotframework-sshlibrary - -# Add start script to start OMs -ADD startOM.sh /opt/startOM.sh -ADD stopOM.sh /opt/stopOM.sh -RUN sudo chown -R hadoop /opt/startOM.sh -RUN sudo chown -R hadoop /opt/stopOM.sh -RUN sudo chmod 700 /opt/startOM.sh -RUN sudo chmod 700 /opt/stopOM.sh diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/docker-compose.yaml b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/docker-compose.yaml deleted file mode 100644 index 8bb640957edb..000000000000 --- a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/docker-compose.yaml +++ /dev/null @@ -1,99 +0,0 @@ -# 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. - -version: "3" -services: - datanode: - build: - context: . - args: - - OZONE_RUNNER_VERSION - image: ozone-runner-om-ha:${OZONE_RUNNER_VERSION} - privileged: true #required by the profiler - volumes: - - ../..:/opt/hadoop - ports: - - 9864 - command: sh -c "sudo /usr/sbin/sshd -E /tmp/sshd.log && /opt/hadoop/bin/ozone datanode" - env_file: - - ./docker-config - om1: - build: - context: . - args: - - OZONE_RUNNER_VERSION - image: ozone-runner-om-ha:${OZONE_RUNNER_VERSION} - privileged: true #required by the profiler - volumes: - - ../..:/opt/hadoop - ports: - - 9880:9874 - - 9890:9872 - environment: - ENSURE_OM_INITIALIZED: /data/metadata/om/current/VERSION - env_file: - - ./docker-config - command: sleep 1d - om2: - build: - context: . - args: - - OZONE_RUNNER_VERSION - image: ozone-runner-om-ha:${OZONE_RUNNER_VERSION} - privileged: true #required by the profiler - volumes: - - ../..:/opt/hadoop - ports: - - 9882:9874 - - 9892:9872 - environment: - ENSURE_OM_INITIALIZED: /data/metadata/om/current/VERSION - env_file: - - ./docker-config - command: sleep 1d - om3: - build: - context: . - args: - - OZONE_RUNNER_VERSION - image: ozone-runner-om-ha:${OZONE_RUNNER_VERSION} - privileged: true #required by the profiler - volumes: - - ../..:/opt/hadoop - ports: - - 9884:9874 - - 9894:9872 - environment: - ENSURE_OM_INITIALIZED: /data/metadata/om/current/VERSION - env_file: - - ./docker-config - command: sleep 1d - scm: - build: - context: . - args: - - OZONE_RUNNER_VERSION - image: ozone-runner-om-ha:${OZONE_RUNNER_VERSION} - privileged: true #required by the profiler - volumes: - - ../..:/opt/hadoop - ports: - - 9876:9876 - env_file: - - ./docker-config - environment: - ENSURE_SCM_INITIALIZED: /data/metadata/scm/current/VERSION - command: sh -c "sudo /usr/sbin/sshd -E /tmp/sshd.log && /opt/hadoop/bin/ozone scm" diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/docker-config b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/docker-config deleted file mode 100644 index d5892102d574..000000000000 --- a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/docker-config +++ /dev/null @@ -1,88 +0,0 @@ -# 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. - -CORE-SITE.XML_fs.o3fs.impl=org.apache.hadoop.fs.ozone.OzoneFileSystem -CORE-SITE.XML_fs.defaultFS=o3fs://bucket1.volume1.omservice -OZONE-SITE.XML_ozone.om.service.ids=omservice -OZONE-SITE.XML_ozone.om.nodes.omservice=om1,om2,om3 -OZONE-SITE.XML_ozone.om.address.omservice.om1=om1 -OZONE-SITE.XML_ozone.om.address.omservice.om2=om2 -OZONE-SITE.XML_ozone.om.address.omservice.om3=om3 -OZONE-SITE.XML_ozone.om.ratis.enable=true -OZONE-SITE.XML_ozone.scm.names=scm -OZONE-SITE.XML_ozone.scm.datanode.id.dir=/data -OZONE-SITE.XML_ozone.scm.block.client.address=scm -OZONE-SITE.XML_ozone.scm.container.size=1GB -OZONE-SITE.XML_ozone.metadata.dirs=/data/metadata -OZONE-SITE.XML_ozone.handler.type=distributed -OZONE-SITE.XML_ozone.scm.client.address=scm -OZONE-SITE.XML_ozone.replication=1 -OZONE-SITE.XML_ozone.client.failover.max.attempts=6 -OZONE-SITE.XML_hdds.datanode.dir=/data/hdds -OZONE-SITE.XML_hdds.profiler.endpoint.enabled=true -HDFS-SITE.XML_rpc.metrics.quantile.enable=true -HDFS-SITE.XML_rpc.metrics.percentiles.intervals=60,300 -ASYNC_PROFILER_HOME=/opt/profiler -LOG4J.PROPERTIES_log4j.rootLogger=INFO, stdout -LOG4J.PROPERTIES_log4j.appender.stdout=org.apache.log4j.ConsoleAppender -LOG4J.PROPERTIES_log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -LOG4J.PROPERTIES_log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n -LOG4J.PROPERTIES_log4j.logger.org.apache.hadoop.util.NativeCodeLoader=ERROR -LOG4J.PROPERTIES_log4j.logger.org.apache.ratis.conf.ConfUtils=WARN -LOG4J.PROPERTIES_log4j.logger.org.apache.hadoop.security.ShellBasedUnixGroupsMapping=ERROR -LOG4J.PROPERTIES_log4j.logger.org.apache.ratis.grpc.client.GrpcClientProtocolClient=WARN - -#Enable this variable to print out all hadoop rpc traffic to the stdout. See http://byteman.jboss.org/ to define your own instrumentation. -#BYTEMAN_SCRIPT_URL=https://raw.githubusercontent.com/apache/hadoop/trunk/dev-support/byteman/hadooprpc.btm - -#LOG4J2.PROPERTIES_* are for Ozone Audit Logging -LOG4J2.PROPERTIES_monitorInterval=30 -LOG4J2.PROPERTIES_filter=read,write -LOG4J2.PROPERTIES_filter.read.type=MarkerFilter -LOG4J2.PROPERTIES_filter.read.marker=READ -LOG4J2.PROPERTIES_filter.read.onMatch=DENY -LOG4J2.PROPERTIES_filter.read.onMismatch=NEUTRAL -LOG4J2.PROPERTIES_filter.write.type=MarkerFilter -LOG4J2.PROPERTIES_filter.write.marker=WRITE -LOG4J2.PROPERTIES_filter.write.onMatch=NEUTRAL -LOG4J2.PROPERTIES_filter.write.onMismatch=NEUTRAL -LOG4J2.PROPERTIES_appenders=console, rolling -LOG4J2.PROPERTIES_appender.console.type=Console -LOG4J2.PROPERTIES_appender.console.name=STDOUT -LOG4J2.PROPERTIES_appender.console.layout.type=PatternLayout -LOG4J2.PROPERTIES_appender.console.layout.pattern=%d{DEFAULT} | %-5level | %c{1} | %msg | %throwable{3} %n -LOG4J2.PROPERTIES_appender.rolling.type=RollingFile -LOG4J2.PROPERTIES_appender.rolling.name=RollingFile -LOG4J2.PROPERTIES_appender.rolling.fileName=${sys:hadoop.log.dir}/om-audit-${hostName}.log -LOG4J2.PROPERTIES_appender.rolling.filePattern=${sys:hadoop.log.dir}/om-audit-${hostName}-%d{yyyy-MM-dd-HH-mm-ss}-%i.log.gz -LOG4J2.PROPERTIES_appender.rolling.layout.type=PatternLayout -LOG4J2.PROPERTIES_appender.rolling.layout.pattern=%d{DEFAULT} | %-5level | %c{1} | %msg | %throwable{3} %n -LOG4J2.PROPERTIES_appender.rolling.policies.type=Policies -LOG4J2.PROPERTIES_appender.rolling.policies.time.type=TimeBasedTriggeringPolicy -LOG4J2.PROPERTIES_appender.rolling.policies.time.interval=86400 -LOG4J2.PROPERTIES_appender.rolling.policies.size.type=SizeBasedTriggeringPolicy -LOG4J2.PROPERTIES_appender.rolling.policies.size.size=64MB -LOG4J2.PROPERTIES_loggers=audit -LOG4J2.PROPERTIES_logger.audit.type=AsyncLogger -LOG4J2.PROPERTIES_logger.audit.name=OMAudit -LOG4J2.PROPERTIES_logger.audit.level=INFO -LOG4J2.PROPERTIES_logger.audit.appenderRefs=rolling -LOG4J2.PROPERTIES_logger.audit.appenderRef.file.ref=RollingFile -LOG4J2.PROPERTIES_rootLogger.level=INFO -LOG4J2.PROPERTIES_rootLogger.appenderRefs=stdout -LOG4J2.PROPERTIES_rootLogger.appenderRef.stdout.ref=STDOUT - -no_proxy=om,scm,s3g,kdc,localhost,127.0.0.1 \ No newline at end of file diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/startOM.sh b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/startOM.sh deleted file mode 100755 index e3a439914b69..000000000000 --- a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/startOM.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash -## -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. 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. -## - -ARG=$1 - -if [ "$ARG" != "--restart" ]; then - sudo /usr/sbin/sshd -E /tmp/sshd.log -fi - -export HADOOP_LOG_DIR=/var/log/hadoop -export HADOOP_CONF_DIR=/etc/hadoop -/opt/hadoop/bin/ozone --daemon start om \ No newline at end of file diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/stopOM.sh b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/stopOM.sh deleted file mode 100755 index f8094380825a..000000000000 --- a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/stopOM.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash -## -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. 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. -## - -/opt/hadoop/bin/ozone --daemon stop om \ No newline at end of file diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/test_disabled.sh b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/test_disabled.sh deleted file mode 100644 index eb9c27b1c4dd..000000000000 --- a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/test_disabled.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env bash -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. 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. - -startOMs(){ - docker-compose exec -T om1 /opt/startOM.sh - docker-compose exec -T om2 /opt/startOM.sh - docker-compose exec -T om3 /opt/startOM.sh -} - -COMPOSE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -export COMPOSE_DIR -export OM_SERVICE_ID="omservice" - -# shellcheck source=/dev/null -source "$COMPOSE_DIR/../testlib.sh" - -start_docker_env - -# Start OMs separately. In this test, the OMs will be stopped and restarted multiple times. -# So we do not want the container to be tied to the OM process. -startOMs - -execute_robot_test scm omha/testOMHA.robot - -stop_docker_env - -generate_report diff --git a/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell-lib.robot b/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell-lib.robot new file mode 100644 index 000000000000..ba0006153d29 --- /dev/null +++ b/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell-lib.robot @@ -0,0 +1,136 @@ +# 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. + +*** Settings *** +Documentation Test ozone shell CLI usage +Library OperatingSystem +Resource ../commonlib.robot + +*** Variables *** +${prefix} generated + +*** Keywords *** + +Generate prefix + ${random} = Generate Random String 5 [NUMBERS] + Set Suite Variable ${prefix} ${random} + +Test ozone shell + [arguments] ${protocol} ${server} ${volume} + ${result} = Execute And Ignore Error ozone sh volume info ${protocol}${server}/${volume} + Should contain ${result} VOLUME_NOT_FOUND + ${result} = Execute ozone sh volume create ${protocol}${server}/${volume} --quota 100TB + Should not contain ${result} Failed + ${result} = Execute ozone sh volume list ${protocol}${server}/ | jq -r '. | select(.name=="${volume}")' + Should contain ${result} creationTime + ${result} = Execute ozone sh volume list | jq -r '. | select(.name=="${volume}")' + Should contain ${result} creationTime +# TODO: Disable updating the owner, acls should be used to give access to other user. + Execute ozone sh volume update ${protocol}${server}/${volume} --quota 10TB +# ${result} = Execute ozone sh volume info ${protocol}${server}/${volume} | jq -r '. | select(.volumeName=="${volume}") | .owner | .name' +# Should Be Equal ${result} bill + ${result} = Execute ozone sh volume info ${protocol}${server}/${volume} | jq -r '. | select(.name=="${volume}") | .quota' + Should Be Equal ${result} 10995116277760 + Execute ozone sh bucket create ${protocol}${server}/${volume}/bb1 + ${result} = Execute ozone sh bucket info ${protocol}${server}/${volume}/bb1 | jq -r '. | select(.name=="bb1") | .storageType' + Should Be Equal ${result} DISK + ${result} = Execute ozone sh bucket list ${protocol}${server}/${volume}/ | jq -r '. | select(.name=="bb1") | .volumeName' + Should Be Equal ${result} ${volume} + Run Keyword Test key handling ${protocol} ${server} ${volume} + Execute ozone sh bucket delete ${protocol}${server}/${volume}/bb1 + Execute ozone sh volume delete ${protocol}${server}/${volume} + +Test Volume Acls + [arguments] ${protocol} ${server} ${volume} + Execute ozone sh volume create ${protocol}${server}/${volume} + ${result} = Execute ozone sh volume getacl ${protocol}${server}/${volume} + Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \".*\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"ALL\" . + ${result} = Execute ozone sh volume addacl ${protocol}${server}/${volume} -a user:superuser1:rwxy[DEFAULT] + ${result} = Execute ozone sh volume getacl ${protocol}${server}/${volume} + Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1*\",\n.*\"aclScope\" : \"DEFAULT\",\n.*\"aclList\" : . \"READ\", \"WRITE\", \"READ_ACL\", \"WRITE_ACL\" . + ${result} = Execute ozone sh volume removeacl ${protocol}${server}/${volume} -a user:superuser1:xy + ${result} = Execute ozone sh volume getacl ${protocol}${server}/${volume} + Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" : \"DEFAULT\",\n.*\"aclList\" : . \"READ\", \"WRITE\", \"READ_ACL\", \"WRITE_ACL\" . + ${result} = Execute ozone sh volume setacl ${protocol}${server}/${volume} -al user:superuser1:rwxy,group:superuser1:a,user:testuser/scm@EXAMPLE.COM:rwxyc,group:superuser1:a[DEFAULT] + ${result} = Execute ozone sh volume getacl ${protocol}${server}/${volume} + Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1*\",\n.*\"aclScope\" : \"DEFAULT\",\n.*\"aclList\" : . \"READ\", \"WRITE\", \"READ_ACL\", \"WRITE_ACL\" . + Should Match Regexp ${result} \"type\" : \"GROUP\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" : \"DEFAULT\",\n.*\"aclList\" : . \"ALL\" . + +Test Bucket Acls + [arguments] ${protocol} ${server} ${volume} + Execute ozone sh bucket create ${protocol}${server}/${volume}/bb1 + ${result} = Execute ozone sh bucket getacl ${protocol}${server}/${volume}/bb1 + Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \".*\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"ALL\" . + ${result} = Execute ozone sh bucket addacl ${protocol}${server}/${volume}/bb1 -a user:superuser1:rwxy + ${result} = Execute ozone sh bucket getacl ${protocol}${server}/${volume}/bb1 + Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1*\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"READ\", \"WRITE\", \"READ_ACL\", \"WRITE_ACL\" + ${result} = Execute ozone sh bucket removeacl ${protocol}${server}/${volume}/bb1 -a user:superuser1:xy + ${result} = Execute ozone sh bucket getacl ${protocol}${server}/${volume}/bb1 + Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"READ\", \"WRITE\" + ${result} = Execute ozone sh bucket setacl ${protocol}${server}/${volume}/bb1 -al user:superuser1:rwxy,group:superuser1:a,user:testuser/scm@EXAMPLE.COM:rwxyc,group:superuser1:a[DEFAULT] + ${result} = Execute ozone sh bucket getacl ${protocol}${server}/${volume}/bb1 + Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1*\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"READ\", \"WRITE\", \"READ_ACL\", \"WRITE_ACL\" + Should Match Regexp ${result} \"type\" : \"GROUP\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" : \"DEFAULT\",\n.*\"aclList\" : . \"ALL\" . + + +Test key handling + [arguments] ${protocol} ${server} ${volume} + Execute ozone sh key put ${protocol}${server}/${volume}/bb1/key1 /opt/hadoop/NOTICE.txt + Execute rm -f /tmp/NOTICE.txt.1 + Execute ozone sh key get ${protocol}${server}/${volume}/bb1/key1 /tmp/NOTICE.txt.1 + Execute diff -q /opt/hadoop/NOTICE.txt /tmp/NOTICE.txt.1 + + Execute ozone sh key put -t RATIS ${protocol}${server}/${volume}/bb1/key1_RATIS /opt/hadoop/NOTICE.txt + Execute rm -f /tmp/key1_RATIS + Execute ozone sh key get ${protocol}${server}/${volume}/bb1/key1_RATIS /tmp/key1_RATIS + Execute diff -q /opt/hadoop/NOTICE.txt /tmp/key1_RATIS + ${result} = Execute ozone sh key info ${protocol}${server}/${volume}/bb1/key1_RATIS | jq -r '. | select(.name=="key1_RATIS")' + Should contain ${result} RATIS + Execute ozone sh key delete ${protocol}${server}/${volume}/bb1/key1_RATIS + + Execute ozone sh key cp ${protocol}${server}/${volume}/bb1 key1 key1-copy + Execute rm -f /tmp/key1-copy + Execute ozone sh key get ${protocol}${server}/${volume}/bb1/key1-copy /tmp/key1-copy + Execute diff -q /opt/hadoop/NOTICE.txt /tmp/key1-copy + Execute ozone sh key delete ${protocol}${server}/${volume}/bb1/key1-copy + + ${result} = Execute And Ignore Error ozone sh key get ${protocol}${server}/${volume}/bb1/key1 /tmp/NOTICE.txt.1 + Should Contain ${result} NOTICE.txt.1 exists + ${result} = Execute ozone sh key get --force ${protocol}${server}/${volume}/bb1/key1 /tmp/NOTICE.txt.1 + Should Not Contain ${result} NOTICE.txt.1 exists + ${result} = Execute ozone sh key info ${protocol}${server}/${volume}/bb1/key1 | jq -r '. | select(.name=="key1")' + Should contain ${result} creationTime + ${result} = Execute ozone sh key list ${protocol}${server}/${volume}/bb1 | jq -r '. | select(.name=="key1") | .name' + Should Be Equal ${result} key1 + Execute ozone sh key rename ${protocol}${server}/${volume}/bb1 key1 key2 + ${result} = Execute ozone sh key list ${protocol}${server}/${volume}/bb1 | jq -r '.name' + Should Be Equal ${result} key2 + Execute ozone sh key delete ${protocol}${server}/${volume}/bb1/key2 + +Test key Acls + [arguments] ${protocol} ${server} ${volume} + Execute ozone sh key put ${protocol}${server}/${volume}/bb1/key2 /opt/hadoop/NOTICE.txt + ${result} = Execute ozone sh key getacl ${protocol}${server}/${volume}/bb1/key2 + Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \".*\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"ALL\" . + ${result} = Execute ozone sh key addacl ${protocol}${server}/${volume}/bb1/key2 -a user:superuser1:rwxy + ${result} = Execute ozone sh key getacl ${protocol}${server}/${volume}/bb1/key2 + Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"READ\", \"WRITE\", \"READ_ACL\", \"WRITE_ACL\" + ${result} = Execute ozone sh key removeacl ${protocol}${server}/${volume}/bb1/key2 -a user:superuser1:xy + ${result} = Execute ozone sh key getacl ${protocol}${server}/${volume}/bb1/key2 + Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"READ\", \"WRITE\" + ${result} = Execute ozone sh key setacl ${protocol}${server}/${volume}/bb1/key2 -al user:superuser1:rwxy,group:superuser1:a,user:testuser/scm@EXAMPLE.COM:rwxyc + ${result} = Execute ozone sh key getacl ${protocol}${server}/${volume}/bb1/key2 + Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"READ\", \"WRITE\", \"READ_ACL\", \"WRITE_ACL\" + Should Match Regexp ${result} \"type\" : \"GROUP\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"ALL\" . diff --git a/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell-single.robot b/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell-single.robot new file mode 100644 index 000000000000..e08ee0933f98 --- /dev/null +++ b/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell-single.robot @@ -0,0 +1,27 @@ +# 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. + +*** Settings *** +Documentation Test ozone shell CLI usage +Library OperatingSystem +Resource ../commonlib.robot +Resource ozone-shell-lib.robot +Test Timeout 2 minute +Suite Setup Generate prefix + +*** Test Cases *** + +Test ozone shell + Test ozone shell ${EMPTY} ${EMPTY} ${prefix}-rpcbasic diff --git a/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell.robot b/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell.robot index 9143f38dcf36..b9ef0bf6e51e 100644 --- a/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell.robot +++ b/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell.robot @@ -17,18 +17,11 @@ Documentation Test ozone shell CLI usage Library OperatingSystem Resource ../commonlib.robot +Resource ../ozone-shell-all.robot Test Setup Run Keyword if '${SECURITY_ENABLED}' == 'true' Kinit test user testuser testuser.keytab Test Timeout 2 minute Suite Setup Generate prefix -*** Variables *** -${prefix} generated - -*** Keywords *** -Generate prefix - ${random} = Generate Random String 5 [NUMBERS] - Set Suite Variable ${prefix} ${random} - *** Test Cases *** RpcClient with port Test ozone shell o3:// om:9862 ${prefix}-rpcwoport @@ -47,113 +40,3 @@ RpcClient without host RpcClient without scheme Test ozone shell ${EMPTY} ${EMPTY} ${prefix}-rpcwoscheme - - -*** Keywords *** -Test ozone shell - [arguments] ${protocol} ${server} ${volume} - ${result} = Execute And Ignore Error ozone sh volume info ${protocol}${server}/${volume} - Should contain ${result} VOLUME_NOT_FOUND - ${result} = Execute ozone sh volume create ${protocol}${server}/${volume} --quota 100TB - Should not contain ${result} Failed - ${result} = Execute ozone sh volume list ${protocol}${server}/ | jq -r '. | select(.name=="${volume}")' - Should contain ${result} creationTime - ${result} = Execute ozone sh volume list | jq -r '. | select(.name=="${volume}")' - Should contain ${result} creationTime -# TODO: Disable updating the owner, acls should be used to give access to other user. - Execute ozone sh volume update ${protocol}${server}/${volume} --quota 10TB -# ${result} = Execute ozone sh volume info ${protocol}${server}/${volume} | jq -r '. | select(.volumeName=="${volume}") | .owner | .name' -# Should Be Equal ${result} bill - ${result} = Execute ozone sh volume info ${protocol}${server}/${volume} | jq -r '. | select(.name=="${volume}") | .quota' - Should Be Equal ${result} 10995116277760 - Execute ozone sh bucket create ${protocol}${server}/${volume}/bb1 - ${result} = Execute ozone sh bucket info ${protocol}${server}/${volume}/bb1 | jq -r '. | select(.name=="bb1") | .storageType' - Should Be Equal ${result} DISK - ${result} = Execute ozone sh bucket list ${protocol}${server}/${volume}/ | jq -r '. | select(.name=="bb1") | .volumeName' - Should Be Equal ${result} ${volume} - Run Keyword Test key handling ${protocol} ${server} ${volume} - Execute ozone sh bucket delete ${protocol}${server}/${volume}/bb1 - Execute ozone sh volume delete ${protocol}${server}/${volume} - -Test Volume Acls - [arguments] ${protocol} ${server} ${volume} - Execute ozone sh volume create ${protocol}${server}/${volume} - ${result} = Execute ozone sh volume getacl ${protocol}${server}/${volume} - Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \".*\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"ALL\" . - ${result} = Execute ozone sh volume addacl ${protocol}${server}/${volume} -a user:superuser1:rwxy[DEFAULT] - ${result} = Execute ozone sh volume getacl ${protocol}${server}/${volume} - Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1*\",\n.*\"aclScope\" : \"DEFAULT\",\n.*\"aclList\" : . \"READ\", \"WRITE\", \"READ_ACL\", \"WRITE_ACL\" . - ${result} = Execute ozone sh volume removeacl ${protocol}${server}/${volume} -a user:superuser1:xy - ${result} = Execute ozone sh volume getacl ${protocol}${server}/${volume} - Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" : \"DEFAULT\",\n.*\"aclList\" : . \"READ\", \"WRITE\", \"READ_ACL\", \"WRITE_ACL\" . - ${result} = Execute ozone sh volume setacl ${protocol}${server}/${volume} -al user:superuser1:rwxy,group:superuser1:a,user:testuser/scm@EXAMPLE.COM:rwxyc,group:superuser1:a[DEFAULT] - ${result} = Execute ozone sh volume getacl ${protocol}${server}/${volume} - Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1*\",\n.*\"aclScope\" : \"DEFAULT\",\n.*\"aclList\" : . \"READ\", \"WRITE\", \"READ_ACL\", \"WRITE_ACL\" . - Should Match Regexp ${result} \"type\" : \"GROUP\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" : \"DEFAULT\",\n.*\"aclList\" : . \"ALL\" . - -Test Bucket Acls - [arguments] ${protocol} ${server} ${volume} - Execute ozone sh bucket create ${protocol}${server}/${volume}/bb1 - ${result} = Execute ozone sh bucket getacl ${protocol}${server}/${volume}/bb1 - Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \".*\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"ALL\" . - ${result} = Execute ozone sh bucket addacl ${protocol}${server}/${volume}/bb1 -a user:superuser1:rwxy - ${result} = Execute ozone sh bucket getacl ${protocol}${server}/${volume}/bb1 - Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1*\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"READ\", \"WRITE\", \"READ_ACL\", \"WRITE_ACL\" - ${result} = Execute ozone sh bucket removeacl ${protocol}${server}/${volume}/bb1 -a user:superuser1:xy - ${result} = Execute ozone sh bucket getacl ${protocol}${server}/${volume}/bb1 - Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"READ\", \"WRITE\" - ${result} = Execute ozone sh bucket setacl ${protocol}${server}/${volume}/bb1 -al user:superuser1:rwxy,group:superuser1:a,user:testuser/scm@EXAMPLE.COM:rwxyc,group:superuser1:a[DEFAULT] - ${result} = Execute ozone sh bucket getacl ${protocol}${server}/${volume}/bb1 - Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1*\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"READ\", \"WRITE\", \"READ_ACL\", \"WRITE_ACL\" - Should Match Regexp ${result} \"type\" : \"GROUP\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" : \"DEFAULT\",\n.*\"aclList\" : . \"ALL\" . - - -Test key handling - [arguments] ${protocol} ${server} ${volume} - Execute ozone sh key put ${protocol}${server}/${volume}/bb1/key1 /opt/hadoop/NOTICE.txt - Execute rm -f /tmp/NOTICE.txt.1 - Execute ozone sh key get ${protocol}${server}/${volume}/bb1/key1 /tmp/NOTICE.txt.1 - Execute diff -q /opt/hadoop/NOTICE.txt /tmp/NOTICE.txt.1 - - Execute ozone sh key put -t RATIS ${protocol}${server}/${volume}/bb1/key1_RATIS /opt/hadoop/NOTICE.txt - Execute rm -f /tmp/key1_RATIS - Execute ozone sh key get ${protocol}${server}/${volume}/bb1/key1_RATIS /tmp/key1_RATIS - Execute diff -q /opt/hadoop/NOTICE.txt /tmp/key1_RATIS - ${result} = Execute ozone sh key info ${protocol}${server}/${volume}/bb1/key1_RATIS | jq -r '. | select(.name=="key1_RATIS")' - Should contain ${result} RATIS - Execute ozone sh key delete ${protocol}${server}/${volume}/bb1/key1_RATIS - - Execute ozone sh key cp ${protocol}${server}/${volume}/bb1 key1 key1-copy - Execute rm -f /tmp/key1-copy - Execute ozone sh key get ${protocol}${server}/${volume}/bb1/key1-copy /tmp/key1-copy - Execute diff -q /opt/hadoop/NOTICE.txt /tmp/key1-copy - Execute ozone sh key delete ${protocol}${server}/${volume}/bb1/key1-copy - - ${result} = Execute And Ignore Error ozone sh key get ${protocol}${server}/${volume}/bb1/key1 /tmp/NOTICE.txt.1 - Should Contain ${result} NOTICE.txt.1 exists - ${result} = Execute ozone sh key get --force ${protocol}${server}/${volume}/bb1/key1 /tmp/NOTICE.txt.1 - Should Not Contain ${result} NOTICE.txt.1 exists - ${result} = Execute ozone sh key info ${protocol}${server}/${volume}/bb1/key1 | jq -r '. | select(.name=="key1")' - Should contain ${result} creationTime - ${result} = Execute ozone sh key list ${protocol}${server}/${volume}/bb1 | jq -r '. | select(.name=="key1") | .name' - Should Be Equal ${result} key1 - Execute ozone sh key rename ${protocol}${server}/${volume}/bb1 key1 key2 - ${result} = Execute ozone sh key list ${protocol}${server}/${volume}/bb1 | jq -r '.name' - Should Be Equal ${result} key2 - Execute ozone sh key delete ${protocol}${server}/${volume}/bb1/key2 - -Test key Acls - [arguments] ${protocol} ${server} ${volume} - Execute ozone sh key put ${protocol}${server}/${volume}/bb1/key2 /opt/hadoop/NOTICE.txt - ${result} = Execute ozone sh key getacl ${protocol}${server}/${volume}/bb1/key2 - Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \".*\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"ALL\" . - ${result} = Execute ozone sh key addacl ${protocol}${server}/${volume}/bb1/key2 -a user:superuser1:rwxy - ${result} = Execute ozone sh key getacl ${protocol}${server}/${volume}/bb1/key2 - Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"READ\", \"WRITE\", \"READ_ACL\", \"WRITE_ACL\" - ${result} = Execute ozone sh key removeacl ${protocol}${server}/${volume}/bb1/key2 -a user:superuser1:xy - ${result} = Execute ozone sh key getacl ${protocol}${server}/${volume}/bb1/key2 - Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"READ\", \"WRITE\" - ${result} = Execute ozone sh key setacl ${protocol}${server}/${volume}/bb1/key2 -al user:superuser1:rwxy,group:superuser1:a,user:testuser/scm@EXAMPLE.COM:rwxyc - ${result} = Execute ozone sh key getacl ${protocol}${server}/${volume}/bb1/key2 - Should Match Regexp ${result} \"type\" : \"USER\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"READ\", \"WRITE\", \"READ_ACL\", \"WRITE_ACL\" - Should Match Regexp ${result} \"type\" : \"GROUP\",\n.*\"name\" : \"superuser1\",\n.*\"aclScope\" : \"ACCESS\",\n.*\"aclList\" : . \"ALL\" . From 0c540c5746537db775246fa6c860c4a83525d8a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elek=20M=C3=A1rton?= Date: Thu, 25 Jun 2020 17:16:55 +0200 Subject: [PATCH 03/21] fix ofs without host names --- .../apache/hadoop/fs/ozone/BasicOzoneClientAdapterImpl.java | 6 ++++-- .../hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneClientAdapterImpl.java b/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneClientAdapterImpl.java index 1e032c3eab19..4e56022a402e 100644 --- a/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneClientAdapterImpl.java +++ b/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneClientAdapterImpl.java @@ -112,12 +112,14 @@ public BasicOzoneClientAdapterImpl(String omHost, int omPort, conf.getTrimmedStrings(OZONE_OM_SERVICE_IDS_KEY); // When host is not specified - if (omServiceIds.length != 1) { + if (omServiceIds.length > 1) { throw new IllegalArgumentException("Service ID or host name must not" + " be omitted when multiple ozone.om.service.ids is defined."); + } else if (omServiceIds.length == 1) { + omHost = omServiceIds[0]; } - omHost = omServiceIds[0]; + } if (omPort != -1) { diff --git a/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java b/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java index d3b5c4277eae..ec4a5744d167 100644 --- a/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java +++ b/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java @@ -133,12 +133,12 @@ public BasicRootedOzoneClientAdapterImpl(String omHost, int omPort, conf.getTrimmedStrings(OZONE_OM_SERVICE_IDS_KEY); // When host is not specified - if (omServiceIds.length != 1) { + if (omServiceIds.length > 1) { throw new IllegalArgumentException("Service ID or host name must not" + " be omitted when multiple ozone.om.service.ids is defined."); + } else if (omServiceIds.length == 1) { + omHost = omServiceIds[0]; } - - omHost = omServiceIds[0]; } if (omPort != -1) { From 8f0a92cdd4a87d32b5d1a250a2275bc790d910f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elek=20M=C3=A1rton?= Date: Fri, 26 Jun 2020 09:22:44 +0200 Subject: [PATCH 04/21] fix unit test --- .../hadoop/fs/ozone/TestOzoneFsHAURLs.java | 28 +++++-------------- .../hadoop/ozone/shell/TestOzoneShellHA.java | 9 +++--- 2 files changed, 11 insertions(+), 26 deletions(-) diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFsHAURLs.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFsHAURLs.java index 055c7877db54..37236177d9d2 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFsHAURLs.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFsHAURLs.java @@ -223,21 +223,10 @@ public void testWithQualifiedDefaultFS() throws Exception { Assert.assertEquals(0, res); // Test case 3: ozone fs -ls o3fs://bucket.volume/ - // Expectation: Fail. Must have service id or host name when HA is enabled + // Expectation: Success. The service id can be learned from config. String unqualifiedPath1 = String.format("%s://%s.%s/", OzoneConsts.OZONE_URI_SCHEME, bucketName, volumeName); - try (GenericTestUtils.SystemErrCapturer capture = - new GenericTestUtils.SystemErrCapturer()) { - res = ToolRunner.run(shell, new String[] {"-ls", unqualifiedPath1}); - // Check stderr, inspired by testDFSWithInvalidCommmand - Assert.assertThat("Command did not print the error message " + - "correctly for test case: ozone fs -ls o3fs://bucket.volume/", - capture.getOutput(), StringContains.containsString( - "-ls: Service ID or host name must not" - + " be omitted when ozone.om.service.ids is defined.")); - } - // Check return value, should be -1 (failure) - Assert.assertEquals(res, -1); + Assert.assertEquals(0, res); // Test case 4: ozone fs -ls o3fs://bucket.volume.om1/ // Expectation: Success. The client should use the port number @@ -294,7 +283,7 @@ public void testWithQualifiedDefaultFS() throws Exception { * @param defaultFS Desired fs.defaultFS to be used in the test * @throws Exception */ - private void testWithDefaultFS(String defaultFS) throws Exception { + private void assertLsFails(String defaultFS) throws Exception { OzoneConfiguration clientConf = new OzoneConfiguration(conf); clientConf.setQuietMode(false); clientConf.set(o3fsImplKey, o3fsImplValue); @@ -322,19 +311,16 @@ public void testOtherDefaultFS() throws Exception { // Test scenarios where fs.defaultFS isn't a fully qualified o3fs // fs.defaultFS = file:/// - testWithDefaultFS(CommonConfigurationKeysPublic.FS_DEFAULT_NAME_DEFAULT); + assertLsFails(CommonConfigurationKeysPublic.FS_DEFAULT_NAME_DEFAULT); // fs.defaultFS = hdfs://ns1/ - testWithDefaultFS("hdfs://ns1/"); + assertLsFails("hdfs://ns1/"); // fs.defaultFS = o3fs:/// String unqualifiedFs1 = String.format( "%s:///", OzoneConsts.OZONE_URI_SCHEME); - testWithDefaultFS(unqualifiedFs1); + assertLsFails(unqualifiedFs1); + - // fs.defaultFS = o3fs://bucketName.volumeName/ - String unqualifiedFs2 = String.format("%s://%s.%s/", - OzoneConsts.OZONE_URI_SCHEME, bucketName, volumeName); - testWithDefaultFS(unqualifiedFs2); } } diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneShellHA.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneShellHA.java index a8d01d8439c8..35b31394ec71 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneShellHA.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneShellHA.java @@ -384,15 +384,14 @@ public void testOzoneShCmdURIs() { executeWithError(ozoneShell, args, "does not use port information"); // Test case 6: ozone sh bucket create /volume/bucket - // Expectation: Failure. - args = new String[] {"bucket", "create", "/volume/bucket"}; - executeWithError(ozoneShell, args, - "Service ID or host name must not be omitted"); + // Expectation: Success. + args = new String[] {"bucket", "create", "/volume/bucket-one"}; + execute(ozoneShell, args); // Test case 7: ozone sh bucket create o3://om1/volume/bucket // Expectation: Success. args = new String[] { - "bucket", "create", "o3://" + omServiceId + "/volume/bucket"}; + "bucket", "create", "o3://" + omServiceId + "/volume/bucket-two"}; execute(ozoneShell, args); } From e5b35b1434837d5e124c5f91e2a440177cf6e67f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elek=20M=C3=A1rton?= Date: Fri, 26 Jun 2020 13:52:21 +0200 Subject: [PATCH 05/21] fix acceptance tests --- .../dist/src/main/smoketest/basic/ozone-shell.robot | 2 +- .../org/apache/hadoop/ozone/shell/OzoneAddress.java | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell.robot b/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell.robot index b9ef0bf6e51e..45b2d35a6cee 100644 --- a/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell.robot +++ b/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell.robot @@ -17,7 +17,7 @@ Documentation Test ozone shell CLI usage Library OperatingSystem Resource ../commonlib.robot -Resource ../ozone-shell-all.robot +Resource ozone-shell-lib.robot Test Setup Run Keyword if '${SECURITY_ENABLED}' == 'true' Kinit test user testuser testuser.keytab Test Timeout 2 minute Suite Setup Generate prefix diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/OzoneAddress.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/OzoneAddress.java index 2bb31c82ca31..71c912eb7d7d 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/OzoneAddress.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/OzoneAddress.java @@ -122,12 +122,16 @@ public OzoneClient createClient(OzoneConfiguration conf) OZONE_OM_SERVICE_IDS_KEY); // When host is not specified - if (omServiceIds.size() != 1) { + if (omServiceIds.size() > 1) { throw new OzoneClientException("Service ID or host name must not" + " be omitted when multiple ozone.om.service.ids is defined."); + } else if (omServiceIds.size() == 1) { + client = OzoneClientFactory + .getRpcClient(omServiceIds.iterator().next(), conf); + } else { + client = OzoneClientFactory.getRpcClient(conf); } - client = OzoneClientFactory - .getRpcClient(omServiceIds.iterator().next(), conf); + } } else { throw new OzoneClientException( From 9c5e18efef41a1c8ff2a1072b90abde5b59553aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elek=20M=C3=A1rton?= Date: Fri, 26 Jun 2020 17:56:46 +0200 Subject: [PATCH 06/21] add missing stop command --- hadoop-ozone/dist/src/main/compose/ozone-ha/test.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hadoop-ozone/dist/src/main/compose/ozone-ha/test.sh b/hadoop-ozone/dist/src/main/compose/ozone-ha/test.sh index 491e8bb8fc9d..a14aa9cfd8ce 100755 --- a/hadoop-ozone/dist/src/main/compose/ozone-ha/test.sh +++ b/hadoop-ozone/dist/src/main/compose/ozone-ha/test.sh @@ -28,4 +28,6 @@ start_docker_env execute_robot_test scm basic/ozone-shell-single.robot +stop_docker_env + generate_report From 689f6d246b51be052fa86b33e61f140d0a35ea02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elek=20M=C3=A1rton?= Date: Tue, 30 Jun 2020 14:53:05 +0200 Subject: [PATCH 07/21] rollback irrelevant changes --- .../common/src/main/java/org/apache/hadoop/ozone/OmUtils.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/OmUtils.java b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/OmUtils.java index d6f49c2319c4..b84bdaf9b453 100644 --- a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/OmUtils.java +++ b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/OmUtils.java @@ -167,7 +167,6 @@ public static InetSocketAddress getOmAddressForClients( /** * Returns true if OZONE_OM_SERVICE_IDS_KEY is defined and not empty. - * * @param conf Configuration * @return true if OZONE_OM_SERVICE_IDS_KEY is defined and not empty; * else false. @@ -179,8 +178,7 @@ public static boolean isServiceIdsDefined(ConfigurationSource conf) { /** * Returns true if HA for OzoneManager is configured for the given service id. - * - * @param conf Configuration + * @param conf Configuration * @param serviceId OM HA cluster service ID * @return true if HA is configured in the configuration; else false. */ From ab346cb66537b5a772945ee3e6cf2a5ea1812ddd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elek=20M=C3=A1rton?= Date: Tue, 30 Jun 2020 15:11:05 +0200 Subject: [PATCH 08/21] fix rpc client generation --- .../apache/hadoop/ozone/client/OzoneClientFactory.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneClientFactory.java b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneClientFactory.java index 1b2865dc3c48..d4a42c4493a3 100644 --- a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneClientFactory.java +++ b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneClientFactory.java @@ -136,13 +136,17 @@ public static OzoneClient getRpcClient(ConfigurationSource config) // configuration, we don't fall back to default ozone.om.address defined // in ozone-default.xml. - if (OmUtils.isServiceIdsDefined(config)) { + String[] serviceIds = config.getTrimmedStrings(OZONE_OM_SERVICE_IDS_KEY); + if (serviceIds.length > 0) { throw new IOException("Following ServiceID's " + config.getTrimmedStringCollection(OZONE_OM_SERVICE_IDS_KEY) + " are" + " defined in the configuration. Use the method getRpcClient which " + "takes serviceID and configuration as param"); + } else if (serviceIds.length == 1) { + return getRpcClient(getClientProtocol(config, serviceIds[0]), config); + } else { + return getRpcClient(getClientProtocol(config), config); } - return getRpcClient(getClientProtocol(config), config); } /** From 8c4500b06d6a77eddcbaabafdc081688dd15b725 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elek=20M=C3=A1rton?= Date: Tue, 30 Jun 2020 21:46:17 +0200 Subject: [PATCH 09/21] fix OzoneClientFactory --- .../java/org/apache/hadoop/ozone/client/OzoneClientFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneClientFactory.java b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneClientFactory.java index d4a42c4493a3..d91693b652f0 100644 --- a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneClientFactory.java +++ b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneClientFactory.java @@ -137,7 +137,7 @@ public static OzoneClient getRpcClient(ConfigurationSource config) // in ozone-default.xml. String[] serviceIds = config.getTrimmedStrings(OZONE_OM_SERVICE_IDS_KEY); - if (serviceIds.length > 0) { + if (serviceIds.length > 1) { throw new IOException("Following ServiceID's " + config.getTrimmedStringCollection(OZONE_OM_SERVICE_IDS_KEY) + " are" + " defined in the configuration. Use the method getRpcClient which " + From 477233136d119fc1c946113aabfcb162ff1ea846 Mon Sep 17 00:00:00 2001 From: "Doroszlai, Attila" Date: Mon, 6 Jul 2020 16:42:17 +0200 Subject: [PATCH 10/21] trigger new CI check From 0fa87add21efd0a91d0078a359bd2326996c58d3 Mon Sep 17 00:00:00 2001 From: "Doroszlai, Attila" Date: Mon, 6 Jul 2020 18:17:01 +0200 Subject: [PATCH 11/21] trigger new CI check From 1c7a9ba7d7f20367768ac2b73f142fa5ab711984 Mon Sep 17 00:00:00 2001 From: "Doroszlai, Attila" Date: Tue, 7 Jul 2020 13:07:26 +0200 Subject: [PATCH 12/21] trigger new CI check From 3b860ef5624aa8fe521da1ea3fe7fbb20c01350d Mon Sep 17 00:00:00 2001 From: "Doroszlai, Attila" Date: Tue, 7 Jul 2020 14:28:30 +0200 Subject: [PATCH 13/21] trigger new CI check From 732e83c7d6a7ff78b9d9b89ee140dc222c5a37f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elek=20M=C3=A1rton?= Date: Wed, 22 Jul 2020 11:40:35 +0200 Subject: [PATCH 14/21] revert ozone fs related changes --- .../hadoop/fs/ozone/TestOzoneFsHAURLs.java | 28 ++++++++++---- .../fs/ozone/BasicOzoneClientAdapterImpl.java | 22 ++++------- .../BasicRootedOzoneClientAdapterImpl.java | 37 ++++++++++--------- 3 files changed, 48 insertions(+), 39 deletions(-) diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFsHAURLs.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFsHAURLs.java index 37236177d9d2..055c7877db54 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFsHAURLs.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFsHAURLs.java @@ -223,10 +223,21 @@ public void testWithQualifiedDefaultFS() throws Exception { Assert.assertEquals(0, res); // Test case 3: ozone fs -ls o3fs://bucket.volume/ - // Expectation: Success. The service id can be learned from config. + // Expectation: Fail. Must have service id or host name when HA is enabled String unqualifiedPath1 = String.format("%s://%s.%s/", OzoneConsts.OZONE_URI_SCHEME, bucketName, volumeName); - Assert.assertEquals(0, res); + try (GenericTestUtils.SystemErrCapturer capture = + new GenericTestUtils.SystemErrCapturer()) { + res = ToolRunner.run(shell, new String[] {"-ls", unqualifiedPath1}); + // Check stderr, inspired by testDFSWithInvalidCommmand + Assert.assertThat("Command did not print the error message " + + "correctly for test case: ozone fs -ls o3fs://bucket.volume/", + capture.getOutput(), StringContains.containsString( + "-ls: Service ID or host name must not" + + " be omitted when ozone.om.service.ids is defined.")); + } + // Check return value, should be -1 (failure) + Assert.assertEquals(res, -1); // Test case 4: ozone fs -ls o3fs://bucket.volume.om1/ // Expectation: Success. The client should use the port number @@ -283,7 +294,7 @@ public void testWithQualifiedDefaultFS() throws Exception { * @param defaultFS Desired fs.defaultFS to be used in the test * @throws Exception */ - private void assertLsFails(String defaultFS) throws Exception { + private void testWithDefaultFS(String defaultFS) throws Exception { OzoneConfiguration clientConf = new OzoneConfiguration(conf); clientConf.setQuietMode(false); clientConf.set(o3fsImplKey, o3fsImplValue); @@ -311,16 +322,19 @@ public void testOtherDefaultFS() throws Exception { // Test scenarios where fs.defaultFS isn't a fully qualified o3fs // fs.defaultFS = file:/// - assertLsFails(CommonConfigurationKeysPublic.FS_DEFAULT_NAME_DEFAULT); + testWithDefaultFS(CommonConfigurationKeysPublic.FS_DEFAULT_NAME_DEFAULT); // fs.defaultFS = hdfs://ns1/ - assertLsFails("hdfs://ns1/"); + testWithDefaultFS("hdfs://ns1/"); // fs.defaultFS = o3fs:/// String unqualifiedFs1 = String.format( "%s:///", OzoneConsts.OZONE_URI_SCHEME); - assertLsFails(unqualifiedFs1); - + testWithDefaultFS(unqualifiedFs1); + // fs.defaultFS = o3fs://bucketName.volumeName/ + String unqualifiedFs2 = String.format("%s://%s.%s/", + OzoneConsts.OZONE_URI_SCHEME, bucketName, volumeName); + testWithDefaultFS(unqualifiedFs2); } } diff --git a/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneClientAdapterImpl.java b/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneClientAdapterImpl.java index 4e56022a402e..a2f4c174b964 100644 --- a/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneClientAdapterImpl.java +++ b/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneClientAdapterImpl.java @@ -59,7 +59,6 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import static org.apache.hadoop.ozone.OzoneConsts.OZONE_URI_DELIMITER; -import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_SERVICE_IDS_KEY; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -107,19 +106,14 @@ public BasicOzoneClientAdapterImpl(String omHost, int omPort, throws IOException { OzoneConfiguration conf = OzoneConfiguration.of(hadoopConf); - if (omHost == null) { - String[] omServiceIds = - conf.getTrimmedStrings(OZONE_OM_SERVICE_IDS_KEY); - - // When host is not specified - if (omServiceIds.length > 1) { - throw new IllegalArgumentException("Service ID or host name must not" - + " be omitted when multiple ozone.om.service.ids is defined."); - } else if (omServiceIds.length == 1) { - omHost = omServiceIds[0]; - } - - + if (omHost == null && OmUtils.isServiceIdsDefined(conf)) { + // When the host name or service id isn't given + // but ozone.om.service.ids is defined, declare failure. + + // This is a safety precaution that prevents the client from + // accidentally failing over to an unintended OM. + throw new IllegalArgumentException("Service ID or host name must not" + + " be omitted when ozone.om.service.ids is defined."); } if (omPort != -1) { diff --git a/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java b/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java index ec4a5744d167..b4bb16f06721 100644 --- a/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java +++ b/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java @@ -27,6 +27,8 @@ import java.util.Iterator; import java.util.List; +import com.google.common.base.Preconditions; +import org.apache.commons.collections.CollectionUtils; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.crypto.key.KeyProvider; @@ -60,18 +62,20 @@ import org.apache.hadoop.security.token.Token; import org.apache.hadoop.security.token.TokenRenewer; -import com.google.common.base.Preconditions; -import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; -import static org.apache.hadoop.ozone.OzoneConsts.OZONE_URI_DELIMITER; -import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_SERVICE_IDS_KEY; -import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes.BUCKET_ALREADY_EXISTS; -import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes.BUCKET_NOT_FOUND; -import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes.VOLUME_ALREADY_EXISTS; -import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes.VOLUME_NOT_FOUND; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.apache.hadoop.ozone.OzoneConsts.OZONE_URI_DELIMITER; +import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes + .BUCKET_ALREADY_EXISTS; +import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes + .VOLUME_ALREADY_EXISTS; +import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes + .VOLUME_NOT_FOUND; +import static org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes + .BUCKET_NOT_FOUND; + /** * Basic Implementation of the RootedOzoneFileSystem calls. *

@@ -128,17 +132,14 @@ public BasicRootedOzoneClientAdapterImpl(String omHost, int omPort, try { OzoneConfiguration conf = OzoneConfiguration.of(hadoopConf); - if (omHost == null) { - String[] omServiceIds = - conf.getTrimmedStrings(OZONE_OM_SERVICE_IDS_KEY); + if (omHost == null && OmUtils.isServiceIdsDefined(conf)) { + // When the host name or service id isn't given + // but ozone.om.service.ids is defined, declare failure. - // When host is not specified - if (omServiceIds.length > 1) { - throw new IllegalArgumentException("Service ID or host name must not" - + " be omitted when multiple ozone.om.service.ids is defined."); - } else if (omServiceIds.length == 1) { - omHost = omServiceIds[0]; - } + // This is a safety precaution that prevents the client from + // accidentally failing over to an unintended OM. + throw new IllegalArgumentException("Service ID or host name must not" + + " be omitted when ozone.om.service.ids is defined."); } if (omPort != -1) { From 024d7a48abdfa385ad05b6c0654a509397b6de91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elek=20M=C3=A1rton?= Date: Wed, 22 Jul 2020 11:56:20 +0200 Subject: [PATCH 15/21] fix om related freon tests --- .../hadoop/ozone/freon/BaseFreonGenerator.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/BaseFreonGenerator.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/BaseFreonGenerator.java index aa8282e57a35..6947b9772901 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/BaseFreonGenerator.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/BaseFreonGenerator.java @@ -61,6 +61,7 @@ import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.lang3.RandomStringUtils; import static org.apache.hadoop.hdds.HddsUtils.getScmAddressForClients; +import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_SERVICE_IDS_KEY; import org.apache.ratis.protocol.ClientId; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -310,6 +311,17 @@ public OzoneManagerProtocolClientSideTranslatorPB createOmClient( RPC.setProtocolEngine(conf, OzoneManagerProtocolPB.class, ProtobufRpcEngine.class); String clientId = ClientId.randomId().toString(); + + if (omServiceID == null) { + + //if only one serviceId is configured, use that + final String[] configuredServiceIds = + conf.getTrimmedStrings(OZONE_OM_SERVICE_IDS_KEY); + if (configuredServiceIds.length == 1) { + omServiceID = configuredServiceIds[0]; + } + } + OmTransport transport = OmTransportFactory.create(conf, ugi, omServiceID); return new OzoneManagerProtocolClientSideTranslatorPB(transport, clientId); } From 0818fa8049675f0e0fe44dbfbc39a3b4699cff6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elek=20M=C3=A1rton?= Date: Wed, 29 Jul 2020 09:33:14 +0200 Subject: [PATCH 16/21] add more unit test --- hadoop-hdds/config/pom.xml | 5 - hadoop-hdds/test-utils/pom.xml | 4 + .../hadoop/test/InMemoryConfiguration.java | 60 ++++++ .../hadoop/ozone/shell/OzoneAddress.java | 109 +++++++---- .../hadoop/ozone/shell/TestOzoneAddress.java | 6 +- .../shell/TestOzoneAddressClientCreation.java | 172 ++++++++++++++++++ 6 files changed, 310 insertions(+), 46 deletions(-) create mode 100644 hadoop-hdds/test-utils/src/main/java/org/apache/hadoop/test/InMemoryConfiguration.java create mode 100644 hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddressClientCreation.java diff --git a/hadoop-hdds/config/pom.xml b/hadoop-hdds/config/pom.xml index 105e8ac8f096..ac4c3105eecb 100644 --- a/hadoop-hdds/config/pom.xml +++ b/hadoop-hdds/config/pom.xml @@ -37,11 +37,6 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd"> org.slf4j slf4j-api - - org.apache.hadoop - hadoop-hdds-test-utils - test - junit diff --git a/hadoop-hdds/test-utils/pom.xml b/hadoop-hdds/test-utils/pom.xml index 831a22b1275c..c9eeceecac68 100644 --- a/hadoop-hdds/test-utils/pom.xml +++ b/hadoop-hdds/test-utils/pom.xml @@ -33,6 +33,10 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd"> + + org.apache.hadoop + hadoop-hdds-config + com.github.spotbugs spotbugs-annotations diff --git a/hadoop-hdds/test-utils/src/main/java/org/apache/hadoop/test/InMemoryConfiguration.java b/hadoop-hdds/test-utils/src/main/java/org/apache/hadoop/test/InMemoryConfiguration.java new file mode 100644 index 000000000000..abf8d379eab2 --- /dev/null +++ b/hadoop-hdds/test-utils/src/main/java/org/apache/hadoop/test/InMemoryConfiguration.java @@ -0,0 +1,60 @@ +/* + * 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.hadoop.test; + +import java.io.IOException; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +import org.apache.hadoop.hdds.conf.MutableConfigurationSource; + +/** + * In memory, mutable configuration source for testing.. + */ +public class InMemoryConfiguration implements MutableConfigurationSource { + + private Map configs = new HashMap<>(); + + public InMemoryConfiguration() { + } + + public InMemoryConfiguration(String key, String value) { + set(key, value); + } + + @Override + public String get(String key) { + return configs.get(key); + } + + @Override + public Collection getConfigKeys() { + return configs.keySet(); + } + + @Override + public char[] getPassword(String key) throws IOException { + return configs.get(key).toCharArray(); + } + + @Override + public void set(String key, String value) { + configs.put(key, value); + } +} diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/OzoneAddress.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/OzoneAddress.java index 71c912eb7d7d..516177610caa 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/OzoneAddress.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/OzoneAddress.java @@ -23,6 +23,8 @@ import java.net.URISyntaxException; import java.util.Collection; +import org.apache.hadoop.hdds.conf.ConfigurationSource; +import org.apache.hadoop.hdds.conf.MutableConfigurationSource; import org.apache.hadoop.hdds.conf.OzoneConfiguration; import org.apache.hadoop.ozone.OmUtils; import org.apache.hadoop.ozone.client.OzoneClient; @@ -31,10 +33,10 @@ import org.apache.hadoop.ozone.security.acl.OzoneObj; import org.apache.hadoop.ozone.security.acl.OzoneObjInfo; +import com.google.common.annotations.VisibleForTesting; import static org.apache.hadoop.ozone.OzoneConsts.OZONE_HTTP_SCHEME; import static org.apache.hadoop.ozone.OzoneConsts.OZONE_RPC_SCHEME; import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_SERVICE_IDS_KEY; - import org.apache.http.client.utils.URIBuilder; /** @@ -43,6 +45,7 @@ public class OzoneAddress { private static final int DEFAULT_OZONE_PORT = 50070; + private static final String EMPTY_HOST = "___DEFAULT___"; private URI ozoneURI; @@ -86,7 +89,34 @@ public OzoneAddress(String address) } - public OzoneClient createClient(OzoneConfiguration conf) + @VisibleForTesting + protected OzoneClient createRpcClient( + ConfigurationSource conf + ) + throws IOException { + return OzoneClientFactory.getRpcClient(conf); + } + + @VisibleForTesting + protected OzoneClient createRpcClientFromHostPort( + String host, + int port, + MutableConfigurationSource conf + ) + throws IOException { + return OzoneClientFactory.getRpcClient(ozoneURI.getHost(), port, conf); + } + + @VisibleForTesting + protected OzoneClient createRpcClientFromServiceId( + String serviceId, + MutableConfigurationSource conf + ) + throws IOException { + return OzoneClientFactory.getRpcClient(serviceId, conf); + } + + public OzoneClient createClient(MutableConfigurationSource conf) throws IOException, OzoneClientException { OzoneClient client; String scheme = ozoneURI.getScheme(); @@ -97,59 +127,62 @@ public OzoneClient createClient(OzoneConfiguration conf) throw new UnsupportedOperationException( "REST schema is not supported any more. Please use AWS S3 protocol " + "if you need REST interface."); - } else if (scheme.equals(OZONE_RPC_SCHEME)) { - if (ozoneURI.getHost() != null && !ozoneURI.getAuthority() - .equals(EMPTY_HOST)) { - if (OmUtils.isOmHAServiceId(conf, ozoneURI.getHost())) { - // When host is an HA service ID - if (ozoneURI.getPort() != -1) { - throw new OzoneClientException( - "Port " + ozoneURI.getPort() + " specified in URI but host '" - + ozoneURI.getHost() + "' is a logical (HA) OzoneManager " - + "and does not use port information."); - } - client = OzoneClientFactory.getRpcClient(ozoneURI.getHost(), conf); - } else if (ozoneURI.getPort() == -1) { - client = OzoneClientFactory.getRpcClient(ozoneURI.getHost(), - OmUtils.getOmRpcPort(conf), conf); - } else { - client = OzoneClientFactory - .getRpcClient(ozoneURI.getHost(), ozoneURI.getPort(), conf); + } else if (!scheme.equals(OZONE_RPC_SCHEME)) { + throw new OzoneClientException( + "Invalid URI, unknown protocol scheme: " + scheme + ". Use " + + OZONE_RPC_SCHEME + ":// as the scheme"); + } + + if (ozoneURI.getHost() != null && !ozoneURI.getAuthority() + .equals(EMPTY_HOST)) { + if (OmUtils.isOmHAServiceId(conf, ozoneURI.getHost())) { + // When host is an HA service ID + if (ozoneURI.getPort() != -1) { + throw new OzoneClientException( + "Port " + ozoneURI.getPort() + " specified in URI but host '" + + ozoneURI.getHost() + "' is a logical (HA) OzoneManager " + + "and does not use port information."); } + client = createRpcClient(conf); + } else if (ozoneURI.getPort() == -1) { + client = createRpcClientFromHostPort(ozoneURI.getHost(), + OmUtils.getOmRpcPort(conf), conf); } else { + client = createRpcClientFromHostPort(ozoneURI.getHost(), + ozoneURI.getPort(), conf); + } + } else {// When host is not specified - Collection omServiceIds = conf.getTrimmedStringCollection( - OZONE_OM_SERVICE_IDS_KEY); - - // When host is not specified - if (omServiceIds.size() > 1) { - throw new OzoneClientException("Service ID or host name must not" - + " be omitted when multiple ozone.om.service.ids is defined."); - } else if (omServiceIds.size() == 1) { - client = OzoneClientFactory - .getRpcClient(omServiceIds.iterator().next(), conf); - } else { - client = OzoneClientFactory.getRpcClient(conf); - } + Collection omServiceIds = conf.getTrimmedStringCollection( + OZONE_OM_SERVICE_IDS_KEY); + if (omServiceIds.size() > 1) { + throw new OzoneClientException("Service ID or host name must not" + + " be omitted when multiple ozone.om.service.ids is defined."); + } else if (omServiceIds.size() == 1) { + client = createRpcClientFromServiceId(omServiceIds.iterator().next(), + conf); + } else { + client = createRpcClient(conf); } - } else { - throw new OzoneClientException( - "Invalid URI, unknown protocol scheme: " + scheme); } + return client; } /** * Create OzoneClient for S3Commands. + * * @param conf * @param omServiceID * @return OzoneClient * @throws IOException * @throws OzoneClientException */ - public OzoneClient createClientForS3Commands(OzoneConfiguration conf, - String omServiceID) + public OzoneClient createClientForS3Commands( + OzoneConfiguration conf, + String omServiceID + ) throws IOException, OzoneClientException { if (omServiceID != null) { // OM HA cluster diff --git a/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddress.java b/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddress.java index 3ab866c49857..10ba576d8160 100644 --- a/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddress.java +++ b/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddress.java @@ -39,9 +39,9 @@ public class TestOzoneAddress { @Parameters public static Collection data() { return Arrays.asList(new Object[][] { - {"o3fs://localhost:9878/"}, - {"o3fs://localhost/"}, - {"o3fs:///"}, + {"o3://localhost:9878/"}, + {"o3://localhost/"}, + {"o3:///"}, {"/"}, {""} }); diff --git a/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddressClientCreation.java b/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddressClientCreation.java new file mode 100644 index 000000000000..a112b273c561 --- /dev/null +++ b/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddressClientCreation.java @@ -0,0 +1,172 @@ +/* + * 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.hadoop.ozone.shell; + +import java.io.IOException; + +import org.apache.hadoop.hdds.conf.ConfigurationSource; +import org.apache.hadoop.hdds.conf.MutableConfigurationSource; +import org.apache.hadoop.ozone.client.OzoneClient; +import org.apache.hadoop.ozone.client.OzoneClientException; +import org.apache.hadoop.test.InMemoryConfiguration; + +import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_SERVICE_IDS_KEY; +import org.junit.Assert; +import org.junit.Test; + +/** + * Test ozone client creation. + */ +public class TestOzoneAddressClientCreation { + + @Test + public void implicitNonHA() throws OzoneClientException, IOException { + TestableOzoneAddress address = + new TestableOzoneAddress("/vol1/bucket1/key1"); + address.createClient(new InMemoryConfiguration()); + Assert.assertTrue(address.simpleCreation); + } + + @Test + public void implicitHAOneServiceId() + throws OzoneClientException, IOException { + TestableOzoneAddress address = + new TestableOzoneAddress("/vol1/bucket1/key1"); + address.createClient( + new InMemoryConfiguration(OZONE_OM_SERVICE_IDS_KEY, "service1")); + Assert.assertFalse(address.simpleCreation); + Assert.assertEquals("service1", address.serviceId); + } + + @Test(expected = OzoneClientException.class) + public void implicitHaMultipleServiceId() + throws OzoneClientException, IOException { + TestableOzoneAddress address = + new TestableOzoneAddress("/vol1/bucket1/key1"); + address.createClient( + new InMemoryConfiguration(OZONE_OM_SERVICE_IDS_KEY, + "service1,service2")); + } + + @Test + public void explicitNonHAHostPort() throws OzoneClientException, IOException { + TestableOzoneAddress address = + new TestableOzoneAddress("o3://om:9862/vol1/bucket1/key1"); + address.createClient(new InMemoryConfiguration()); + Assert.assertFalse(address.simpleCreation); + Assert.assertEquals("om", address.host); + Assert.assertEquals(9862, address.port); + } + + @Test + public void explicitHAHostPortWithServiceId() + throws OzoneClientException, IOException { + TestableOzoneAddress address = + new TestableOzoneAddress("o3://om:9862/vol1/bucket1/key1"); + address.createClient( + new InMemoryConfiguration(OZONE_OM_SERVICE_IDS_KEY, "service1")); + Assert.assertFalse(address.simpleCreation); + Assert.assertEquals("om", address.host); + Assert.assertEquals(9862, address.port); + } + + @Test + public void explicitAHostPortWithServiceIds() + throws OzoneClientException, IOException { + TestableOzoneAddress address = + new TestableOzoneAddress("o3://om:9862/vol1/bucket1/key1"); + address.createClient( + new InMemoryConfiguration(OZONE_OM_SERVICE_IDS_KEY, + "service1,service2")); + Assert.assertFalse(address.simpleCreation); + Assert.assertEquals("om", address.host); + Assert.assertEquals(9862, address.port); + } + + @Test + public void explicitNonHAHost() throws OzoneClientException, IOException { + TestableOzoneAddress address = + new TestableOzoneAddress("o3://om/vol1/bucket1/key1"); + address.createClient( + new InMemoryConfiguration(OZONE_OM_SERVICE_IDS_KEY, "service1")); + Assert.assertFalse(address.simpleCreation); + Assert.assertEquals("om", address.host); + } + + @Test + public void explicitHAHostPort() throws OzoneClientException, IOException { + TestableOzoneAddress address = + new TestableOzoneAddress("o3://om:1234/vol1/bucket1/key1"); + address.createClient(new InMemoryConfiguration()); + Assert.assertFalse(address.simpleCreation); + Assert.assertEquals("om", address.host); + Assert.assertEquals(1234, address.port); + } + + @Test(expected = OzoneClientException.class) + public void explicitWrongScheme() throws OzoneClientException, IOException { + TestableOzoneAddress address = + new TestableOzoneAddress("ssh://host/vol1/bucket1/key1"); + address.createClient(new InMemoryConfiguration()); + } + + /** + * OzoneAddress with modification to make it easier to test. + */ + @SuppressWarnings("checkstyle") + private static class TestableOzoneAddress extends OzoneAddress { + + private String host; + private int port; + private boolean simpleCreation; + private String serviceId; + + TestableOzoneAddress(String address) throws OzoneClientException { + super(address); + } + + TestableOzoneAddress() throws OzoneClientException { + } + + @Override + protected OzoneClient createRpcClient(ConfigurationSource conf) + throws IOException { + simpleCreation = true; + return null; + } + + @Override + protected OzoneClient createRpcClientFromHostPort( + String hostParam, int portParam, MutableConfigurationSource conf + ) throws IOException { + this.host = hostParam; + this.port = portParam; + return null; + } + + @Override + protected OzoneClient createRpcClientFromServiceId( + String serviceIdParam, MutableConfigurationSource conf + ) throws IOException { + this.serviceId = serviceIdParam; + return null; + } + } + +} \ No newline at end of file From 29550ce803abb075d7899e7a7e747d97d0e9cbc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elek=20M=C3=A1rton?= Date: Fri, 7 Aug 2020 15:55:15 +0200 Subject: [PATCH 17/21] typo fix --- .../main/java/org/apache/hadoop/test/InMemoryConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hadoop-hdds/test-utils/src/main/java/org/apache/hadoop/test/InMemoryConfiguration.java b/hadoop-hdds/test-utils/src/main/java/org/apache/hadoop/test/InMemoryConfiguration.java index abf8d379eab2..ee74feff772d 100644 --- a/hadoop-hdds/test-utils/src/main/java/org/apache/hadoop/test/InMemoryConfiguration.java +++ b/hadoop-hdds/test-utils/src/main/java/org/apache/hadoop/test/InMemoryConfiguration.java @@ -25,7 +25,7 @@ import org.apache.hadoop.hdds.conf.MutableConfigurationSource; /** - * In memory, mutable configuration source for testing.. + * In memory, mutable configuration source for testing. */ public class InMemoryConfiguration implements MutableConfigurationSource { From 9980b56c75921032963ec3b246b5d045cb9aa6a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elek=20M=C3=A1rton?= Date: Fri, 7 Aug 2020 15:56:28 +0200 Subject: [PATCH 18/21] one line method def --- .../main/java/org/apache/hadoop/ozone/shell/OzoneAddress.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/OzoneAddress.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/OzoneAddress.java index 516177610caa..0ddd65762895 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/OzoneAddress.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/OzoneAddress.java @@ -90,9 +90,7 @@ public OzoneAddress(String address) } @VisibleForTesting - protected OzoneClient createRpcClient( - ConfigurationSource conf - ) + protected OzoneClient createRpcClient(ConfigurationSource conf) throws IOException { return OzoneClientFactory.getRpcClient(conf); } From 9776c88e06de10f25c41858f712e75af4da5dc3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elek=20M=C3=A1rton?= Date: Mon, 10 Aug 2020 17:11:48 +0200 Subject: [PATCH 19/21] retrigger build with empty commit From 872d13e1a0f49dc74ffb7846a2aefe12b2081029 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elek=20M=C3=A1rton?= Date: Mon, 10 Aug 2020 19:21:36 +0200 Subject: [PATCH 20/21] fix unit tests --- hadoop-hdds/config/pom.xml | 5 +++++ .../org/apache/hadoop/hdds/conf}/InMemoryConfiguration.java | 4 +--- hadoop-hdds/test-utils/pom.xml | 4 ---- .../hadoop/ozone/shell/TestOzoneAddressClientCreation.java | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) rename hadoop-hdds/{test-utils/src/main/java/org/apache/hadoop/test => config/src/main/java/org/apache/hadoop/hdds/conf}/InMemoryConfiguration.java (94%) diff --git a/hadoop-hdds/config/pom.xml b/hadoop-hdds/config/pom.xml index ac4c3105eecb..105e8ac8f096 100644 --- a/hadoop-hdds/config/pom.xml +++ b/hadoop-hdds/config/pom.xml @@ -37,6 +37,11 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd"> org.slf4j slf4j-api + + org.apache.hadoop + hadoop-hdds-test-utils + test + junit diff --git a/hadoop-hdds/test-utils/src/main/java/org/apache/hadoop/test/InMemoryConfiguration.java b/hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/InMemoryConfiguration.java similarity index 94% rename from hadoop-hdds/test-utils/src/main/java/org/apache/hadoop/test/InMemoryConfiguration.java rename to hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/InMemoryConfiguration.java index ee74feff772d..0bea7af82a49 100644 --- a/hadoop-hdds/test-utils/src/main/java/org/apache/hadoop/test/InMemoryConfiguration.java +++ b/hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/InMemoryConfiguration.java @@ -15,15 +15,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.test; +package org.apache.hadoop.hdds.conf; import java.io.IOException; import java.util.Collection; import java.util.HashMap; import java.util.Map; -import org.apache.hadoop.hdds.conf.MutableConfigurationSource; - /** * In memory, mutable configuration source for testing. */ diff --git a/hadoop-hdds/test-utils/pom.xml b/hadoop-hdds/test-utils/pom.xml index c9eeceecac68..831a22b1275c 100644 --- a/hadoop-hdds/test-utils/pom.xml +++ b/hadoop-hdds/test-utils/pom.xml @@ -33,10 +33,6 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd"> - - org.apache.hadoop - hadoop-hdds-config - com.github.spotbugs spotbugs-annotations diff --git a/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddressClientCreation.java b/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddressClientCreation.java index a112b273c561..1c58a7d52f67 100644 --- a/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddressClientCreation.java +++ b/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddressClientCreation.java @@ -24,7 +24,7 @@ import org.apache.hadoop.hdds.conf.MutableConfigurationSource; import org.apache.hadoop.ozone.client.OzoneClient; import org.apache.hadoop.ozone.client.OzoneClientException; -import org.apache.hadoop.test.InMemoryConfiguration; +import org.apache.hadoop.hdds.conf.InMemoryConfiguration; import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_SERVICE_IDS_KEY; import org.junit.Assert; From 51295548fa4093504856f4cbfffb143c5d5915b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elek=20M=C3=A1rton?= Date: Mon, 10 Aug 2020 20:25:16 +0200 Subject: [PATCH 21/21] restore original om-ha-tests --- .../dist/src/main/compose/ozone-om-ha-s3/.env | 19 ++++ .../ozone-om-ha-s3/docker-compose.yaml | 99 +++++++++++++++++ .../main/compose/ozone-om-ha-s3/docker-config | 37 +++++++ .../src/main/compose/ozone-om-ha-s3/test.sh | 36 +++++++ .../dist/src/main/compose/ozone-om-ha/.env | 18 ++++ .../compose/ozone-om-ha/.ssh/authorized_keys | 16 +++ .../src/main/compose/ozone-om-ha/.ssh/config | 18 ++++ .../main/compose/ozone-om-ha/.ssh/environment | 16 +++ .../src/main/compose/ozone-om-ha/.ssh/id_rsa | 27 +++++ .../main/compose/ozone-om-ha/.ssh/id_rsa.pub | 1 + .../src/main/compose/ozone-om-ha/Dockerfile | 49 +++++++++ .../compose/ozone-om-ha/docker-compose.yaml | 100 ++++++++++++++++++ .../main/compose/ozone-om-ha/docker-config | 88 +++++++++++++++ .../src/main/compose/ozone-om-ha/startOM.sh | 28 +++++ .../src/main/compose/ozone-om-ha/stopOM.sh | 20 ++++ .../main/compose/ozone-om-ha/test_disabled.sh | 41 +++++++ 16 files changed, 613 insertions(+) create mode 100644 hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/.env create mode 100644 hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/docker-compose.yaml create mode 100644 hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/docker-config create mode 100644 hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/test.sh create mode 100644 hadoop-ozone/dist/src/main/compose/ozone-om-ha/.env create mode 100644 hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/authorized_keys create mode 100644 hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/config create mode 100644 hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/environment create mode 100644 hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/id_rsa create mode 100644 hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/id_rsa.pub create mode 100644 hadoop-ozone/dist/src/main/compose/ozone-om-ha/Dockerfile create mode 100644 hadoop-ozone/dist/src/main/compose/ozone-om-ha/docker-compose.yaml create mode 100644 hadoop-ozone/dist/src/main/compose/ozone-om-ha/docker-config create mode 100755 hadoop-ozone/dist/src/main/compose/ozone-om-ha/startOM.sh create mode 100755 hadoop-ozone/dist/src/main/compose/ozone-om-ha/stopOM.sh create mode 100644 hadoop-ozone/dist/src/main/compose/ozone-om-ha/test_disabled.sh diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/.env b/hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/.env new file mode 100644 index 000000000000..8446b4a5b015 --- /dev/null +++ b/hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/.env @@ -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. + +HDDS_VERSION=${hdds.version} +OZONE_RUNNER_VERSION=${docker.ozone-runner.version} +HADOOP_OPTS= \ No newline at end of file diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/docker-compose.yaml b/hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/docker-compose.yaml new file mode 100644 index 000000000000..4d271be304e7 --- /dev/null +++ b/hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/docker-compose.yaml @@ -0,0 +1,99 @@ +# 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. + +version: "3" +services: + datanode: + image: apache/ozone-runner:${OZONE_RUNNER_VERSION} + privileged: true #required by the profiler + volumes: + - ../..:/opt/hadoop + ports: + - 9864 + command: ["/opt/hadoop/bin/ozone","datanode"] + env_file: + - ./docker-config + environment: + HADOOP_OPTS: ${HADOOP_OPTS} + om1: + image: apache/ozone-runner:${OZONE_RUNNER_VERSION} + privileged: true #required by the profiler + volumes: + - ../..:/opt/hadoop + ports: + - 9880:9874 + - 9890:9872 + environment: + ENSURE_OM_INITIALIZED: /data/metadata/om/current/VERSION + HADOOP_OPTS: ${HADOOP_OPTS} + env_file: + - ./docker-config + command: ["/opt/hadoop/bin/ozone","om"] + om2: + image: apache/ozone-runner:${OZONE_RUNNER_VERSION} + privileged: true #required by the profiler + volumes: + - ../..:/opt/hadoop + ports: + - 9882:9874 + - 9892:9872 + environment: + ENSURE_OM_INITIALIZED: /data/metadata/om/current/VERSION + HADOOP_OPTS: ${HADOOP_OPTS} + env_file: + - ./docker-config + command: ["/opt/hadoop/bin/ozone","om"] + om3: + image: apache/ozone-runner:${OZONE_RUNNER_VERSION} + privileged: true #required by the profiler + volumes: + - ../..:/opt/hadoop + ports: + - 9884:9874 + - 9894:9872 + environment: + ENSURE_OM_INITIALIZED: /data/metadata/om/current/VERSION + HADOOP_OPTS: ${HADOOP_OPTS} + env_file: + - ./docker-config + command: ["/opt/hadoop/bin/ozone","om"] + scm: + image: apache/ozone-runner:${OZONE_RUNNER_VERSION} + privileged: true #required by the profiler + volumes: + - ../..:/opt/hadoop + ports: + - 9876:9876 + - 9860:9860 + env_file: + - ./docker-config + environment: + ENSURE_SCM_INITIALIZED: /data/metadata/scm/current/VERSION + OZONE-SITE.XML_hdds.scm.safemode.min.datanode: "${OZONE_SAFEMODE_MIN_DATANODES:-1}" + HADOOP_OPTS: ${HADOOP_OPTS} + command: ["/opt/hadoop/bin/ozone","scm"] + s3g: + image: apache/ozone-runner:${OZONE_RUNNER_VERSION} + volumes: + - ../..:/opt/hadoop + ports: + - 9878:9878 + env_file: + - ./docker-config + environment: + HADOOP_OPTS: ${HADOOP_OPTS} + command: ["ozone","s3g"] + diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/docker-config b/hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/docker-config new file mode 100644 index 000000000000..b835147ee261 --- /dev/null +++ b/hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/docker-config @@ -0,0 +1,37 @@ +# 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. + +CORE-SITE.XML_fs.o3fs.impl=org.apache.hadoop.fs.ozone.OzoneFileSystem +CORE-SITE.XML_fs.defaultFS=o3fs://bucket.volume.id1 +OZONE-SITE.XML_ozone.om.service.ids=id1 +OZONE-SITE.XML_ozone.om.nodes.id1=om1,om2,om3 +OZONE-SITE.XML_ozone.om.address.id1.om1=om1 +OZONE-SITE.XML_ozone.om.address.id1.om2=om2 +OZONE-SITE.XML_ozone.om.address.id1.om3=om3 +OZONE-SITE.XML_ozone.om.ratis.enable=true +OZONE-SITE.XML_ozone.scm.container.size=1GB +OZONE-SITE.XML_ozone.scm.pipeline.owner.container.count=1 +OZONE-SITE.XML_ozone.scm.names=scm +OZONE-SITE.XML_ozone.scm.datanode.id.dir=/data +OZONE-SITE.XML_ozone.scm.block.client.address=scm +OZONE-SITE.XML_ozone.metadata.dirs=/data/metadata +OZONE-SITE.XML_ozone.handler.type=distributed +OZONE-SITE.XML_ozone.scm.client.address=scm +OZONE-SITE.XML_ozone.replication=3 +OZONE-SITE.XML_hdds.datanode.dir=/data/hdds +OZONE-SITE.XML_hdds.profiler.endpoint.enabled=true + +no_proxy=om,scm,s3g,recon,kdc,localhost,127.0.0.1 diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/test.sh b/hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/test.sh new file mode 100644 index 000000000000..719ad4cbba21 --- /dev/null +++ b/hadoop-ozone/dist/src/main/compose/ozone-om-ha-s3/test.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. 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. + +COMPOSE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +export COMPOSE_DIR + +export SECURITY_ENABLED=false +export OM_SERVICE_ID="id1" + +# shellcheck source=/dev/null +source "$COMPOSE_DIR/../testlib.sh" + +start_docker_env + +execute_robot_test scm s3 + +execute_robot_test scm freon + +stop_docker_env + +generate_report + diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.env b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.env new file mode 100644 index 000000000000..96ab163b4747 --- /dev/null +++ b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.env @@ -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. + +HDDS_VERSION=${hdds.version} +OZONE_RUNNER_VERSION=${docker.ozone-runner.version} diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/authorized_keys b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/authorized_keys new file mode 100644 index 000000000000..ae390529c7eb --- /dev/null +++ b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/authorized_keys @@ -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. +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDgEmLpYm4BrWtq1KG9hhZXCZgGrETntu0eNTo21U3VKc9nH9/ot7M6lAawsFcT9uXu4b58PTlnfvwH/TATlCFjC8n0Z7SOx+FU6L3Sn8URh9HaX4L0tF8u87oCAD4dBrUGhhB36eiuH9dBBWly6RKffYJvrjatbc7GxBO/e5OSUMtqk/DSVKksmBhZxutrKivCNjDish9ViGIf8b5yS/MlEGmaVKApik1fJ5iOlloM/GgpB60YV/hbqfCecbWgeiM1gK92gdOcA/Wx1C7fj8BSI5iDSE6eZeF80gM3421lvyPDWyVhFaGbka4rXBX/fb9QSRBA9RTqhRKAEmAIf49H hadoop@cdae967fa87a diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/config b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/config new file mode 100644 index 000000000000..6506916ded0f --- /dev/null +++ b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/config @@ -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. +Host * + UserKnownHostsFile /dev/null + StrictHostKeyChecking no diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/environment b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/environment new file mode 100644 index 000000000000..cbde0f2078df --- /dev/null +++ b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/environment @@ -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. +JAVA_HOME=/usr/lib/jvm/jre diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/id_rsa b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/id_rsa new file mode 100644 index 000000000000..b4b1604f806e --- /dev/null +++ b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/id_rsa @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEowIBAAKCAQEA4BJi6WJuAa1ratShvYYWVwmYBqxE57btHjU6NtVN1SnPZx/f +6LezOpQGsLBXE/bl7uG+fD05Z378B/0wE5QhYwvJ9Ge0jsfhVOi90p/FEYfR2l+C +9LRfLvO6AgA+HQa1BoYQd+norh/XQQVpcukSn32Cb642rW3OxsQTv3uTklDLapPw +0lSpLJgYWcbrayorwjYw4rIfVYhiH/G+ckvzJRBpmlSgKYpNXyeYjpZaDPxoKQet +GFf4W6nwnnG1oHojNYCvdoHTnAP1sdQu34/AUiOYg0hOnmXhfNIDN+NtZb8jw1sl +YRWhm5GuK1wV/32/UEkQQPUU6oUSgBJgCH+PRwIDAQABAoIBAQDI1TH6ZNKchkck +9XgSWsBjOqIcOQN5fCeDT8nho8WjLVpL3/Hcr+ngsxRcAXHK3xyvw33r9SQic1qJ +/pC8u6RBFivo95qJ7vU0GXcp9TG4yLd6tui1U4WMm784U+dYNM7EDh1snSaECt3v +1V3yNJ0QfnoOh2NShn0zAkOA+M4H8Nx2SudMCsjcbK9+fYxzW3hX+sJpMKdjG1HW +DUz+I7cW7t0EGaVrgVSV+eR58LiXu+14YDNMrySiejB4nD2sKrx93XgiCBECCsBN +GLQGJCztaXoAY+5Kf/aJ9EEf2wBF3GecRk+XIAd87PeDmeahLQAVkAJ/rD1vsKFs +8kWi6CrhAoGBAP7leG/dMBhlfvROpBddIfWm2i8B+oZiAlSjdYGz+/ZhUaByXk18 +pupMGiiMQR1ziPnEg0gNgR2ZkH54qrXPn5WcQa4rlSEtUsZEp5v5WblhfX2QwKzY +G/uhA+mB7wXpQkSmXo0LclfPF2teROQrG1OyfWkWbxFH4i3+em7sL95jAoGBAOEK +v+wscqkMLW7Q8ONbWMCCBlmMHr6baB3VDCYZx25lr+GIF5zmJJFTmF2rq2VSAlts +qx1AGmaUSo78kC5FuJvSNTL6a1Us5ucdthQZM3N8pAz+OAE+QEU+BsdA27yAh3tO +yKDsMFNHKtXcgy5LeB5gzENLlNyw2jgkRv2Ef77NAoGAVH8DHqoHEH9Mx3XuRWR1 +JnaqKx0PzE5fEWmiQV3Fr5XxNivTgQJKXq7dmQVtbHLpPErdbhwz6fkHAjXD+UMb +VsAWscL2y6m3n8wQd87/5EkiDWbXyDRXimGE53pQHviFJDa2bzEVNXCMBeaZFb4I +cAViN1zdcrAOlUqfkXewIpsCgYB8wsXl/DpRB+RENGfn0+OfTjaQ/IKq72NIbq1+ +jfondQ6N/TICFQEe5HZrL9okoNOXteYjoD9CsWGoZdLVJGgVUvOVYImSvgMBDFK+ +T75bfzU/0sxfvBBLkviVDJsFpUf3D5VgybB86s6Po+HCD6r3RHjZshRESXOhflMx +B3z+3QKBgE2Lwo0DuwUGkm6k8psyn3x8EiXNsiNw12cojicFTyKUYLHxMBeVbCLW +3j3pxSggJgRuBLLzixUHbHp91r2ARTy28naK7R/la8yKVqK6ojcikN2mQsCHYtwB +nuFwXr42ytn6G+9Wn4xT64tGjRCqyZn0/v0XsPjVCyrZ6G7EtNHP +-----END RSA PRIVATE KEY----- diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/id_rsa.pub b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/id_rsa.pub new file mode 100644 index 000000000000..0e5cb14756d7 --- /dev/null +++ b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/.ssh/id_rsa.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDgEmLpYm4BrWtq1KG9hhZXCZgGrETntu0eNTo21U3VKc9nH9/ot7M6lAawsFcT9uXu4b58PTlnfvwH/TATlCFjC8n0Z7SOx+FU6L3Sn8URh9HaX4L0tF8u87oCAD4dBrUGhhB36eiuH9dBBWly6RKffYJvrjatbc7GxBO/e5OSUMtqk/DSVKksmBhZxutrKivCNjDish9ViGIf8b5yS/MlEGmaVKApik1fJ5iOlloM/GgpB60YV/hbqfCecbWgeiM1gK92gdOcA/Wx1C7fj8BSI5iDSE6eZeF80gM3421lvyPDWyVhFaGbka4rXBX/fb9QSRBA9RTqhRKAEmAIf49H hadoop@cdae967fa87a diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/Dockerfile b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/Dockerfile new file mode 100644 index 000000000000..787fde0eef7f --- /dev/null +++ b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/Dockerfile @@ -0,0 +1,49 @@ +# 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. + +ARG OZONE_RUNNER_VERSION + +FROM apache/ozone-runner:${OZONE_RUNNER_VERSION} + +# Install ssh +RUN sudo yum install -y openssh-clients openssh-server + +RUN sudo ssh-keygen -A +RUN sudo mkdir -p /run/sshd +RUN sudo sed -i "s/.*UsePrivilegeSeparation.*/UsePrivilegeSeparation no/g" /etc/ssh/sshd_config +RUN sudo sed -i "s/.*PermitUserEnvironment.*/PermitUserEnvironment yes/g" /etc/ssh/sshd_config +RUN sudo sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd + +#/opt/hadoop is mounted, we can't use it as a home +RUN sudo usermod -d /opt hadoop +ADD .ssh /opt/.ssh +RUN sudo chown -R hadoop /opt/.ssh +RUN sudo chown hadoop /opt +RUN sudo chmod 600 /opt/.ssh/* +RUN sudo chmod 700 /opt/.ssh + +RUN sudo sh -c 'echo "export JAVA_HOME=/usr/lib/jvm/jre/" >> /etc/profile' + +# Install required robot framework libraries +RUN sudo pip3 install robotframework-sshlibrary + +# Add start script to start OMs +ADD startOM.sh /opt/startOM.sh +ADD stopOM.sh /opt/stopOM.sh +RUN sudo chown -R hadoop /opt/startOM.sh +RUN sudo chown -R hadoop /opt/stopOM.sh +RUN sudo chmod 700 /opt/startOM.sh +RUN sudo chmod 700 /opt/stopOM.sh diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/docker-compose.yaml b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/docker-compose.yaml new file mode 100644 index 000000000000..87bb1612198a --- /dev/null +++ b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/docker-compose.yaml @@ -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. + +version: "3" +services: + datanode: + build: + context: . + args: + - OZONE_RUNNER_VERSION + image: ozone-runner-om-ha:${OZONE_RUNNER_VERSION} + privileged: true #required by the profiler + volumes: + - ../..:/opt/hadoop + ports: + - 9864 + command: sh -c "sudo /usr/sbin/sshd -E /tmp/sshd.log && /opt/hadoop/bin/ozone datanode" + env_file: + - ./docker-config + om1: + build: + context: . + args: + - OZONE_RUNNER_VERSION + image: ozone-runner-om-ha:${OZONE_RUNNER_VERSION} + privileged: true #required by the profiler + volumes: + - ../..:/opt/hadoop + ports: + - 9880:9874 + - 9890:9872 + environment: + ENSURE_OM_INITIALIZED: /data/metadata/om/current/VERSION + env_file: + - ./docker-config + command: sleep 1d + om2: + build: + context: . + args: + - OZONE_RUNNER_VERSION + image: ozone-runner-om-ha:${OZONE_RUNNER_VERSION} + privileged: true #required by the profiler + volumes: + - ../..:/opt/hadoop + ports: + - 9882:9874 + - 9892:9872 + environment: + ENSURE_OM_INITIALIZED: /data/metadata/om/current/VERSION + env_file: + - ./docker-config + command: sleep 1d + om3: + build: + context: . + args: + - OZONE_RUNNER_VERSION + image: ozone-runner-om-ha:${OZONE_RUNNER_VERSION} + privileged: true #required by the profiler + volumes: + - ../..:/opt/hadoop + ports: + - 9884:9874 + - 9894:9872 + environment: + ENSURE_OM_INITIALIZED: /data/metadata/om/current/VERSION + env_file: + - ./docker-config + command: sleep 1d + scm: + build: + context: . + args: + - OZONE_RUNNER_VERSION + image: ozone-runner-om-ha:${OZONE_RUNNER_VERSION} + privileged: true #required by the profiler + volumes: + - ../..:/opt/hadoop + ports: + - 9876:9876 + - 9860:9860 + env_file: + - ./docker-config + environment: + ENSURE_SCM_INITIALIZED: /data/metadata/scm/current/VERSION + command: sh -c "sudo /usr/sbin/sshd -E /tmp/sshd.log && /opt/hadoop/bin/ozone scm" diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/docker-config b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/docker-config new file mode 100644 index 000000000000..4eb1c8a5b6b7 --- /dev/null +++ b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/docker-config @@ -0,0 +1,88 @@ +# 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. + +CORE-SITE.XML_fs.o3fs.impl=org.apache.hadoop.fs.ozone.OzoneFileSystem +CORE-SITE.XML_fs.defaultFS=o3fs://bucket1.volume1.omservice +OZONE-SITE.XML_ozone.om.service.ids=omservice +OZONE-SITE.XML_ozone.om.nodes.omservice=om1,om2,om3 +OZONE-SITE.XML_ozone.om.address.omservice.om1=om1 +OZONE-SITE.XML_ozone.om.address.omservice.om2=om2 +OZONE-SITE.XML_ozone.om.address.omservice.om3=om3 +OZONE-SITE.XML_ozone.om.ratis.enable=true +OZONE-SITE.XML_ozone.scm.names=scm +OZONE-SITE.XML_ozone.scm.datanode.id.dir=/data +OZONE-SITE.XML_ozone.scm.block.client.address=scm +OZONE-SITE.XML_ozone.scm.container.size=1GB +OZONE-SITE.XML_ozone.metadata.dirs=/data/metadata +OZONE-SITE.XML_ozone.handler.type=distributed +OZONE-SITE.XML_ozone.scm.client.address=scm +OZONE-SITE.XML_ozone.replication=1 +OZONE-SITE.XML_ozone.client.failover.max.attempts=6 +OZONE-SITE.XML_hdds.datanode.dir=/data/hdds +OZONE-SITE.XML_hdds.profiler.endpoint.enabled=true +HDFS-SITE.XML_rpc.metrics.quantile.enable=true +HDFS-SITE.XML_rpc.metrics.percentiles.intervals=60,300 +ASYNC_PROFILER_HOME=/opt/profiler +LOG4J.PROPERTIES_log4j.rootLogger=INFO, stdout +LOG4J.PROPERTIES_log4j.appender.stdout=org.apache.log4j.ConsoleAppender +LOG4J.PROPERTIES_log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +LOG4J.PROPERTIES_log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n +LOG4J.PROPERTIES_log4j.logger.org.apache.hadoop.util.NativeCodeLoader=ERROR +LOG4J.PROPERTIES_log4j.logger.org.apache.ratis.conf.ConfUtils=WARN +LOG4J.PROPERTIES_log4j.logger.org.apache.hadoop.security.ShellBasedUnixGroupsMapping=ERROR +LOG4J.PROPERTIES_log4j.logger.org.apache.ratis.grpc.client.GrpcClientProtocolClient=WARN + +#Enable this variable to print out all hadoop rpc traffic to the stdout. See http://byteman.jboss.org/ to define your own instrumentation. +#BYTEMAN_SCRIPT_URL=https://raw.githubusercontent.com/apache/hadoop/trunk/dev-support/byteman/hadooprpc.btm + +#LOG4J2.PROPERTIES_* are for Ozone Audit Logging +LOG4J2.PROPERTIES_monitorInterval=30 +LOG4J2.PROPERTIES_filter=read,write +LOG4J2.PROPERTIES_filter.read.type=MarkerFilter +LOG4J2.PROPERTIES_filter.read.marker=READ +LOG4J2.PROPERTIES_filter.read.onMatch=DENY +LOG4J2.PROPERTIES_filter.read.onMismatch=NEUTRAL +LOG4J2.PROPERTIES_filter.write.type=MarkerFilter +LOG4J2.PROPERTIES_filter.write.marker=WRITE +LOG4J2.PROPERTIES_filter.write.onMatch=NEUTRAL +LOG4J2.PROPERTIES_filter.write.onMismatch=NEUTRAL +LOG4J2.PROPERTIES_appenders=console, rolling +LOG4J2.PROPERTIES_appender.console.type=Console +LOG4J2.PROPERTIES_appender.console.name=STDOUT +LOG4J2.PROPERTIES_appender.console.layout.type=PatternLayout +LOG4J2.PROPERTIES_appender.console.layout.pattern=%d{DEFAULT} | %-5level | %c{1} | %msg | %throwable{3} %n +LOG4J2.PROPERTIES_appender.rolling.type=RollingFile +LOG4J2.PROPERTIES_appender.rolling.name=RollingFile +LOG4J2.PROPERTIES_appender.rolling.fileName=${sys:hadoop.log.dir}/om-audit-${hostName}.log +LOG4J2.PROPERTIES_appender.rolling.filePattern=${sys:hadoop.log.dir}/om-audit-${hostName}-%d{yyyy-MM-dd-HH-mm-ss}-%i.log.gz +LOG4J2.PROPERTIES_appender.rolling.layout.type=PatternLayout +LOG4J2.PROPERTIES_appender.rolling.layout.pattern=%d{DEFAULT} | %-5level | %c{1} | %msg | %throwable{3} %n +LOG4J2.PROPERTIES_appender.rolling.policies.type=Policies +LOG4J2.PROPERTIES_appender.rolling.policies.time.type=TimeBasedTriggeringPolicy +LOG4J2.PROPERTIES_appender.rolling.policies.time.interval=86400 +LOG4J2.PROPERTIES_appender.rolling.policies.size.type=SizeBasedTriggeringPolicy +LOG4J2.PROPERTIES_appender.rolling.policies.size.size=64MB +LOG4J2.PROPERTIES_loggers=audit +LOG4J2.PROPERTIES_logger.audit.type=AsyncLogger +LOG4J2.PROPERTIES_logger.audit.name=OMAudit +LOG4J2.PROPERTIES_logger.audit.level=INFO +LOG4J2.PROPERTIES_logger.audit.appenderRefs=rolling +LOG4J2.PROPERTIES_logger.audit.appenderRef.file.ref=RollingFile +LOG4J2.PROPERTIES_rootLogger.level=INFO +LOG4J2.PROPERTIES_rootLogger.appenderRefs=stdout +LOG4J2.PROPERTIES_rootLogger.appenderRef.stdout.ref=STDOUT + +no_proxy=om,scm,s3g,recon,kdc,localhost,127.0.0.1 diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/startOM.sh b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/startOM.sh new file mode 100755 index 000000000000..e3a439914b69 --- /dev/null +++ b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/startOM.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +## +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. 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. +## + +ARG=$1 + +if [ "$ARG" != "--restart" ]; then + sudo /usr/sbin/sshd -E /tmp/sshd.log +fi + +export HADOOP_LOG_DIR=/var/log/hadoop +export HADOOP_CONF_DIR=/etc/hadoop +/opt/hadoop/bin/ozone --daemon start om \ No newline at end of file diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/stopOM.sh b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/stopOM.sh new file mode 100755 index 000000000000..f8094380825a --- /dev/null +++ b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/stopOM.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +## +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. 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. +## + +/opt/hadoop/bin/ozone --daemon stop om \ No newline at end of file diff --git a/hadoop-ozone/dist/src/main/compose/ozone-om-ha/test_disabled.sh b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/test_disabled.sh new file mode 100644 index 000000000000..eb9c27b1c4dd --- /dev/null +++ b/hadoop-ozone/dist/src/main/compose/ozone-om-ha/test_disabled.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. 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. + +startOMs(){ + docker-compose exec -T om1 /opt/startOM.sh + docker-compose exec -T om2 /opt/startOM.sh + docker-compose exec -T om3 /opt/startOM.sh +} + +COMPOSE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +export COMPOSE_DIR +export OM_SERVICE_ID="omservice" + +# shellcheck source=/dev/null +source "$COMPOSE_DIR/../testlib.sh" + +start_docker_env + +# Start OMs separately. In this test, the OMs will be stopped and restarted multiple times. +# So we do not want the container to be tied to the OM process. +startOMs + +execute_robot_test scm omha/testOMHA.robot + +stop_docker_env + +generate_report