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

Rack-topology.sh not producing the desired result ?

Highlighted

Rack-topology.sh not producing the desired result ?

Hi,

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

http://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.3.0/bk_hdfs_admin_tools/content/ch05.html

we have created rack-topology.sh and rack_topology.data 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 "racktopology.sh" 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 ?

3 REPLIES 3
Highlighted

Re: Rack-topology.sh not producing the desired result ?

@Ganesan Vetri

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

Example:

# Add Hostnames to this file. Format <host ip> <rack_location>
192.168.2.10 01
192.168.2.11 02
192.168.2.12 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: Rack-topology.sh 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]# ./rack-topology.sh

/default/rack

[root@hdp08 conf]#

This is the content of "rack_topology.data" :

---------------------------------------------------------------

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

192.168.56.105 1

192.168.56.106 2

192.168.56.107 3

192.168.56.108 4

This is the script file :

------------------------------

[root@hdp08 conf]# cat rack-topology.sh #!/bin/bash # Adjust/Add the property "net.topology.script.file.name" # 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:-"rack_topology.data"} 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]#

Highlighted

Re: Rack-topology.sh not producing the desired result ?

Explorer

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

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