Metastore is the central repository of Hive metadata. It is divided into 2 pieces: a service and the backing store for the data. By default, the metastore service runs in the same JVM as the Hive service and contains an embedded Derby database instance backed by the local disk. This is called as the embedded metastore configuration.
Embedded metastore is the Derby metastore. Derby database does not require any installation. Using an embedded metastore is a simple way to get started with Hive, but the disadvantage of using embedded Derby database is that it can access the database files on disk at any one time, which means we can have only one Hive session open at a time that accesses the same metastore.
If we Try to start a second session it produces an error when it attempts to open a connection to the metastore.
Error is seen as
Caused by: java.sql.SQLException: Another instance of Derby may have already booted the database /home/hdadmin/hive-0.13.1-cdh5.3.2/metastore_db.
We can also say Derby as a single threaded since it supports only one user at a time.The solution to supporting multiple sessions (and therefore multiple users) is to use a standalone database like MySql, oracle, etc.
This configuration is referred to as a local metastore, since the metastore service still runs in the same process as the Hive service but connects to a database running in a separate process, either on the same machine or on a remote machine. We store metadata in standalone database for accessing fastly and the original data is stored in HDFS.
Any JDBC-compliant database may be used by setting the javax.jdo.option.* configuration properties. In hive-site.xml we need to configure metastore (derby) db name in property section.