Community Articles

Find and share helpful community-sourced technical articles.
avatar
Contributor

Perform the following steps to access the Hive MetaStore database :-

 

  1. SSH to the Data lake CM Node as 'cloudbreak' user.
  2. Run 'sudo -i' to gain root access.
  3. source activate_salt_env
  4. export PGPASSWORD=$(salt-call pillar.get postgres:hive:password 2>/dev/null| tail -n 1 | awk '{print $1}')
  5. HIVE_DB=$(salt-call pillar.get postgres:hive:database 2>/dev/null| tail -n 1 | awk '{print $1}')
  6. HIVE_DB_USER=$(salt-call pillar.get postgres:hive:user 2>/dev/null| tail -n 1 | awk '{print $1}')
  7. psql -U ${HIVE_DB_USER} -d ${HIVE_DB}

e.g.

 

[root@xxxx-master0 ~]# source activate_salt_env
(salt_3001.8) [root@xxxx-master0 ~]# export PGPASSWORD=$(salt-call pillar.get postgres:hive:password 2>/dev/null| tail -n 1 | awk '{print $1}')
(salt_3001.8) [root@xxxx-master0 ~]# HIVE_DB=$(salt-call pillar.get postgres:hive:database 2>/dev/null| tail -n 1 | awk '{print $1}')
(salt_3001.8) [root@xxxx-master0 ~]# HIVE_DB_USER=$(salt-call pillar.get postgres:hive:user 2>/dev/null| tail -n 1 | awk '{print $1}')
(salt_3001.8) [root@xxxx-master0 ~]# psql -U ${HIVE_DB_USER} -d ${HIVE_DB} -c "SELECT version();"
                                                 version                                                  
----------------------------------------------------------------------------------------------------------
 PostgreSQL 14.11 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-20), 64-bit
(1 row)

 

 

 

1,285 Views