QBoard » Big Data » Big Data - Data Storage : Hive, HBase, MongoDB, Teradata.. » How can I delete a hive database without using hive terminal?

How can I delete a hive database without using hive terminal?

  • I have a multinode Hadoop cluster setup with two nodes(one master node and one slave node). Each node with 8GB RAM.

    I have also configured hive on the master node. Everything is up and working.

    Nodemanager and Datanode are working on the slave node.

    ResourceManager, Namenode, and SecondaryNamenode are also working on the master node.

    I am able to access the hive terminal as well, but I am not able to drop the database through the drop database databaseName; command. It is not showing any error but has been stuck for more than an hour... Three tables have size 10000 * 20. I thought these may be causing the speed issues, so I wanted to delete the database, but am not able to delete via drop database command, so is there any way to do it directly by deleting any files?

    I have tried to access hive.metastore.warehouse.dir to delete the database directly, but this directory is completely empty.

    Similar slow behavior can be observed with other hive commands as well. I am just able to run one command i.e. show databases;. And this command is also taking around 70 secs to execute.

    I am a beginner in the Big Data domain so, any help would be appreciated. If I need to add any configuration file for reference please do tell me.

      June 11, 2019 4:25 PM IST
    0
  •  

    First of all, you should check the metastore.log file if there is an exception occurred.

    You can manually delete the hdfs directory (recursive remove) of the particular table followed by drop table if exists (table_name)

      June 14, 2019 12:22 PM IST
    0
  • Are you accessing via HDFS?

    The following command should display all of your databases:

    hdfs dfs -ls /warehouse/tablespace/managed/hive

    Note: /warehouse/tablespace/managed/hive must be your hive.metastore.warehouse.dir

    With -rm you can remove it:

    hdfs dfs -rm -r /warehouse/tablespace/managed/hive/yourDatabase
      June 11, 2019 4:26 PM IST
    0
  • Working with HDFS here? I have tried this at my end and this worked perfectly for me.

    • To delete the desired database without using Hive terminal, you have to go to the hive database location in hdfs, you will find your database in warehouse directory.

    •  My directory is /usr/hive/warehouse/userme.db

    Now, open another terminal for flexibility. 

    • To remove this particular database(for me- userme.db) copy the directory given above and paste on the terminal after typing remove command.

     

    $ hdfs dfs -rm -r /usr/hive/warehouse/userme.db

     

    Now your database is deleted without using Hive terminal.

      February 2, 2022 1:47 PM IST
    0