About: After linux restarts, the table file in hadoop exists, but the table and library in hive do not exist.

      Recently I want to practice hive, I have a whole Linux virtual machine, and then configured a single machine hadoop, downloaded hive, built a test library in it, and built a few tables in the library.
      The virtual machine was forced to restart due to a problem. After restarting, enter hive,

show databases;

      What about the library I built? ? ? ? What about the watch I built? ? ?
      (; ° ○ °)
      (゚ Д ゚ ≡ ゚ д ゚) !?
       (╯ ` □ ′) ╯ (┴—┴
       ┻━┻︵╰ (‵ □ ′) ╯︵┻─┻
      ° (° ˊДˋ °) °
      ...
      ...
      ...
      Well, looking back now ... first reaction was thinking, is hadoop in the data lost? hadoop rush to see.

hadoop dfs -ls /

      It's okay to go in all the way to the table I built. . .
      Baidu. . .
      ...
      ...
      ...
      Could it be the metadata damaged?
      Suddenly remembered, I used hive directly after decompression, and did not set MySql as the meta database of hive.
      Well, the hive metabase is Derby by default, and only supports one session connection. When you start the terminal in a certain directory and enter the hive shell, hive will generate a derby file and a metastore_db directory in the current directory by default. These two files mainly save the results of some SQLs that have just been operated in the shell, such as new ones. Tables, added partitions, etc. Switch the directory to start a new shell, you cannot view the previously created table, and you cannot share the table data.
      Take a closer look, it seems that it is indeed different from the last boot directory. . .
      Then go to the last boot directory, and then

sh hive

      Well, it's normal. . . My library and table are back. . . .
      ...
      ...
      ...
      angry laughed. . .

Published 48 original articles · Like 36 · Visits 130,000+

Guess you like

Origin blog.csdn.net/weixin_42845682/article/details/105039321