{"id":312,"date":"2017-11-17T11:34:26","date_gmt":"2017-11-17T11:34:26","guid":{"rendered":"http:\/\/marcel-jan.eu\/datablog\/?p=312"},"modified":"2017-11-17T11:34:49","modified_gmt":"2017-11-17T11:34:49","slug":"recovering-your-hdp-2-6-1-sandbox-on-virtualbox-after-a-restart","status":"publish","type":"post","link":"https:\/\/marcel-jan.eu\/datablog\/2017\/11\/17\/recovering-your-hdp-2-6-1-sandbox-on-virtualbox-after-a-restart\/","title":{"rendered":"Recovering your HDP 2.6.1 Sandbox on VirtualBox after a restart"},"content":{"rendered":"<p>If you&#8217;ve worked with the Hortonworks Data Platform 2.x sandbox of later versions in VirtualBox and made it shutdown rather vigorously, you might have noticed that you won&#8217;t get past this startup screen when you try to start it up the next time:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-313\" src=\"https:\/\/marcel-jan.eu\/datablog\/wp-content\/uploads\/2017\/11\/reanimate_hdp26_01-300x197.png\" alt=\"\" width=\"627\" height=\"412\" \/><\/p>\n<p>I had this a couple of times and that&#8217;s why I decided to pause my sandbox every time and save it before shutting down my laptop. But yesterday Windows 10 decided to step in. After a day of studying it was high time for me to have dinner, during which I kept the laptop on. Little did I know that Windows 10 at that time decided to update and restart. And to do this, it needed to shutdown every application. Including VirtualBox. When I came back I found out to my horror that my carefully prepared HDP sandbox was shutdown in the roughest of ways. Thanks, Microsoft!<!--more--><\/p>\n<p>I started the HDP 2.6.1 sandbox again, but.. that startup screen never went further. I had the option to start again fresh by importing the VirtualBox anew, transfering my files again, creating my Hive databases again&#8230; No! I decided to put a line in the sand. This HDP sandbox will live! &#8220;Don&#8217;t go into the light.. er.. Horty!&#8221;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-314\" src=\"https:\/\/marcel-jan.eu\/datablog\/wp-content\/uploads\/2017\/11\/Heart-Reanimation-65992-300x287.gif\" alt=\"\" width=\"300\" height=\"287\" \/><\/p>\n<h2>Let&#8217;s ask Google<\/h2>\n<p>When you google &#8220;hdp sandbox hangs&#8221; or &#8220;hdp sandbox won&#8217;t restart&#8221; you almost certainly arrive at the Hortonworks Community. There is some advise there that means you have to start again on a different platform (No!) and some tips to diagnose the situation. For example, you can see how far CentOS got during the startup by pressing an cursor key.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-315\" src=\"https:\/\/marcel-jan.eu\/datablog\/wp-content\/uploads\/2017\/11\/reanimate_hdp26_02-300x167.png\" alt=\"\" width=\"607\" height=\"338\" \/><\/p>\n<p>Now at least you have a better way to describe how far the startup got.<\/p>\n<p>Even more valuable was <a href=\"https:\/\/community.hortonworks.com\/questions\/107189\/i-am-unable-to-start-the-hdp-26.html\">this advise<\/a> from Hortonworks Community user Tiago Rubio that you can still access the sandbox in this situation.<\/p>\n<h2>Let&#8217;s access Ambari<\/h2>\n<p>Does this mean I can access Ambari? Yes, yes you can. Give the startup some time, then go to <a href=\"http:\/\/sandbox.hortonworks.com:8080\">http:\/\/sandbox.hortonworks.com:8080<\/a> and sure enough &#8211; well I at least got to see this screen:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-316\" src=\"https:\/\/marcel-jan.eu\/datablog\/wp-content\/uploads\/2017\/11\/reanimate_hdp26_03-300x137.png\" alt=\"\" width=\"624\" height=\"285\" \/><\/p>\n<p>But the news is not all good. Almost nothing is up.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-317\" src=\"https:\/\/marcel-jan.eu\/datablog\/wp-content\/uploads\/2017\/11\/reanimate_hdp26_04-74x300.png\" alt=\"\" width=\"74\" height=\"300\" \/><\/p>\n<h2>Start all up<\/h2>\n<p>So my first intuition was to use the Actions -&gt; Start All button.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-318\" src=\"https:\/\/marcel-jan.eu\/datablog\/wp-content\/uploads\/2017\/11\/reanimate_hdp26_05.png\" alt=\"\" width=\"223\" height=\"183\" \/><\/p>\n<p>Sure enough Ambari sets to work. Things will work out after all, you&#8217;ll see. That is until&#8230; you get the results back:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-319\" src=\"https:\/\/marcel-jan.eu\/datablog\/wp-content\/uploads\/2017\/11\/reanimate_hdp26_06-300x43.png\" alt=\"\" width=\"614\" height=\"88\" \/><\/p>\n<p>Click on the\u00a0<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-320\" src=\"https:\/\/marcel-jan.eu\/datablog\/wp-content\/uploads\/2017\/11\/reanimate_hdp26_06a.png\" alt=\"\" width=\"19\" height=\"22\" \/> a couple of times and you get a list of what components started and which ones didn&#8217;t.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-321\" src=\"https:\/\/marcel-jan.eu\/datablog\/wp-content\/uploads\/2017\/11\/reanimate_hdp26_07-300x243.png\" alt=\"\" width=\"615\" height=\"498\" \/><\/p>\n<p>Notice that the startup of the (YARN) Resource Manager was aborted, as was the Node Manager and many other tasks. These are very important.<\/p>\n<h2>Is there a Hadoop engineer in the house?<\/h2>\n<p>It seems we have to start some stuff by hand. For this you need to know in what order to start things. First we go to the Dashboard and look at HDFS.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-322\" src=\"https:\/\/marcel-jan.eu\/datablog\/wp-content\/uploads\/2017\/11\/reanimate_hdp26_08-300x109.png\" alt=\"\" width=\"611\" height=\"222\" \/><\/p>\n<p>Ah, see Hadoop runs on HDFS. And here the NameNode and the DataNode of HDFS are stopped. Let&#8217;s click on the NameNode link. We now get a list of components on the sandbox.hortonworks.com server, which is the only server in this &#8220;cluster&#8221;.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-323\" src=\"https:\/\/marcel-jan.eu\/datablog\/wp-content\/uploads\/2017\/11\/reanimate_hdp26_09-300x206.png\" alt=\"\" width=\"604\" height=\"415\" \/><\/p>\n<p>Now let&#8217;s try to start the NameNode individually.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-324\" src=\"https:\/\/marcel-jan.eu\/datablog\/wp-content\/uploads\/2017\/11\/reanimate_hdp26_10-300x69.png\" alt=\"\" width=\"300\" height=\"69\" \/><\/p>\n<p>In my case it turned out it went stuck at 35% progress for quite a while. What was happening? A couple of clicks on <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-320\" src=\"https:\/\/marcel-jan.eu\/datablog\/wp-content\/uploads\/2017\/11\/reanimate_hdp26_06a.png\" alt=\"\" width=\"19\" height=\"22\" \/> and I found this message:<\/p>\n<pre>2017-11-17 10:15:24,244 - Retrying after 10 seconds. Reason: Execution of '\/usr\/hdp\/current\/hadoop-hdfs-namenode\/bin\/hdfs dfsadmin -fs \r\nhdfs:\/\/sandbox.hortonworks.com:8020 -safemode get | grep 'Safe mode is OFF'' returned 1.<\/pre>\n<p>It took multiple minutes, but eventually the NameNode did start without my interference. You need a bit of patience here. Now on to the next component: the DataNode. You&#8217;ll find it a bit lower in the list. This one started pretty quickly.<\/p>\n<p>We could do everything by hand from here on, but actually at this point I gave that Start All button a try again. And now 100% of the services start.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-326\" src=\"https:\/\/marcel-jan.eu\/datablog\/wp-content\/uploads\/2017\/11\/reanimate_hdp26_11-300x43.png\" alt=\"\" width=\"649\" height=\"93\" \/><\/p>\n<p>Going back to the Dashboard in Ambari I see only green marks:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-299\" src=\"https:\/\/marcel-jan.eu\/datablog\/wp-content\/uploads\/2017\/11\/hive_asteroids_01-80x300.png\" alt=\"\" width=\"106\" height=\"397\" \/><\/p>\n<h2>Testing it<\/h2>\n<p>But does it really work? I want proof that what I was working on still works.<\/p>\n<p>Here is Hive:<\/p>\n<pre>[root@sandbox ~]# su - spark\r\n[spark@sandbox ~]$ export SPARK_MAJOR_VERSION=2\r\n[spark@sandbox ~]$ export HIVE_HOME=\/usr\/hdp\/2.6.1.0-129\/hive\r\n[spark@sandbox ~]$ hive\r\nlog4j:WARN No such property [maxFileSize] in org.apache.log4j.DailyRollingFileAppender.\r\n\r\nLogging initialized using configuration in file:\/etc\/hive\/2.6.1.0-129\/0\/hive-log4j.properties\r\nhive&gt; show databases;\r\nOK\r\nasteroids\r\ndefault\r\nfoodmart\r\nhdpcd_retail_db_orc\r\nhdpcd_retail_db_txt\r\nxademo\r\nTime taken: 2.137 seconds, Fetched: 6 row(s)\r\nhive&gt; use asteroids;\r\nOK\r\nTime taken: 0.291 seconds\r\nhive&gt; select count(*) from asteroids;\r\nOK\r\n745470\r\nTime taken: 0.662 seconds, Fetched: 1 row(s)<\/pre>\n<p>That is promissing. But let&#8217;s see Spark next:<\/p>\n<pre>[spark@sandbox ~]$ pyspark --master yarn-client --conf spark.ui.port=12562 --executor-memory 1G --num-executors 1\r\nSPARK_MAJOR_VERSION is set to 2, using Spark2\r\nPython 2.6.6 (r266:84292, Aug 18 2016, 15:13:37)\r\n[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\nWarning: Master yarn-client is deprecated since 2.0. Please use master \"yarn\" with specified deploy mode instead.\r\nSetting default log level to \"WARN\".\r\nTo adjust logging level use sc.setLogLevel(newLevel). For SparkR, use setLogLevel(newLevel).\r\n\/usr\/hdp\/current\/spark2-client\/python\/pyspark\/context.py:207: UserWarning: Support for Python 2.6 is deprecated as of Spark 2.0.0\r\n warnings.warn(\"Support for Python 2.6 is deprecated as of Spark 2.0.0\")\r\nWelcome to\r\n ____ __\r\n \/ __\/__ ___ _____\/ \/__\r\n _\\ \\\/ _ \\\/ _ `\/ __\/ '_\/\r\n \/__ \/ .__\/\\_,_\/_\/ \/_\/\\_\\ version 2.1.1.2.6.1.0-129\r\n \/_\/\r\n\r\nUsing Python version 2.6.6 (r266:84292, Aug 18 2016 15:13:37)\r\nSparkSession available as 'spark'.\r\n&gt;&gt;&gt; orders = sc.textFile(\"\/user\/dmaster\/retail_db\/orders\")\r\n&gt;&gt;&gt; orders.count()\r\n68883<\/pre>\n<p>So that all works great. I can do my experimenting again. Phew!<\/p>\n<h2>Are we really done?<\/h2>\n<p>One more thing. So the Ambari Dashboard looks apple green, but when you look at the components on the sandbox.hortonworks.com server it actually does not.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-328\" src=\"https:\/\/marcel-jan.eu\/datablog\/wp-content\/uploads\/2017\/11\/reanimate_hdp26_12-194x300.png\" alt=\"\" width=\"469\" height=\"725\" \/><\/p>\n<p>I haven&#8217;t checked out what status these components had before I brought my HDP sandbox back from the death. I know HDFS&#8217; SNameNode won&#8217;t work on only one server, but some others might be necessary for what you are working on. I didn&#8217;t went as far as to test this, but you could try starting these components individually and if they don&#8217;t start, take a good look at the errors they produce.<\/p>\n<h2>Horty lives<\/h2>\n<p>So in the end my HDP sandbox is alive again, but the VirtualBox will stay in it&#8217;s startup screen. Consider this a bypass operation. Hopefully this helps you to save your work too.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you&#8217;ve worked with the Hortonworks Data Platform 2.x sandbox of later versions in VirtualBox and made it shutdown rather vigorously, you might have noticed that you won&#8217;t get past this startup screen when you try to start it up the next time: I had this a couple of times [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35,55],"tags":[86,61,62,42,5,23,87,60,84,88],"class_list":["post-312","post","type-post","status-publish","format-standard","hentry","category-apache-products-for-outsiders","category-howto","tag-ambari","tag-datanode","tag-hdfs","tag-hdp-sandbox","tag-hive","tag-hortonworks","tag-horty","tag-namenode","tag-spark","tag-virtualbox"],"_links":{"self":[{"href":"https:\/\/marcel-jan.eu\/datablog\/wp-json\/wp\/v2\/posts\/312","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/marcel-jan.eu\/datablog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/marcel-jan.eu\/datablog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/marcel-jan.eu\/datablog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/marcel-jan.eu\/datablog\/wp-json\/wp\/v2\/comments?post=312"}],"version-history":[{"count":6,"href":"https:\/\/marcel-jan.eu\/datablog\/wp-json\/wp\/v2\/posts\/312\/revisions"}],"predecessor-version":[{"id":332,"href":"https:\/\/marcel-jan.eu\/datablog\/wp-json\/wp\/v2\/posts\/312\/revisions\/332"}],"wp:attachment":[{"href":"https:\/\/marcel-jan.eu\/datablog\/wp-json\/wp\/v2\/media?parent=312"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/marcel-jan.eu\/datablog\/wp-json\/wp\/v2\/categories?post=312"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/marcel-jan.eu\/datablog\/wp-json\/wp\/v2\/tags?post=312"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}