Обсуждение: Backup question

Поиск
Список
Период
Сортировка

Backup question

От
A B
Дата:
Hello.

In the docs of 8.4 I read that one way of doing filesystem backup of
PostgreSQL is to
1. run rsync
2. stop the server
3. run second rsync
4. start server

But what would happen if you
1. run rsync
2. throw server through the window and buy new server
3. copy the rsynced data
4. start server

now, what would happen?
I guess the server would think: uh-oh, it has crashed, I'll try to fix it.

I understand that you will loose data, but will it be able to get
database in shape and running?
And to reduce the amount of lost data,  is there any clever "sync"
command I can run before step 1 to write more stuff to disk?

Re: Backup question

От
Vibhor Kumar
Дата:
On Mar 1, 2011, at 3:20 PM, A B wrote:

>
> But what would happen if you
> 1. run rsync
> 2. throw server through the window and buy new server
> 3. copy the rsynced data
> 4. start server
> now, what would happen?
> I guess the server would think: uh-oh, it has crashed, I'll try to fix it.

This will give you Inconsisten Backup and PG will try to recover the database

> I understand that you will loose data, but will it be able to get
> database in shape and running?
May be Or may not be. I have seen scenario's where people had to use pg_resetxlog

> And to reduce the amount of lost data,  is there any clever "sync"
> command I can run before step 1 to write more stuff to disk?

Have a look of Hot/Online Backup.
http://www.postgresql.org/docs/8.4/interactive/continuous-archiving.html

Thanks & Regards,
Vibhor