I just set up an xwiki with PostgreSQL on an Ubuntu machine. As I can read in the xwiki documentation, I try to do a backup my xwiki with
pg_dump xwiki > xwiki.sql
but I get an error message:
pg_dump: [archiver (db)] connection to database “xwiki” failed: FATAL: role “vince” does not exist
“vince” postgres account missing (this account must have right access to your postgresql server and xwiki database).
Anyway, you can use “postgres” account to dump your database, or better a dedicated postgres account with enough right access.
You can fill ~/.pgpass with “hostname:port:database:username:password”:
thank you for your reply. I tried with “postgres” user like this : pg_dump -U postgres xwiki > xwiki.sql
but I get the following error message: pg_dump: [archiver (db)] connection to database “xwiki” failed: FATAL: Peer authentication failed for user “postgres”.
What do you mean with “a dedicated postgres account with enough right access.” ? Should I create a “postgres” account on my linux machine?
I installed xwiki/postgresql via debian apt, so it created everything by itself for me automatically.
I tried with the ~/.pgpass but it didn’t help…
I’m new to xwiki and postgresql, sorry for the newby questions
This looks to me more like a file system access problem than a DB access rights issue. The pg_dump process is not allowed to write to the file xwiki.sql, wherever this might be located.
Does pg_dump xwiki > /dev/null work? (Or course this does not place the dump in a location from where it can be restored ) Or pg_dump xwiki > /tmp/xwiki.sql might be better for testing …
pg_hba has peer auth enabled, the fastest way to resolve this would be to change pg_hba to allow ‘trust’ authentication for localhost, meaning that localhost connections (unix socket) will not be required to auth.
Once you do that pg_dump etc… will just work, but you also want to go into postgresql as the user ‘postgres’ and create a new SUPERUSER account, you can then use this account in the future for logging in; you might want to update your auth method to md5
The reason you are getting thatis that you are trying to restore data OVER an already existing dataset, you want to use the -C flag for pg_dumpall (which will add the ‘drop’ statements infront of the data dump; or alternatively clear the databases from postgres before proceeding.
Normally in cases that want this type of backup solution I would suggest using ZFS as a backing storage medium for postgresql and using snapshots which is much easier
sudo -u postgres pg_dump xwiki > xwiki.sql
Seeing the below statement after executing the above command. could not change directory to “/home/xxxxx”: Permission denied Is it a warning message ?
And I can see the dump file xwiki.sql on my home directory. Is it a complete dump file? or is it incomplete? And the file size 81 MB. Can I consider it as Perfect dump?