I have two machines:
Remote, Ubuntu server, example.com, database:staging(owner user2, pass2), passwordless login for user1 (sudoer) via sshLocal, Ubuntu, localhost, database:local(owner user3, pass3)
The question is:
- How to import data and structure of
stagingdatabase tolocal(and vice versa) in one command/script? - How to set up the permissions?
These are not production databases, so I don't need real time sync. I just need to automate the psql tasks (usually done by go to phppgadmin, export the data to file, import the data from file via psql, all from Local machine).
The best solution would be database owner/password independent, because I have few pairs more of such a databases. I have a root access on both machines and I can install any additional required users accounts/software.