2.3. Using Hive with PostgreSQL
To set up PostgreSQL for use with Hive:
On the Ambari Server host, stage the appropriate PostgreSQL connector for later deployment.
Install the connector.
RHEL/CentOS/Oracle Linux
yum install postgresql-jdbc*SLES
zypper install -y postgresql-jdbcConfirm that .jar is in the Java share directory.
ls /usr/share/java/postgresql-jdbc.jarChange the access mode of the.jar file to 644.
chmod 644 /usr/share/java/postgresql-jdbc.jarExecute the following command:
ambari-server setup --jdbc-db=postgres --jdbc-driver=/usr/share/java/postgresql-jdbc.jar
Create a user for Hive and grant it permissions.
Using the PostgreSQL database admin utility:
echo "CREATE DATABASE <HIVEDATABASE>;" | psql -U postgresecho "CREATE USER <HIVEUSER> WITH PASSWORD '<HIVEPASSWORD>';" | psql -U postgresecho "GRANT ALL PRIVILEGES ON DATABASE <HIVEDATABASE> TO <HIVEUSER>;" | psql -U postgresWhere <HIVEUSER> is the Hive user name, <HIVEPASSWORD> is the Hive user password and <HIVEDATABASE> is the Hive database name.

