Metadata management FAQ

Updated at:

This topic answers common questions about metadata management in E-MapReduce.

OSS or HDFS path not found error

Cause: This error occurs because you deleted a table's data from OSS without first deleting its metadata. As a result, the table schema remains, but the data no longer exists at the specified path or has been moved.

Solution: Modify the table's location to an existing path, and then drop the table.
alter table test set location 'oss://your_bucket/your_folder'
Note oss://your_bucket/your_folder must be an existing path in OSS.

UnknownHostException when deleting a Hive database

Cause: This error occurs if you create a Hive database on a cluster's HDFS and then release the cluster without deleting the database. The metadata still points to the HDFS of the released cluster, which is now inaccessible. If you manually create databases and tables in HDFS, you must delete them before you release the cluster.

Solution:
  1. Log on to the master node of the cluster. In the $HIVE_CONF_DIR/hivemetastore-site.xml file, find the connection URL, username, and password for the database.
    javax.jdo.option.ConnectionUserName // The database username.
    javax.jdo.option.ConnectionPassword // The database password.
    javax.jdo.option.ConnectionURL // The connection URL and the name of the database.
    <property>
      <name>javax.jdo.option.ConnectionUserName</name>
      <value>root</value>
    </property>
    <property>
      <name>hive.metastore.server.min.threads</name>
      <value>200</value>
    </property>
    <property>
      <name>hive.service.metrics.file.frequency</name>
      <value>30000</value>
    </property>
    <property>
      <name>hive.service.metrics.file.location</name>
      <value>/tmp/hivemetastore_metric.json</value>
    </property>
    <property>
      <name>javax.jdo.option.ConnectionPassword</name>
      <value>EMxxx</value>
    </property>
    <property>
      <name>javax.jdo.option.ConnectionURL</name>
      <value>jdbc:mysql://emxxx/xxx?createDatabaseIfNotExist=true&amp;characterEncoding=UTF-8</value>
    </property>
    <property>
      <name>javax.jdo.option.ConnectionDriverName</name>
      <value>com.mysql.jdbc.Driver</value>
    </property>
  2. On the master node, run the following command to log on to the Hive database. Enter the password when prompted.
    mysql -h ${DBConnectionURL} -u ${ConnectionUserName} -p
  3. After you log on to the Hive database, update the location to an existing OSS path in the same region.
    mysql> show databases;
    +--------------------------------------------+
    | Database                                   |
    +--------------------------------------------+
    | information_schema                         |
    | xxxxxxxxx77ac43c3bd0efae77e0bf1947d45fb4c896fb99 |
    +--------------------------------------------+
    mysql> use xxxxxxxxx77ac43c3bd0efae77e0bf1947d45fb4c896fb99;
    mysql> select * from dbs;
    +-------+------------------------+----------------------------------------+-----------+------------+------------+
    | DB_ID | DESC                   | DB_LOCATION_URI                        | NAME      | OWNER_NAME | OWNER_TYPE |
    +-------+------------------------+----------------------------------------+-----------+------------+------------+
    |     1 | Default Hive database  | oss://mybucket/hive/warehouse          | default   | public     | ROLE       |
    |     6 | NULL                   | hdfs://dirty-hostname/warehouse        | dirty_db  | NULL       | USER       |
    +-------+------------------------+----------------------------------------+-----------+------------+------------+
    mysql> update dbs set DB_LOCATION_URI = 'oss://your-bucket/your-db-folder' where DB_ID = 6;

Log on to the built-in MySQL

  1. Connect to the cluster over SSH.

    For more information, see Log on to a cluster.

  2. Run the following command to log on to the built-in MySQL database.
    mysql -uroot -pEMRroot1234

    The username is root, and the password is EMRroot1234.