Install the Hive service
In Ambari, you install the Hive service as you would any other service, and in the process, you configure Hive to use a database for the Hive Metastore. You can use Oracle, PostgreSQL, or MySQL as the backend database.
If you use PostgreSQL as the backend database, a supported version later than 9.6 is recommended. Using PostgreSQL 9.6 or earlier can cause problems. Hive Metastore uses hash indexes for PostgreSQL. Hive also uses hash indexes for ACID transactions. TC_TXNID_INDEX and HL_TXNID_INDEX can become corrupted.
The workaround is to reindex the corrupted indexes. For example, in PostgreSQL run
reindex index tc_txnid_index.
Configure a database for the Hive Metastore.
- Choose to use an existing database suitable for production work and perform the next step.
- Choose an Ambari installed database, such as MySQL, suitable for development work only, and skip the next step.
If you chose an existing database in the last step, create a hive user and
If Ambari installs the database, you do not need to create a hive user and database.For example, create user named hive and a database named hive, using the following command, but substituting a password of your choosing for [HIVE_PASSWORD] and the Hive MetaStore FQDN for [HIVE_METASTORE_FQDN]:
# mysql -u root -p CREATE USER 'hive'@'localhost' IDENTIFIED BY '[HIVE_PASSWORD]'; GRANT ALL PRIVILEGES ON *.* TO 'hive'@'localhost'; CREATE USER 'hive'@'%' IDENTIFIED BY '[HIVE_PASSWORD]'; GRANT ALL PRIVILEGES ON *.* TO 'hive'@'%'; CREATE USER 'hive'@'[HIVE_METASTORE_FQDN]' IDENTIFIED BY '[HIVE_PASSWORD]'; GRANT ALL PRIVILEGES ON *.* TO 'hive'@'[HIVE_METASTORE_FQDN]'; FLUSH PRIVILEGES; CREATE DATABASE hive;
Obtain the JDBC driver for the database to the Ambari server node, and as root,
set up the driver:
ambari-server setup --jdbc-db=<database name> --jdbc-driver=<path to driver>
- In Ambari Services > Hive > Configs, test the connection to the database.
- Follow prompts from the Ambari wizard to complete the installation.