Spark-sql on cluster reboot

We had a EMR cluster reboot and hit this error all of sudden. The error is independent of EMR so worth sharing.


Caused by: No route to host
 at Method)
 at org.apache.hadoop.ipc.Client$Connection.setupConnection(
 at org.apache.hadoop.ipc.Client$Connection.setupIOstreams(
 at org.apache.hadoop.ipc.Client$Connection.access$2900(
 at org.apache.hadoop.ipc.Client.getConnection(
 ... 56 more No Route to Host from ip-XXX-XXX-XXX-XXX/XXX-XXX-XXX-XXX to ip-YYY-YYY-YYY-YYY:PORT failed on socket timeout exception: No route to host; For more details see:
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance(
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
 at java.lang.reflect.Constructor.newInstance(
 at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(
 at com.sun.proxy.$Proxy14.getListing(Unknown Source)
 at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB.getListing(
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(
 at java.lang.reflect.Method.invoke(

Note: ip-XXX-XXX-XXX-XXX was our new cluster master’s IP while ip-YYY-YYY-YYY-YYY was the old cluster’s master’s IP (which had been terminated now).

Root cause:

We had an external Metastore for the cluster so that we could get rid of the cluster and spin up a new one anytime.  Hive Metastore still keeps references to old cluster if there are ‘MANAGED’ tables.


  1. Drop all managed tables, since the data is lost with old cluster.
  2. Remove/update references to old cluster from Metastore. This is not very useful, but it was good knowing that it can be done.
$ hive --service metatool -listFSRoot

 Initializing HiveMetaTool..
 Listing FS Roots..
 hive --config /etc/hive/conf/conf.server --service metatool -dryRun
 -updateLocation <new_value> <old_value>

$ hive --service metatool

Final notes:

This command is insanely slow and takes hours depending on the number of partitions and tables in your Metastore. The command looks for all the tables and updates the references to old locations.

More info in this very useful post. Hope that helps.


Yash Sharma is a Big Data & Machine Learning Engineer, A newbie OpenSource contributor, Plays guitar and enjoys teaching as part time hobby.
Talk to Yash about Distributed Systems and Data platform designs.

Leave a Reply

Your email address will not be published. Required fields are marked *