Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YAK-2343/init nn bug fix bootstrapping flag on #47

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion helm-charts/hbase-chart/templates/_hbasecluster.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ spec:
{{- $data := dict "Values" .Values "root" .Values.deployments.datanode "scripts" $scripts "probescripts" $probescripts "initContainers" $initContainers "args" $args "portsArr" $portsArr "podManagementPolicy" $podManagementPolicy }}
{{- include "hbasecluster.component" $data | indent 4 }}
namenode:
{{- $podManagementPolicy := "OrderedReady" }}
{{- $podManagementPolicy := "Parallel" }}
{{- $initContainers := list $dnsContainer $initnnContainer $initzkfcContainer $initnnbootstrapContainer }}
{{- $nnscript := include "hbasecluster.nnscript" . | indent 6 }}
{{- $zkfcscript := include "hbasecluster.zkfcscript" . | indent 6 }}
Expand Down
26 changes: 26 additions & 0 deletions helm-charts/hbase-chart/templates/meta/_initnnscript.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,33 @@
export HADOOP_CONF_DIR={{ .Values.configuration.hadoopConfigMountPath }}
export HADOOP_HOME={{ .Values.configuration.hadoopHomePath }}

# Get the journal node URIs
jn_uris=$($HADOOP_HOME/bin/hdfs getconf -confKey dfs.namenode.shared.edits.dir)

# Extract the journal node hostnames and ports
jn_hostnames_and_ports=${jn_uris#qjournal://} # Remove the 'qjournal://' prefix
jn_hostnames_and_ports=${jn_hostnames_and_ports%/*} # Remove the '/<nameserviceID>' suffix

# Split the hostnames and ports into an array
IFS=';' read -ra jn_array <<< "$jn_hostnames_and_ports"

# Access each journal node hostname using the array and wait until service is ready
for jn in "${jn_array[@]}"; do
jn_hostname=${jn%%:*}
until nslookup $jn_hostname; do
echo "Waiting for $jn_hostname to be ready..."
sleep 5
done
done

# Sleep for random time to avoid lock issue on journalnode quorum
sleep_time=$((RANDOM % 180))
echo "Sleeping for $sleep_time seconds"
sleep $sleep_time

echo "Formatting the namenode"
echo "N" | $HADOOP_HOME/bin/hdfs namenode -format $($HADOOP_HOME/bin/hdfs getconf -confKey dfs.nameservices) || true

cpuLimit: {{ $namenodeCpu | quote }}
memoryLimit: {{ $namenodeMemory | quote }}
cpuRequest: {{ $namenodeCpu | quote }}
Expand Down