Pivotal Knowledge Base

Follow

How to find the Hive metadata store password

Environment

Product Version
Pivotal HD 3.x
Ambari server 1.7.1 / 2.1.x
Hive 0.14.x

Purpose

While setting up HiveServer2 HA or when fixing permissions in the MYSQL Hive metastore, it may be necessary to know the Hive Metastore MYSQL password. This article describes how to find the password in case the hive metastore password is different than the default password "hive" and the password has been lost.

Procedure 1

  1. Log into the hive server node via SSH as root.
  2. Locate the hive-site.xml file which by default, should be in /etc/hive/conf/hive-site.xml.
  3. Search for the configuration setting: "javax.jdo.option.ConnectionPassword"
  4. The value associated with the configuration setting "javax.jdo.option.ConnectionPassword" is the hive metastore password; in the example below, the password is "hive":
[root@node1 conf]# grep -A1 "Password" /etc/hive/conf/hive-site.xml
      <name>javax.jdo.option.ConnectionPassword</name>
      <value>hive</value>
[root@node1 conf]# ^C

     5. If the option "javax.jdo.option.ConnectionPassword" is not present in the hive-server.xml, use Procedure 2 listed below.

Procedure 2

If "javax.jdo.option.ConnectionPassword" is not present in the hive-site.xml, use this procedure:

     1. Connect via SSH to the Ambari server.

     2. Connect to the Ambari database.

[root@phd301 ~]# psql -U ambari
Password for user ambari:
psql (8.4.20)
Type "help" for help.

     3. Enable expanded display:

ambari=> \x on
Expanded display is on.

     4. Review the latest hive-server configuration in Ambari (the output may take up multiple lines):

ambari=> select config_id,type_name,config_data from clusterconfig where type_name='hive-site' ORDER BY config_id DESC LIMIT 1;

-[ RECORD 1 ]--config_id | 120 type_name | hive-site config_data | 
{"hive.security.authenticator.manager":"org.apache.hadoop.hive.ql.security.ProxyUserAuthenticator","datanucleus.cache.level2.type":"none","hive.optimize.index.filter":"true","hive.enforce.sorting":"true",
"javax.jdo.option.ConnectionPassword":"changeme","hive.stats.autogather":"true","hive.metastore.uris":"thrift://dn2.lab:9083","hive.stats.dbclass":"fs","hive.map.aggr.hash.force.flush.memory.threshold":"0.9","hive.server2.transport.mode":"binary","hive.compactor.worker.timeout":"86400L","hive.metastore.pre.event.listeners":"org.apache.hadoop.hive.ql.security.authorization.AuthorizationPreEventListener","hive.convert.join.bucket.mapjoin.tez":"false","hive.tez.container.size":"170","javax.jdo.option.ConnectionURL":"jdbc:mysql://dn2.lab/hive?createDatabaseIfNotExist\u003dtrue"
"hive.zookeeper.client.port":"2181","hive.compactor.worker.threads":"0","hive.exec.submitviachild":"false"} ambari=>

    5. From the output above, find "javax.jdo.option.ConnectionPassword". Immediately afterwards, the password should be displayed; for example, here "changeme" is the password:

"javax.jdo.option.ConnectionPassword":"changeme"

 

 

Comments

Powered by Zendesk