diff --git a/helm-charts/hbase-chart/templates/_hbasecluster.tpl b/helm-charts/hbase-chart/templates/_hbasecluster.tpl index bc25940..6e7850b 100644 --- a/helm-charts/hbase-chart/templates/_hbasecluster.tpl +++ b/helm-charts/hbase-chart/templates/_hbasecluster.tpl @@ -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 }} diff --git a/helm-charts/hbase-chart/templates/meta/_initnnscript.tpl b/helm-charts/hbase-chart/templates/meta/_initnnscript.tpl index d1bc8ba..89231f1 100644 --- a/helm-charts/hbase-chart/templates/meta/_initnnscript.tpl +++ b/helm-charts/hbase-chart/templates/meta/_initnnscript.tpl @@ -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 '/' 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 }}