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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
07-18-2014, 03:32 AM
|
#16
|
Moderator
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,313
|
Quote:
Originally Posted by Huamin
[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.
|
|
|
07-19-2014, 03:30 AM
|
#17
|
Member
Registered: May 2011
Posts: 562
Original Poster
Rep: 
|
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?
|
|
|
07-19-2014, 01:07 PM
|
#18
|
Moderator
Registered: Aug 2002
Posts: 26,512
|
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*
|
|
|
07-19-2014, 06:41 PM
|
#19
|
Member
Registered: May 2011
Posts: 562
Original Poster
Rep: 
|
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]#
|
|
|
07-19-2014, 06:51 PM
|
#20
|
Moderator
Registered: Aug 2002
Posts: 26,512
|
I forgot to make sure postgresql was started.
service postgresql start
Now repost the results from the above commands.
|
|
|
07-19-2014, 07:05 PM
|
#21
|
Member
Registered: May 2011
Posts: 562
Original Poster
Rep: 
|
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]#
|
|
|
07-20-2014, 07:42 AM
|
#22
|
Moderator
Registered: Aug 2002
Posts: 26,512
|
So it appear the server is not running so just to be sure check with the following
netstat -ntulp | grep 5432
|
|
|
07-20-2014, 08:47 AM
|
#23
|
Member
Registered: May 2011
Posts: 562
Original Poster
Rep: 
|
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]#
|
|
|
07-20-2014, 09:45 AM
|
#24
|
Moderator
Registered: Aug 2002
Posts: 26,512
|
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"
|
|
|
07-20-2014, 09:46 PM
|
#25
|
Member
Registered: May 2011
Posts: 562
Original Poster
Rep: 
|
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]#
|
|
|
07-20-2014, 09:55 PM
|
#26
|
Moderator
Registered: Aug 2002
Posts: 26,512
|
Did you change permissions to /var/lib/pgsql directory?
|
|
|
07-21-2014, 04:12 AM
|
#27
|
Member
Registered: May 2011
Posts: 562
Original Poster
Rep: 
|
No, I didn't.
|
|
|
07-21-2014, 08:54 PM
|
#28
|
Moderator
Registered: Aug 2002
Posts: 26,512
|
It appears that the server was working as of last Tues but not since so what changed?
|
|
|
07-21-2014, 10:11 PM
|
#29
|
Member
Registered: May 2011
Posts: 562
Original Poster
Rep: 
|
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]#
|
|
|
07-21-2014, 10:20 PM
|
#30
|
Moderator
Registered: Aug 2002
Posts: 26,512
|
At least we now have a log file started.
What happens when you try running psql?
|
|
|
All times are GMT -5. The time now is 02:26 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|