#!/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. ## set -e #To avoid docker volume permission problems sudo chmod o+rwx /data DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" $DIR/envtoconf.py --destination /opt/hadoop/etc/hadoop if [ -n "$SLEEP_SECONDS" ]; then echo "Sleeping for $SLEEP_SECONDS seconds" sleep $SLEEP_SECONDS fi if [ -n "$ENSURE_NAMENODE_DIR" ]; then CLUSTERID_OPTS="" if [ -n "$ENSURE_NAMENODE_CLUSTERID" ]; then CLUSTERID_OPTS="-clusterid $ENSURE_NAMENODE_CLUSTERID" fi if [ ! -d "$ENSURE_NAMENODE_DIR" ]; then /opt/hadoop/bin/hdfs namenode -format -force $CLUSTERID_OPTS fi fi if [ -n "$ENSURE_STANDBY_NAMENODE_DIR" ]; then if [ ! -d "$ENSURE_STANDBY_NAMENODE_DIR" ]; then /opt/hadoop/bin/hdfs namenode -bootstrapStandby fi fi if [ -n "$ENSURE_SCM_INITIALIZED" ]; then if [ ! -f "$ENSURE_SCM_INITIALIZED" ]; then /opt/hadoop/bin/hdfs scm -init fi fi if [ -n "$ENSURE_KSM_INITIALIZED" ]; then if [ ! -f "$ENSURE_KSM_INITIALIZED" ]; then #To make sure SCM is running in dockerized environment we will sleep # Could be removed after HDFS-13203 echo "Waiting 15 seconds for SCM startup" sleep 15 /opt/hadoop/bin/hdfs ksm -createObjectStore fi fi $@