This page was exported from Knowledge Base [ https://kb.net4future.de ]
Export date: Sun Aug 9 23:14:07 2020 / +0000 GMT

Enabling access to vPostgres Database:


First, log into the vRA appliance or SSH to it using root account.

Next edit pg_hba.conf file
vi /storage/db/pgdata/pg_hba.conf

Check for the presence of the line
local      all              postgres                            trust

What this enables, is using the local machine you can use vcac user to login to the database. Since I wanted to access it remotely, I added the following line:
host       all              all         10.110.23.148/24               trust

The above line allows any user from the machine 10.110.23.148 to connect to the database.

In the next step, edit the postgresql.conf file.
vi /storage/db/pgdata/postgresql.conf

In that file add the following line
#listen_addresses = 'localhost'         # what IP address(es) to listen on;
listen_addresses = '*'

What I am doing here, is listening to everything.

The above steps will let me connect to the database from my machine at 10.110.23.148.

Get the vcac user password:


In the next stage, we need to get the password for the vcac user. Detailed steps for doing so is provided in this VMware KB article.

Run the following command
cat /etc/vcac/server.xml |grep password="*"

You get an output similar to:

<Resource abandonWhenPercentageFull=”0″ auth=”Container” driverClassName=”org.postgresql.Driver”     factory=”com.vmware.vcac.tools.tomcat.db.CafeEncryptedDataSourceFactory” fairQueue=”false” initialSize=”10″     jdbcInterceptors=”ResetAbandonedTimer” jmxEnabled=”true” logAbandoned=”true” logValidationErrors=”true” maxActive=”100″     maxIdle=”20″ maxWait=”120000″ minEvictableIdleTimeMillis=”60000″ minIdle=”10″ name=”jdbc/cafe”     password=”s2enc~646fCCJWPaSYJe91XKBpkrc1E+3N83n7ZIF3a+PGEaI=” removeAbandoned=”true” removeAbandonedOnBorrow=”true”     removeAbandonedOnMaintenance=”true” removeAbandonedTimeout=”240″ suspectTimeout=”60″ testOnBorrow=”true”     testOnReturn=”false” testWhileIdle=”true” timeBetweenEvictionRunsMillis=”30000″ type=”javax.sql.DataSource”     url=”jdbc:postgresql://127.0.0.1:5433/vcac” username=”vcac” validationInterval=”30000″ validationQuery=”select 1″     validationQueryTimeout=”2″/>

Note the encrypted value after the password field. In this case the value is “s2enc~646fCCJWPaSYJe91XKBpkrc1E+3N83n7ZIF3a+PGEaI=”. In the next step we will find the actual password.
/usr/lib/vcac/tools/config/bin/vcac-config prop-util -d --p s2enc~646fCCJWPaSYJe91XKBpkrc1E+3N83n7ZIF3a+PGEaI= | less

This will give you the password.

Connecting to vPostgres using pgAdmin:


Now all that is left is to connect to the database using the user id and password. Create a new connection to the vPostgres database and connect to it. Post connection it looks like the following:
Post date: 2018-07-26 12:57:32
Post date GMT: 2018-07-26 12:57:32
Post modified date: 2018-07-26 12:57:32
Post modified date GMT: 2018-07-26 12:57:32
Powered by [ Universal Post Manager ] plugin. HTML saving format developed by gVectors Team www.gVectors.com