Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Formatting and moving of table

...

There are 3 different ways to setup metastore server using different Hive configurations. The relevant configuration parameters are

Config Param

Description

javax.jdo.option.ConnectionURL

JDBC connection string for the data store which contains metadata

javax.jdo.option.ConnectionDriverName

JDBC Driver class name for the data store which contains metadata

hive.metastore.uris

Hive connects to this URI to make metadata requests for a remote metastore

hive.metastore.local

local or remote metastore (Removed as of Hive 0.10: If hive.metastore.uris is empty local mode is assumed, remote otherwise)

hive.metastore.warehouse.dir

URI of the default location for native tables

These variables were carried over from old documentation without a guarantee that they all still exist:

Variable Name

Description

Default Value

hive.metastore.metadb.dir

 

 

hive.metastore.usefilestore

 

 

hive.metastore.rawstore.impl

 

 

org.jpox.autoCreateSchema

Creates necessary schema on startup if one doesn't exist. (e.g. tables, columns...) Set to false after creating it once.

 

org.jpox.fixedDatastore

Whether the datastore schema is fixed.

 

hive.metastore.checkForDefaultDb

 

 

hive.metastore.ds.connection.url.hook

Name of the hook to use for retriving the JDO connection URL. If empty, the value in javax.jdo.option.ConnectionURL is used as the connection URL

 

hive.metastore.ds.retry.attempts

The number of times to retry a call to the backing datastore if there were a connection error

1

hive.metastore.ds.retry.interval

The number of miliseconds between datastore retry attempts

1000

hive.metastore.server.min.threads

Minimum number of worker threads in the Thrift server's pool.

200

hive.metastore.server.max.threads

Maximum number of worker threads in the Thrift server's pool.

10000

Default configuration sets up an embedded metastore which is used in unit tests and is described in the next section. More practical options are described in the subsequent sections.

...

Mainly used for unit tests and only one process can connect to metastore at a time. So it is not really a practical solution but works well for unit tests.

Config Param

Config Value

Comment

javax.jdo.option.ConnectionURL

jdbc:derby:;databaseName=../build/test/junit_metastore_db;create=true

derby database located at hive/trunk/build...

javax.jdo.option.ConnectionDriverName

org.apache.derby.jdbc.EmbeddedDriver

Derby embeded JDBC driver class

hive.metastore.uris

not needed since this is a local metastore

 

hive.metastore.local

true

embeded is local

hive.metastore.warehouse.dir

No Format
file://${user.dir}/../build/ql/test/data/warehouse

unit test data goes in here on your local filesystem

...

In local metastore setup, each Hive Client will open a connection to the datastore and make SQL queries against it. The following config will setup a metastore in a MySQL server. Make sure that the server accessible from the machines where Hive queries are executed since this is a local store. Also the jdbc client library is in the classpath of Hive Client.

Config Param

Config Value

Comment

javax.jdo.option.ConnectionURL

jdbc:mysql://<host name>/<database name>?createDatabaseIfNotExist=true

metadata is stored in a MySQL server

javax.jdo.option.ConnectionDriverName

com.mysql.jdbc.Driver

MySQL JDBC driver class

javax.jdo.option.ConnectionUserName

<user name>

user name for connecting to mysql server

javax.jdo.option.ConnectionPassword

<password>

password for connecting to mysql server

hive.metastore.uris

not needed because this is local store

 

hive.metastore.local

true

this is local store

hive.metastore.warehouse.dir

<base hdfs path>

default location for Hive tables.

...

Server Configuration Parameters

Config Param

Config Value

Comment

javax.jdo.option.ConnectionURL

jdbc:mysql://<host name>/<database name>?createDatabaseIfNotExist=true

metadata is stored in a MySQL server

javax.jdo.option.ConnectionDriverName

com.mysql.jdbc.Driver

MySQL JDBC driver class

javax.jdo.option.ConnectionUserName

<user name>

user name for connecting to mysql server

javax.jdo.option.ConnectionPassword

<password>

password for connecting to mysql server

hive.metastore.warehouse.dir

<base hdfs path>

default location for Hive tables.

Client Configuration Parameters

Config Param

Config Value

Comment

hive.metastore.uris

thrift://<host_name>:<port>

host and port for the thrift metastore server

hive.metastore.local

false

this is local store

hive.metastore.warehouse.dir

<base hdfs path>

default location for Hive tables.

If you are using MySQL as the datastore for metadata, put MySQL client libraries in HIVE_HOME/lib before starting Hive Client or HiveMetastore Server.

Metastore Deployment Options in Pictures

^metastore_usage.pptx