- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Rack topology script not working ERROR: script /etc/hadoop/conf/topology.sh returned 0 values when 1
- Labels:
-
Cloudera Manager
-
HDFS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have written my own topology script and made required configuration in cloudera manager>hdfs>configurations>net.topology.script.file.name property. But the rack topology is not updated and could see ERROR in namenode log as "script /etc/hadoop/conf/topology.sh returned 0 values when 1 were expected.". Please help to resolve the issue.
topology.sh
#!/bin/bash
nodearg=$1 #get the first argument
while [ $# -gt 0 ]; do
for line in `cat topology.data`; do #read line from topology.data file
node=$(echo $line|awk -F ',' '{print $1}') #parse the data and get the hostname to compare
result=""
if [ $nodearg = $node ]; then #compare the hostname in the file with the argument
result=$(echo $line|awk -F ',' '{print $2}') #parse the file again to recive the rack details for the host
break;
else
result="/default/rack-0"
fi
done
shift
echo $result
done
topology.data
hdp-1.hdp.com,/default/rack-1
hdp-2.hdp.com,/default/rack-2
hdp-3.hdp.com,/default/rack-3
19.1.0.13,/default/rack-1
19.1.0.14,/default/rack-2
19.1.0.15,/default/rack-3
Output:
$ ./topology.sh hdp-1. hdp.com
/default/rack-1
$ ./topology.sh 19.1.0.14
/default/rack-2
Thanks and regards
Sidharth
Created ‎09-17-2018 11:33 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for your response and help.
Everytime i make changes in configs it re-deploy the configurations which was deleting my topology script. So i pushed my script to /mnt/topology/ directory and also tweak the script a bit
It look like below now
topology.sh
#!/bin/bash
while [ $# -gt 0 ]; do
nodearg=$1 #get the first argument
for line in `cat /mnt/topology/topology.data`; do #read line from topology.data file
node=$(echo $line|awk -F ',' '{print $1}') #parse the data and get the hostname to compare
result=""
if [ $nodearg = $node ]; then #compare the hostname in the file with the argument
result=$(echo $line|awk -F ',' '{print $2}') #parse the file again to recive the rack details for the host
break;
else
result="/default/rack-0"
fi
done
shift
echo $result
done
Created ‎09-17-2018 07:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Created ‎09-17-2018 09:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hadoop invoke topology script? I mean the parameters it passes along with
script file.
Created ‎09-17-2018 09:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This page has a pretty good summary of how this works:
https://hadoop.apache.org/docs/r2.8.0/hadoop-project-dist/hadoop-common/RackAwareness.html
Created ‎09-17-2018 11:33 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for your response and help.
Everytime i make changes in configs it re-deploy the configurations which was deleting my topology script. So i pushed my script to /mnt/topology/ directory and also tweak the script a bit
It look like below now
topology.sh
#!/bin/bash
while [ $# -gt 0 ]; do
nodearg=$1 #get the first argument
for line in `cat /mnt/topology/topology.data`; do #read line from topology.data file
node=$(echo $line|awk -F ',' '{print $1}') #parse the data and get the hostname to compare
result=""
if [ $nodearg = $node ]; then #compare the hostname in the file with the argument
result=$(echo $line|awk -F ',' '{print $2}') #parse the file again to recive the rack details for the host
break;
else
result="/default/rack-0"
fi
done
shift
echo $result
done
Created ‎09-18-2018 11:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Created ‎09-17-2018 09:38 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sounds like you may need to add some debugging to your shell script to identify what values are being evaluated and why no results are being returned.
