Friday, March 23, 2018

Connect and Manage VCSA Database (PostgreSQL)

There are so many tools for PostgreSQL management if you want to connect and redesign your VCSA embedded database. (vPostgres), such as one of the best all of them, PgAdmin4.
But how can I connect to my database and where is "The Credential!"?
Now it's time to work around this matter step by step:
1. first of all, try SSH to your VCSA and stablish your session with root credentials or something like that privilege:)
2. Then after enabling shell by this "shell.set --enabled True" and granting shell access, you can find-out vPostgres configuration and credential on these below files (by vi & less):
    /etc/vmware-vpx/embedded_db.cfg
    /etc/vmware-vpx/vcdb.properties
3. Now you can successfully connect to your DB by username: VC and gained password from the mentioned files.
4. Consider some situations:
 Maybe you cannot access your database remotely, so edit file /storage/db/vpostgres/pg_hba.conf on VCSA and add the following line to file. Be careful to do on right place to work correctly, exactly where IPv4 or IPv6 are mentioned.
    host    all             all            IPAddr/SubMsk       md5

Then edit /storage/db/vpostgres/postgresql.conf and add this line to made database for listening on all IP addresses: listen_addresses = '*'
And at the end of all, execute one of these commands to restart vpostgres service on VCSA and commit the changes have been done:
    /etc/init.d/vmware-vpostgres restart   or   service vmware-vpostgres restart
Also, you can verify established connections on PostgreSQL port (TCP 5432) by running piping greps on netstat like this:
    netstat -anp | grep LISTEN | grep tcp | grep 5432
But if your server doesn't listen on port 5432, Try this:
    /usr/lib/applmgmt/networking/bin/firewall-reload
So you can verify your listening services by doing: iptables -L | grep postgres
If you want to know more about to do with your vCenter embedded DB and how to work with it on Windows or Linux based vCenter, check these VMware links:
At last thanks for these useful links, I hope you check them out carefully if you need more details:




No comments:

Post a Comment

I will start a new journey soon ...