LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-18-2014, 03:32 AM   #16
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,313
Blog Entries: 24

Rep: Reputation: 4267Reputation: 4267Reputation: 4267Reputation: 4267Reputation: 4267Reputation: 4267Reputation: 4267Reputation: 4267Reputation: 4267Reputation: 4267Reputation: 4267

Quote:
Originally Posted by Huamin View Post
[root@CentOS65x64 data]# service postgresql start
Starting postgresql service: [ OK ]
[root@CentOS65x64 data]# ls -lt /var/lib/pgsql/data/pg_log*
total 16
-rw-------. 1 postgres postgres 188 Jul 15 12:00 postgresql-Tue.log
-rw-------. 1 postgres postgres 321 Jul 14 11:58 postgresql-Mon.log
-rw-------. 1 postgres postgres 642 Jul 12 12:36 postgresql-Sat.log
-rw-------. 1 postgres postgres 963 Jul 11 23:16 postgresql-Fri.log
[root@CentOS65x64 data]# tail -n20 /var/lib/pgsql/data/pg_log/postgresql-Tue.log
LOG: database system was shut down at 2014-07-14 11:58:17 HKT
LOG: database system is ready to accept connections
LOG: autovacuum launcher started
LOG: received smart shutdown request
That is not at all clear unless your postgres server has been running since Tuesday and the log has not been rotated (again, I am not sure how your system does that).

Lets try a shutdown and restart of the postgres server and see if that generates a visibly current change in the log.

Also, it would be helpful if you could wrap the pasted messages in CODE tags (The # icon at top of advanced post mode).

UPDATE: ** I must also logout again shortly, if before you reply then I will be back later today.

UPDATE2: ** Let's add a clear timestamp to all log entries.
Edit /var/lib/pgsql/data/postgresql.conf, find "log_line_prefix" and change/add "%t" to it.

Last edited by astrogeek; 07-18-2014 at 03:40 AM.
 
Old 07-19-2014, 03:30 AM   #17
Huamin
Member
 
Registered: May 2011
Posts: 562

Original Poster
Rep: Reputation: 12
Many thanks.

Here is what I can see with log_line_prefix.

#log_line_prefix = '' # special values:
# %u = user name
# %d = database name
# %r = remote host and port
# %h = remote host
# %p = process ID
# %t = timestamp without milliseconds
# %m = timestamp with milliseconds
# %i = command tag
# %c = session ID
# %l = session line number
# %s = session start timestamp
# %v = virtual transaction ID
# %x = transaction ID (0 if none)
# %q = stop here in non-session
# processes
# %% = '%'
# e.g. '<%u%%%d> '

what to change above?
 
Old 07-19-2014, 01:07 PM   #18
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,512

Rep: Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223
Did you install postgresql from source or from the CentOS repositories or when the system was first installed?

It appears that the service is running but something isn't configured correctly if psql isn't working. So we are missing some information.

It looks like your trying to run psql from the same system as the service is running from but we need to confirm.

Post the output from these commands (as root).
ps ax | grep postmaster
netstat -nap | grep postmaster
ls -la /tmp/.*PGSQL*
 
Old 07-19-2014, 06:41 PM   #19
Huamin
Member
 
Registered: May 2011
Posts: 562

Original Poster
Rep: Reputation: 12
Thanks. I did use "yum install ..." to set up that, like

yum install postgresql-server

Here are what I've got

[root@CentOS65x64 huamin]# ps ax | grep postmaster
2888 pts/0 S+ 0:00 grep postmaster
[root@CentOS65x64 huamin]# netstat -nap | grep postmaster
[root@CentOS65x64 huamin]# ls -la /tmp/.*PGSQL*
ls: cannot access /tmp/.*PGSQL*: No such file or directory
[root@CentOS65x64 huamin]#
 
Old 07-19-2014, 06:51 PM   #20
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,512

Rep: Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223
I forgot to make sure postgresql was started.
service postgresql start

Now repost the results from the above commands.
 
Old 07-19-2014, 07:05 PM   #21
Huamin
Member
 
Registered: May 2011
Posts: 562

Original Poster
Rep: Reputation: 12
Many thanks.

I've got these

[root@CentOS65x64 huamin]# service postgresql start
Starting postgresql service: [ OK ]
[root@CentOS65x64 huamin]# ps ax | grep postmaster
2862 pts/0 S+ 0:00 grep postmaster
[root@CentOS65x64 huamin]# netstat -nap | grep postmaster
[root@CentOS65x64 huamin]# ls -la /tmp/.*PGSQL*
ls: cannot access /tmp/.*PGSQL*: No such file or directory
[root@CentOS65x64 huamin]#
 
Old 07-20-2014, 07:42 AM   #22
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,512

Rep: Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223
So it appear the server is not running so just to be sure check with the following
netstat -ntulp | grep 5432
 
Old 07-20-2014, 08:47 AM   #23
Huamin
Member
 
Registered: May 2011
Posts: 562

Original Poster
Rep: Reputation: 12
Sorry, I still get these

[root@CentOS65x64 huamin]# netstat -ntulp | grep 5432
[root@CentOS65x64 huamin]# service postgresql start
Starting postgresql service: [ OK ]
[root@CentOS65x64 huamin]# ps ax | grep postmaster
2919 pts/0 S+ 0:00 grep postmaster
[root@CentOS65x64 huamin]# netstat -nap | grep postmaster
[root@CentOS65x64 huamin]# ls -la /tmp/.*PGSQL*
ls: cannot access /tmp/.*PGSQL*: No such file or directory
[root@CentOS65x64 huamin]#
 
Old 07-20-2014, 09:45 AM   #24
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,512

Rep: Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223
Is Selinux enabled?

Since it appears that the server was running ok as of last Tues, have you made any changes since then? Since the database was initialised do you know if any other database user was created or if any configuration changes were made?

You can see what happens if you start it manually. If all is normal you should not see any output. To kill the server use ctrl-c

runuser -l postgres -c "postgres -D /var/lib/pgsql/data"
 
Old 07-20-2014, 09:46 PM   #25
Huamin
Member
 
Registered: May 2011
Posts: 562

Original Poster
Rep: Reputation: 12
Thanks. Can you please advise to this?

[root@CentOS65x64 huamin]# service postgresql start
Starting postgresql service: [ OK ]
[root@CentOS65x64 huamin]# runuser -l postgres -c "postgres -D /var/lib/pgsql/data"
runuser: warning: cannot change directory to /var/lib/pgsql: Permission denied
-bash: /var/lib/pgsql/.bash_profile: Permission denied
postgres cannot access the server configuration file "/var/lib/pgsql/data/postgresql.conf": Permission denied
[root@CentOS65x64 huamin]#
 
Old 07-20-2014, 09:55 PM   #26
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,512

Rep: Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223
Did you change permissions to /var/lib/pgsql directory?
 
Old 07-21-2014, 04:12 AM   #27
Huamin
Member
 
Registered: May 2011
Posts: 562

Original Poster
Rep: Reputation: 12
No, I didn't.
 
Old 07-21-2014, 08:54 PM   #28
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,512

Rep: Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223
It appears that the server was working as of last Tues but not since so what changed?
 
Old 07-21-2014, 10:11 PM   #29
Huamin
Member
 
Registered: May 2011
Posts: 562

Original Poster
Rep: Reputation: 12
I do take the backup of the whole OS and have got this

[root@CentOS65x64 huamin]# service postgresql start
Starting postgresql service: [ OK ]
[root@CentOS65x64 huamin]# ls -lt /var/lib/pgsql/data/pg_log*
total 12
-rw-------. 1 postgres postgres 150 Jul 22 10:01 postgresql-Tue.log
-rw-------. 1 postgres postgres 963 Jul 12 17:05 postgresql-Sat.log
-rw-------. 1 postgres postgres 963 Jul 11 23:16 postgresql-Fri.log
[root@CentOS65x64 huamin]# tail -n20 /var/lib/pgsql/data/pg_log/postgresql-Tue.log
LOG: database system was shut down at 2014-07-12 17:05:50 HKT
LOG: database system is ready to accept connections
LOG: autovacuum launcher started
[root@CentOS65x64 huamin]#
 
Old 07-21-2014, 10:20 PM   #30
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,512

Rep: Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223Reputation: 6223
At least we now have a log file started.

What happens when you try running psql?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Do I have a path problem, an Apache2 problem or a Javascript problem or any other pro rblampain Linux - Networking 0 12-29-2010 04:50 AM
Dual Boot issue (Mint 9 and Vista) problem - on Day 4 of problem... restevns Linux - Newbie 3 10-21-2010 12:26 AM
Sound Card problem(every time i install linux i have diffirent hardware problem) jacka1l Linux - Newbie 7 08-11-2005 07:10 AM
Lan configuration problem - NFS boot problem - RX&TX packets errors 242VDM242 Linux - Networking 4 11-25-2004 02:35 PM
perl problem? apache problem? cgi problem? WorldBuilder Linux - Software 1 09-17-2003 08:45 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration