![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
/usr/bin/pg_dump -h localhost -p 5432 -D -O -x -U someuser somedb The problem is that pg_dump doesn't want a password on the commandline. (The reason why the password is not welcome on the commandline is clear: If it did accept a password it would be visible for all who can ps on the same machine.) |
#3
| |||
| |||
|
|
On 04/23/2010 01:06 PM, Erwin Moller wrote: /usr/bin/pg_dump -h localhost -p 5432 -D -O -x -U someuser somedb The problem is that pg_dump doesn't want a password on the commandline. (The reason why the password is not welcome on the commandline is clear: If it did accept a password it would be visible for all who can ps on the same machine.) Would it be feasible to modify pg_dump to read a password from a specified file? Ldapsearch and other programs do it. That way you could write the password to a pipe from your application, and feed its output to pg_dump -y /dev/fd/0 |
#4
| |||
| |||
|
|
But I never heard of that -y option, nor does my 'man pg_dump' know it. |
#5
| |||
| |||
|
|
On 04/23/2010 04:09 PM, Erwin Moller wrote: But I never heard of that -y option, nor does my 'man pg_dump' know it. Yes, I was mildly proposing to add the option. It's not there. |
#6
| |||
| |||
|
|
Marco Mariani schreef: On 04/23/2010 04:09 PM, Erwin Moller wrote: But I never heard of that -y option, nor does my 'man pg_dump' know it. Yes, I was mildly proposing to add the option. It's not there. Well, to be honest, I simply don't have the balls to expand the default pg_dump on my production environment. ;-) By the way: I just told a co-worker of mine about the problem and he said that I solved that problem years ago in another project. (I totally forgot. I clearly need a memory upgrade.) An alternative solution is this command: $command = "export PGPASSWORD=theneededpassword /usr/lib/postgresql/8.1/bin/pg_dump -D -O -x -c -h localhost -p 5433 -U someuser somedatabase"; |
|
I like that solution even better. Simple and clean. I bet somebody in here gave me that solution a few years ago. ;-) Thanks for your help. Regards, Erwin Moller |
#7
| |||
| |||
|
|
I must be missing something important here. Can anybody clarify it a little more for me? |
#8
| |||
| |||
|
|
On Fri, 23 Apr 2010 13:06:28 +0200, Erwin Moller wrote: I must be missing something important here. Can anybody clarify it a little more for me? Yup. Dumping database through the web interface is not a really good idea. For some things, CLI the king. For everything else, there is a Mastercard(TM). |
#9
| |||
| |||
|
|
Yup. Dumping database through the web interface is not a really good idea. For some things, CLI the king. For everything else, there is a Mastercard(TM). Hi, Well, personally I think that is for the developer to decide. |
|
For example: I don't want my clients to have shell access. |
|
That would give me more security headaches than offering a backup via a (secured) webinterface. |
#10
| |||||||||||
| |||||||||||
|
|
On Sun, 25 Apr 2010 17:24:30 +0200, Erwin Moller wrote: Yup. Dumping database through the web interface is not a really good idea. For some things, CLI the king. For everything else, there is a Mastercard(TM). Hi, Well, personally I think that is for the developer to decide. |
|
Actually, no it is not for the developer to decide. Database backup is a sensitive operation which should not be a part of the application. |
|
For example: I don't want my clients to have shell access. Neither do I. Why would your clients have to do database backup? |
|
Database backup is a part of the DBA job. |
|
I am an Oracle DBA working with Oracle since 1989, lately into Postgres, and have never offered such capability. In the world of commercial database applications, backup is offered only as a DBA tool. Clients don't do backups, period. DBA does backups. |
|
Second, pg_dump is not a good backup tool. It offers a logically consistent snapshot of your data, but it doesn't allow you to do recovery. There is a strong possibility of data loss. |
|
Do you allow your users to have their database schemas? |
|
You are probably an ISP, offering hosting? |
|
If your users are using Postgres, as they should because it's a great database, they can do it from their own client tools: pg_dump -U mgogala -W -h lpo-postgres-01 scott >/tmp/scott.sql Password: |
|
It works like a charm. I needed -W because I am a trusted user on this host, being a DBA, so it wouldn't have asked me for my password without "-W". You get some perks from being able to edit pg_hba.conf. The bottom line is this: if the client is using Postgres, he or she should be proficient with psql and pg_dump. No need for web dump. |
|
That would give me more security headaches than offering a backup via a (secured) webinterface. If they need to backup their application data, which is, by the way, not instilling confidence, you could always offer to dump them into CSV format. |
![]() |
| Thread Tools | |
| Display Modes | |
| |