vCSA 5.5 vPostgres backup routine - postgresql

I would like to save a bourne shell script in /etc/cron.* on vCenter server virtual appliance 5.5 to backup the vpostgres (VMware vCenter postgresql database).
VMware knowledge base article 2034505 recommend stopping vpxd service before backing up.
I suppose to prevent backing up the database in an inconsistent state (while vcenter operations are running).
However the official PostgreSQL documentation precises :
<<3.Perform the backup, using any convenient file-system-backup tool such as tar or cpio (not pg_dump or pg_dumpall). It is neither necessary nor desirable to stop normal operation of the database while you do this.>>
My questions are:
Do I need to stop VMWare Composer and vpxd services prior to backing up the DB ?
If not can I use cpio to back it up without stopping the services ? how ?
PostgreSQL or VMware experts answers preferred please.

You may notice that this script does not stop VPXD services for backing up the database. It is because the official PostgreSQL documentation precises : “pg_dump is a utility for backing up a PostgreSQL database. It makes consistent backups even if the database is being used concurrently“.
https://web.archive.org/web/20160122054619/http://bidabe.zapto.org/?p=360

Related

Postgresql utilising more CPU and Memory [duplicate]

User postgres is running a process that take all CPUs at 100% usage in a centos machine, the postgresql service is not running so it cannot be a query.
When I try to stop the process it restarts itself. Then name of the process is somewhat strange.
Congratulations!
By exposing a database with a weak superuser password to the internet you invited somebody to break in and use your CPU for their own purposes, probably mining crypto-currencies.
Take the machine from the internet, wipe it clean and re-install the operating system.
I had the same issue on my VPS. I considered to reinstall OS or clone VPS, but have alot of issues on that solution. So, i choose another way:
I did:
backup all data with "pg_dumpall"
backup pqsql configuration(pg_hba.conf,postgresql.conf,...)
Uninstall "everything" of pgsql
reinstall pgsql
restore pgsql data
Done

user postgres launches process that takes all CPUs 100% usage

User postgres is running a process that take all CPUs at 100% usage in a centos machine, the postgresql service is not running so it cannot be a query.
When I try to stop the process it restarts itself. Then name of the process is somewhat strange.
Congratulations!
By exposing a database with a weak superuser password to the internet you invited somebody to break in and use your CPU for their own purposes, probably mining crypto-currencies.
Take the machine from the internet, wipe it clean and re-install the operating system.
I had the same issue on my VPS. I considered to reinstall OS or clone VPS, but have alot of issues on that solution. So, i choose another way:
I did:
backup all data with "pg_dumpall"
backup pqsql configuration(pg_hba.conf,postgresql.conf,...)
Uninstall "everything" of pgsql
reinstall pgsql
restore pgsql data
Done

How to take backup of marklogic database while upgrading from CentOS to RHEL

We want to move our cluster server from centos to RHEL. How can we ensure that Marklogic database is backed up and in the process we don't loose any data.
Do we need to backup on external data storage device?
I guess keeping backup on an external storage drive will be a safe idea. Are you planning to block all the operations on you database? If not, you need to consider updates on database during the migration from CentOS to RHEL also.

Backing up the DB vs. backing up the VM

We're serving a Django/Postgres site running on a VM hypervisor. We're now trying to figure out our back up strategy and have two probable options:
Back up the DB directly using pg_dump
Back up the VM directly by copying the VM image
I'm with the latter as I think, I could simply back up everything that has to do with the site. I'm not sure whether I have to shut down the VM for this though.
What is a better and more recommended way of backing up a DB? Are there any reasons for not using the VM backup?
Thanks
The question basically boils down to, can you consider a hot copy of PostgreSQL's data files a backup?
The answer is: not really. PostgreSQL tries very hard through the use of WAL to ensure that its files are in a consistent state all the time and that it can survive a power failure, but starting it up from a copy of these files puts PostgreSQL into recovery mode. If the backup happened at the wrong second and PostgreSQL can't recover from the state of these files, your backup is useless. You don't want your backup/restore mechanism to depend on the recovery mechanism (unless you're dealing with "crash only" software, which PostgreSQL is not).
The probability of PostgreSQL not being able to recover from these files is not high, but it's not zero either. The probability of PostgreSQL not being able to load an SQL dump that it made, on the other hand, is zero. I prefer backup choices with lower probabilities of failure. pg_dump was designed for doing backups.
PostgreSQL recommends using pg_dump for backups, as a file system (or VM) backup requires the database to be shut down (and has other drawbacks):
http://www.postgresql.org/docs/8.1/static/backup-file.html
Edit: Also, a pg_dump backup will be significantly smaller than a filesystem dump of the same database.
There is an additional option. With PostgreSQL you can make an online backup that allows you to snapshot the file system and maintain consistency. You can see details here:
http://www.postgresql.org/docs/9.0/static/continuous-archiving.html
We use this exact method for making backups when we run PostgreSQL in a VM.

Postgresql cluster initialization

SQL distributes pre-initialized catalog cluster but for postgresql we need initialize cluster using initdb and a network service account. It fails in few cases and causing bit of misery!
Can initialize cluster ourselves and distribute pre-initialized cluster?
Thanks
The "cluster" (or data directory) depends on the operating system and the architecture. So a data directory that was initialized with initdb on a 32bit Linux will not work on a 64bit Windows.
But you don't need to do that. A service account is only necessary if you want to run PostgreSQL as a service.
You can easily use the ZIP distribution to install and start Postgres without the need for a full-fledge installation or a service account.
The steps to do so are:
Unzip the binaries
Run initdb pointing it to the directory where the database cluster should be created.
Run pg_ctl to start the server.
Note that the steps 2) and 3) must be run using the same user, otherwise the server will have no priviliges to write to the data directory.
These steps can easily be put into a batch file or shell script.
Hard to understand your question, but I think you are talking about the Windows installer for PostgreSQL. Right? What version, what installer, what about error messages, loggings, etc. ?
The installer can be found here.
SQL = database language, SQL Server =
Microsoft database product