i

Hadoop Tutorial

Hive Metastore

Metastore stores the metadata information using RDBMS and an open-source Object-Relational Model (ORM) layer called Data Nucleus. That converts the object representation into the structural, relational schema and vice versa. Low latency is the reason to choose RDBMS instead of HDFS. We can implement metastore in the following three configurations:

Embedded Metastore:

Both the metastore and the Hive services run in the same JVM by default using an embedded Derby Database instance, where metadata is stored in the local disk. This is known as embedded metastore configuration. In this case, the metastore database can be connected at a time by only one user.  If we start the second instance of a Hive driver, we will get an error. This is ideal for unit testing but not practical solutions.

                                            Fig: Hive Embedded Metastore

Local Metastore:

This configuration enables us to have multiple Hive sessions so that multiple users can access the metastore at the same time. Using any JDBC-compliant database such as MySQL, this is accomplished. This will be done in a different JVM or machine other than the one running in the same JVM for the Hive system and metastore service. In general, implementing a MySQL server as the metastore database is the most popular choice.

                                                          Fig: Hive Local Metastore

Remote Metastore:

The metastore service runs on its own independent JVM in the remote metastore configuration and not in the Hive service JVM. Specific processes use Thrift Network APIs to connect with the metastore server. In this case, to provide more availability, we can have one or more metastore servers. The main advantage of using remote metastore is you do not need to share JDBC login credentials with each Hive user to access the metastore database.

                                                            Fig: Hive Remote Metastore