Thread: File System backup

File System backup

From
itishree sukla
Date:
Hi all,

Can any one give me more suggestion, about this problem. Every time my os got restart, postmaster.pid is missing. After that createing postmaster.pid is also not helping to start the server.  I am using postgresql 9.2 in ubuntu, with default installation. Is there any possibility i can take the Data directory backup, and install postgresql server, then restore Data directory. Will it work to get back my databases.

Regards,
Itishree

Re: File System backup

From
Amit Langote
Date:
On Fri, Jun 21, 2013 at 7:53 PM, itishree sukla
<itishree.sukla@gmail.com> wrote:
> Hi all,
>
> Can any one give me more suggestion, about this problem. Every time my os
> got restart, postmaster.pid is missing. After that createing postmaster.pid
> is also not helping to start the server.  I am using postgresql 9.2 in
> ubuntu, with default installation. Is there any possibility i can take the
> Data directory backup, and install postgresql server, then restore Data
> directory. Will it work to get back my databases.

Can you tell what command you use to start the server and when you
issue it? Is that after OS restarts?) Did you, by any chance, use
"restart" whereas you should have used "start" assuming you are using
pg_ctl for the same?

Issuing "restart" requires that you should already have server running
(and that means postmaster.pid should be there in data directory).

--
Amit Langote


Re: File System backup

From
itishree sukla
Date:
No, as its only one postgresql is running with default installation, server got restatared with out shuting down postgresql service properly. Then i tied to start server using ./init.d command, which didn't help me either. Then i created pstmaster.pid, that also doesn't help me much.
 
Regards,
Itishree

On Fri, Jun 21, 2013 at 6:10 PM, Amit Langote <amitlangote09@gmail.com> wrote:
On Fri, Jun 21, 2013 at 7:53 PM, itishree sukla
<itishree.sukla@gmail.com> wrote:
> Hi all,
>
> Can any one give me more suggestion, about this problem. Every time my os
> got restart, postmaster.pid is missing. After that createing postmaster.pid
> is also not helping to start the server.  I am using postgresql 9.2 in
> ubuntu, with default installation. Is there any possibility i can take the
> Data directory backup, and install postgresql server, then restore Data
> directory. Will it work to get back my databases.

Can you tell what command you use to start the server and when you
issue it? Is that after OS restarts?) Did you, by any chance, use
"restart" whereas you should have used "start" assuming you are using
pg_ctl for the same?

Issuing "restart" requires that you should already have server running
(and that means postmaster.pid should be there in data directory).

--
Amit Langote

Re: File System backup

From
Adrian Klaver
Date:
On 06/21/2013 10:37 AM, itishree sukla wrote:
> No, as its only one postgresql is running with default installation,
> server got restatared with out shuting down postgresql service properly.
> Then i tied to start server using ./init.d command, which didn't help me
> either. Then i created pstmaster.pid, that also doesn't help me much.

So what messages did you see at the console when you ran the /init.d script?

> Regards,
> Itishree
>
> On Fri, Jun 21, 2013 at 6:10 PM, Amit Langote <amitlangote09@gmail.com
> <mailto:amitlangote09@gmail.com>> wrote:
>
>     On Fri, Jun 21, 2013 at 7:53 PM, itishree sukla
>     <itishree.sukla@gmail.com <mailto:itishree.sukla@gmail.com>> wrote:
>      > Hi all,
>      >
>      > Can any one give me more suggestion, about this problem. Every
>     time my os
>      > got restart, postmaster.pid is missing. After that createing
>     postmaster.pid
>      > is also not helping to start the server.  I am using postgresql
>     9.2 in
>      > ubuntu, with default installation. Is there any possibility i can
>     take the
>      > Data directory backup, and install postgresql server, then
>     restore Data
>      > directory. Will it work to get back my databases.
>
>     Can you tell what command you use to start the server and when you
>     issue it? Is that after OS restarts?) Did you, by any chance, use
>     "restart" whereas you should have used "start" assuming you are using
>     pg_ctl for the same?
>
>     Issuing "restart" requires that you should already have server running
>     (and that means postmaster.pid should be there in data directory).
>
>     --
>     Amit Langote
>
>


--
Adrian Klaver
adrian.klaver@gmail.com


Re: File System backup

From
Alban Hertroys
Date:
On Jun 21, 2013, at 12:53, itishree sukla <itishree.sukla@gmail.com> wrote:

> Hi all,
>
> Can any one give me more suggestion, about this problem. Every time my os got restart, postmaster.pid is missing.

Did you perhaps use reboot instead of shutdown -r? The former doesn't do a clean shutdown. That's how it is on *BSD at
least,I don't know about Linux but I assume it behaves the same. 

> After that createing postmaster.pid is also not helping to start the server.

Ehrm no, the opposite in fact. If the postmaster PID exists, the postmaster won't start because having multiple
postmastersrunning would get you data corruption. 

> I am using postgresql 9.2 in ubuntu, with default installation. Is there any possibility i can take the Data
directorybackup, and install postgresql server, then restore Data directory. Will it work to get back my databases. 


What do you hope to accomplish by reinstalling the software? That's most likely not where the problem is.

Check the logs to see if there are any errors when postgres tries to start up. It could be something as simple as a
libraryversion mismatch, or it could be data corruption in the database files. 

What file-system is the database on? Is it possible a journal rollback caused inconsistency in the database?

Alban Hertroys
--
If you can't see the forest for the trees,
cut the trees and you'll find there is no forest.



Re: File System backup

From
Kevin Grittner
Date:
Alban Hertroys <haramrae@gmail.com> wrote:
> itishree sukla <itishree.sukla@gmail.com> wrote:

>> Can any one give me more suggestion, about this problem. Every
>> time my os got restart, postmaster.pid is missing.

The pid file should only be present when postgres is running.  A
clean OS shutdown should stop postgres, which should result in the
pid file being deleted.

> Did you perhaps use reboot instead of shutdown -r? The former
> doesn't do a clean shutdown. That's how it is on *BSD at least, I
> don't know about Linux but I assume it behaves the same.

No, `reboot` actually calls `shutdown -r now` in the distros I've
used, including Ubuntu; unless you run it with the --force option.

> Check the logs to see if there are any errors when postgres tries
> to start up. It could be something as simple as a library version
> mismatch, or it could be data corruption in the database files.

Right, checking the log files is the thing to do.  Adding or
deleting a pid file is just about never the right thing to do.

--
Kevin Grittner
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Re: File System backup

From
itishree sukla
Date:
yes, when i tried to start, postgresql service using init.d its gave me the error  removed stale pid, postgresql failed to start. 

Regards, 
Itishree


On Sat, Jun 22, 2013 at 8:05 PM, Kevin Grittner <kgrittn@ymail.com> wrote:
Alban Hertroys <haramrae@gmail.com> wrote:
> itishree sukla <itishree.sukla@gmail.com> wrote:

>> Can any one give me more suggestion, about this problem. Every
>> time my os got restart, postmaster.pid is missing.

The pid file should only be present when postgres is running.  A
clean OS shutdown should stop postgres, which should result in the
pid file being deleted.

> Did you perhaps use reboot instead of shutdown -r? The former
> doesn't do a clean shutdown. That's how it is on *BSD at least, I
> don't know about Linux but I assume it behaves the same.

No, `reboot` actually calls `shutdown -r now` in the distros I've
used, including Ubuntu; unless you run it with the --force option.

> Check the logs to see if there are any errors when postgres tries
> to start up. It could be something as simple as a library version
> mismatch, or it could be data corruption in the database files.

Right, checking the log files is the thing to do.  Adding or
deleting a pid file is just about never the right thing to do.

--
Kevin Grittner
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: File System backup

From
hamann.w@t-online.de
Date:
>> yes, when i tried to start, postgresql service using init.d its gave me the
>> error  removed stale pid, postgresql failed to start.
>>
>> Regards,
>> Itishree
>>
>>

Hi,

have you tried to execute the startup sequence step by step?
On systems without systemd, something like

sh -x /etc/init.d/postgresql start 2>&1 | less

should reveal the entire sequence. I dont know whether systemd has something to help,
I really did a step by step run one time

Regards
Wolfgang Hamann




Re: File System backup

From
Adrian Klaver
Date:
On 06/22/2013 10:32 PM, itishree sukla wrote:
> yes, when i tried to start, postgresql service using init.d its gave me
> the error  removed stale pid, postgresql failed to start.

What is the actual error message?

>
> Regards,
> Itishree
>

--
Adrian Klaver
adrian.klaver@gmail.com


pgloader error : permission denied to set parameter "lc_messages"

From
"ascot.moss@gmail.com"
Date:
Hi,

I am trying to load CSV files into postgresql via pgloader, it returned the following error, any suggestions to fix it?

I have a line "lc_messages = C" in my pgloader.conf, would this line cause the problem?

regards


pgloader     ERROR    permission denied to set parameter "lc_messages"
pgloader     ERROR    permission denied to set parameter "lc_messages"

Traceback (most recent call last):
  File "/usr/bin/pgloader", line 779, in <module>
    ret = load_data()
  File "/usr/bin/pgloader", line 687, in load_data
    (started[s], finished[s]), summary[s])
  File "/usr/lib/pymodules/python2.7/pgloader/pgloader.py", line 142, in __init__
    self._read_conf(name, config, db)
  File "/usr/lib/pymodules/python2.7/pgloader/pgloader.py", line 328, in _read_conf
    self.columns = self.db.get_all_columns(self.table)
  File "/usr/lib/pymodules/python2.7/pgloader/db.py", line 153, in get_all_columns
    self.reset()
  File "/usr/lib/pymodules/python2.7/pgloader/db.py", line 189, in reset
    self.set_pg_options()
  File "/usr/lib/pymodules/python2.7/pgloader/db.py", line 117, in set_pg_options
    raise PGLoader_Error, e
pgloader.tools.PGLoader_Error: permission denied to set parameter "lc_messages"




Re: pgloader error : permission denied to set parameter "lc_messages"

From
Adrian Klaver
Date:
On 06/25/2013 12:05 AM, ascot.moss@gmail.com wrote:
> Hi,
>
> I am trying to load CSV files into postgresql via pgloader, it returned the following error, any suggestions to fix
it?
>
> I have a line "lc_messages = C" in my pgloader.conf, would this line cause the problem?

Assuming you are not running as a superuser, yes:

http://www.postgresql.org/docs/9.2/static/runtime-config-client.html

lc_messages (string)

...

Only superusers can change this setting, because it affects the messages
sent to the server log as well as to the client, and an improper value
might obscure the readability of the server logs.

>
> regards
>

--
Adrian Klaver
adrian.klaver@gmail.com