Support Questions
Find answers, ask questions, and share your expertise
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here. not producing the desired result ? not producing the desired result ?


We have our own clusted which runs on HDP 2.3 and Ambari 2.1.0. As per HDP documentation:

we have created and files under /etc/hadoop/conf directory and kept thos two files in all Hosts under the same /etc/hadoop/conf directory. For testing purpose we ran the script "" but the results are defaul/rack only.

It not producing the rack information result instead of that producing the "/Default/rack" as oupt.

I am not sure weather is theire issue in script or ?


Re: not producing the desired result ?

@Ganesan Vetri

Can you please check that you have given all ip address and rack locations in file?


# Add Hostnames to this file. Format <host ip> <rack_location> 01 02 03 

Still if you don't see any changes please provide namenode logs from namenode host. Example: /var/log/hadoop/hdfs/ hadoop-hdfs-namenode-sandbox.log.


Re: not producing the desired result ?

Yes I added in the same was as describe above.I checked the log, no information regards this script. I suscect fault in the script:

This is the output what I get:

[root@hdp08 conf]# ./


[root@hdp08 conf]#

This is the content of "" :


# Add Hostnames to this file. Format <host ip> <rack_location> 1 2 3 4

This is the script file :


[root@hdp08 conf]# cat #!/bin/bash # Adjust/Add the property "" # to core-site.xml with the "absolute" path the this # file. ENSURE the file is "executable". # Supply appropriate rack prefix RACK_PREFIX=default # To test, supply a hostname as script input: if [ $# -gt 0 ]; then CTL_FILE=${CTL_FILE:-""} HADOOP_CONF=${HADOOP_CONF:-"/etc/hadoop/conf"} if [ ! -f ${HADOOP_CONF}/${CTL_FILE} ]; then echo -n "/$RACK_PREFIX/rack " exit 0 fi while [ $# -gt 0 ] ; do nodeArg=$1 exec< ${HADOOP_CONF}/${CTL_FILE} result="" while read line ; do ar=( $line ) if [ "${ar[0]}" = "$nodeArg" ] ; then result="${ar[1]}" fi done shift if [ -z "$result" ] ; then echo -n "/$RACK_PREFIX/rack " else echo -n "/$RACK_PREFIX/rack_$result " fi done else echo -n "/$RACK_PREFIX/rack " fi [root@hdp08 conf]#


Re: not producing the desired result ?


For testing purpose , you need to run script as "sh <host ip>" , <host ip> should be present in file. This script gives me expected result.

Don't have an account?
Coming from Hortonworks? Activate your account here