Thursday, June 12, 2008

Re: [GENERAL] file system level backup

iztech wrote:
> On Jun 12, 6:31 am, iztech <rashan...@gmail.com> wrote:
>> i have just switched to posgresql and installed for use with ruby.
>>
>> i need to move my app and database to a new server. since i can shut
>> down the server i think it will be easier for me to do a file system
>> level back up.

pg_dump and pg_restore should be just as good. If you're having trouble
manging postgresql they're probably a safer bet.

>> when i try to shut the server down i get this message
>>
>> sudo -u postgres pg_ctl -D /opt/local/var/db/postgresql82/defaultdb
>> stop
>> pg_ctl: PID file "/opt/local/var/db/postgresql82/defaultdb/
> can anyone let me know how i can tell where the db are located?

You've left out some key information, like your operating system, OS
version, postgresql version, and how you installed postgresql.

In general you should use the OS init script if provided to start and
stop postgresql. With most packaged Pg installs you can find the data
directory by examining the data_directory parameter in postgresql.conf,
which will normally be in a 'postgresql' directory under /etc .

If you hand-installed it (which looks like the case based on your
command line, above) then you should really know where the data
directory is because you had to run initdb to create it.

The -D argument on the command line above is the path to your data
directory. It's not clear whether that command is just copied & pasted
from somewhere else, because I'm a bit confused as to why you'd be
asking where the data directory was if you understood that. Check
postgresql.conf to confirm that the -D argumenet above is actually correct.

>> this is my first time attempting this. can someone suggest an easy
>> tutorial on this.

If you're new to Pg, just get the packages for your operating system if
they're reasonably recent. You can then use the OS init scripts and
normal management tools to handle Pg.

>> i have set up the new server with the same permissions so i should be
>> able to move the db to the new location.

Maybe. The version must be the same except for the patchlevel, eg
"8.2.1" is compatible with "8.2.3" but not "8.3.1". In general it is
MUCH SAFER to just use pg_dump and pg_restore to migrate your data.

--
Craig Ringer

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

No comments: