PostGreSQL数据库的检查

绕着走是常见的解决问题的方法。可是,不见得总是有用。而且,有的事情,早晚还会绕回来,逃不掉的。


现在就绕回来,解决PostGreSQL数据库的问题。同时,要将实际的数据库的数据部分,设置在非系统盘的专门的一个数据盘上,便于扩展和备份。或者直接采用RDS。


以下就是问题的表现。在liferay系统盘启动后出现如下提示:


HTTP Status 500 - java.lang.ArrayIndexOutOfBoundsException: 0


type Exception report

messagejava.lang.ArrayIndexOutOfBoundsException: 0

descriptionThe server encountered an internal error that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: java.lang.ArrayIndexOutOfBoundsException: 0
	com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
	com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:119)

root cause

java.lang.ArrayIndexOutOfBoundsException: 0
	com.liferay.portal.util.PortalInstances._getDefaultCompanyId(PortalInstances.java:344)
	com.liferay.portal.util.PortalInstances.getDefaultCompanyId(PortalInstances.java:83)
	com.liferay.portal.util.PortalImpl.getDefaultCompanyId(PortalImpl.java:1909)
	com.liferay.portal.util.PortalUtil.getDefaultCompanyId(PortalUtil.java:522)
	com.liferay.portal.servlet.filters.validhostname.ValidHostNameFilter.doFilterTry(ValidHostNameFilter.java:38)
	com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:183)
	com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
	com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:119)

noteThe full stack trace of the root cause is available in the Apache Tomcat/7.0.42 logs.


Apache Tomcat/7.0.42

下面是分析和解决的过程:


首先从LifeRay的论坛中查到了类似的问题,然后有版主答复如下:


David H Nebinger

Community Moderator

等级: Liferay Legend

帖子: 9810

加入日期: 2006年9月1日

最近的帖子

No other special instructions, but I'd recommend purging your DB/indexes and starting over. Looks like it might have been partially created/populated during a previous run and that may be blocking you from proceeding. ”


其中: 

purge [pɜ:dʒ] [pɜ:rdʒ]
vt.肃清; 清除,(使)净化; (使) 通便;
n.净化; 整肃; <医>泻药;

全部释义>>

[例句] And purge all emotion?
并且 去除掉所有的情感?

更多例句>>

复数:purges  过去式:purged  现在分词:purging  过去分词:purged 第三人称单数:purges


我的直觉也是这个。LifeRay启动很慢,过快的执行shutdown.sh和Startup.sh会导致问题。另外,CE版本的LifeRay有不少的Bug。

至此,先将实例变更为一个正常的实例,然后研究所有的Log和Warning,同时了解PostGreSQL的purge如何做,以及如何把实际数据库放到单独的CDS云盘上。然后再回头来研究如何解决这个问题。

一天能解决一个Warning就好。

==========

Linux下文件的查找: find -name filename

/var/lib/pgsql/data/postgresql.conf


然后在/pgsql/data/global/pg_auth文件中查到了用户角色:postgres。


然后在/pgsql/data/global/pg_database文件中查到了LifeRay所用的数据库:lportal。


然后就进入数据库对话psql里面查看。如下: psql -U postgres -d lportal


[root@david global]# psql -U postgres -d lportal

psql (8.4.20)

输入 "help" 来获取帮助信息.


lportal=# 


然后用了vacuumdb,然后查看进程。

[root@david global]# vacuumdb -U postgres -d lportal

[root@david global]# ps -ef | grep postgres

postgres  1612     1  0 Oct10 ?        00:00:01 /usr/bin/postgres

postgres  1674  1612  0 Oct10 ?        00:00:02 postgres: logger process   

postgres  1677  1612  0 Oct10 ?        00:00:16 postgres: writer process   

postgres  1678  1612  0 Oct10 ?        00:00:12 postgres: wal writer process   

postgres  1679  1612  0 Oct10 ?        00:00:03 postgres: autovacuum launcher process   

postgres  1680  1612  0 Oct10 ?        00:00:03 postgres: stats collector process   

postgres  6796  1612  0 11:09 ?        00:00:00 postgres: postgres lportal 127.0.0.1(60087) idle

postgres  6797  1612  0 11:09 ?        00:00:00 postgres: postgres lportal 127.0.0.1(60088) idle

postgres  6798  1612  0 11:09 ?        00:00:00 postgres: postgres lportal 127.0.0.1(60089) idle

postgres  6799  1612  0 11:09 ?        00:00:00 postgres: postgres lportal 127.0.0.1(60090) idle

postgres  6800  1612  0 11:09 ?        00:00:00 postgres: postgres lportal 127.0.0.1(60091) idle

postgres  6801  1612  0 11:09 ?        00:00:00 postgres: postgres lportal 127.0.0.1(60092) idle

postgres  6802  1612  0 11:09 ?        00:00:00 postgres: postgres lportal 127.0.0.1(60093) idle

postgres  6803  1612  0 11:09 ?        00:00:00 postgres: postgres lportal 127.0.0.1(60094) idle

postgres  6804  1612  0 11:09 ?        00:00:00 postgres: postgres lportal 127.0.0.1(60095) idle

postgres  6805  1612  0 11:09 ?        00:00:00 postgres: postgres lportal 127.0.0.1(60096) idle

postgres  6808  1612  0 11:10 ?        00:00:00 postgres: postgres lportal 127.0.0.1(60097) idle

postgres  6809  1612  0 11:10 ?        00:00:00 postgres: postgres lportal 127.0.0.1(60098) idle

postgres  6810  1612  0 11:10 ?        00:00:00 postgres: postgres lportal 127.0.0.1(60099) idle

postgres  6811  1612  0 11:10 ?        00:00:00 postgres: postgres lportal 127.0.0.1(60100) idle

postgres  6812  1612  0 11:10 ?        00:00:00 postgres: postgres lportal 127.0.0.1(60101) idle

postgres  6813  1612  0 11:10 ?        00:00:00 postgres: postgres lportal 127.0.0.1(60102) idle

postgres  6814  1612  0 11:10 ?        00:00:00 postgres: postgres lportal 127.0.0.1(60103) idle

postgres  6815  1612  0 11:10 ?        00:00:00 postgres: postgres lportal 127.0.0.1(60104) idle

postgres  6816  1612  0 11:10 ?        00:00:00 postgres: postgres lportal 127.0.0.1(60105) idle

postgres  6817  1612  0 11:10 ?        00:00:00 postgres: postgres lportal 127.0.0.1(60106) idle

root      7119  6924  0 12:22 pts/0    00:00:00 grep postgres

[root@david global]# 


但是这说明连接过多了吗?


不管怎样,改了最大连接数,100改成了500:



#------------------------------------------------------------------------------

# CONNECTIONS AND AUTHENTICATION

#------------------------------------------------------------------------------


# - Connection Settings -


#listen_addresses = 'localhost'         # what IP address(es) to listen on;

                                        # comma-separated list of addresses;

                                        # defaults to 'localhost', '*' = all

                                        # (change requires restart)

#port = 5432                            # (change requires restart)

max_connections =500                  # (change requires restart)

# Note:  Increasing max_connections costs ~400 bytes of shared memory per

# connection slot, plus lock space (see max_locks_per_transaction).

#superuser_reserved_connections = 3     # (change requires restart)

#unix_socket_directory = ''             # (change requires restart)

#unix_socket_group = ''                 # (change requires restart)

#unix_socket_permissions = 0777         # begin with 0 to use octal notation

                                        # (change requires restart)

#bonjour_name = ''                      # defaults to the computer name

                                        # (change requires restart)



============================

尝试停掉数据库,再重启,来看看是否解决问题,但是输入停数据库的指令后,仍然有进程在那里。怎么回事儿呢?


停数据库,并查进程:


[root@david pgsql]# psql -U postgres -d lportal

psql (8.4.20)

输入 "help" 来获取帮助信息.


lportal=# pg_ctl stop

lportal-# pg_ctl start

lportal-# pg_ctl restart

lportal-# /q

lportal-# \q

[root@david pgsql]# netstat -npl | grep postgres

tcp        0      0 127.0.0.1:5432              0.0.0.0:*                   LISTEN      1614/postgres       

tcp        0      0 ::1:5432                    :::*                        LISTEN      1614/postgres       

unix  2      [ ACC ]     STREAM     LISTENING     10493  1614/postgres       /tmp/.s.PGSQL.5432

[root@david pgsql]# ps aux | grep postgres

postgres  1614  0.0  0.5 226268 11312 ?        S    12:37   0:00 /usr/bin/postgres

postgres  1676  0.0  0.0 179336  1500 ?        Ss   12:37   0:00 postgres: logger process   

postgres  1678  0.0  0.1 226384  2284 ?        Ss   12:37   0:02 postgres: writer process   

postgres  1679  0.0  0.0 226268  1680 ?        Ss   12:37   0:02 postgres: wal writer process   

postgres  1680  0.0  0.1 226688  2152 ?        Ss   12:37   0:00 postgres: autovacuum launcher process   

postgres  1681  0.0  0.0 179740  1864 ?        Ss   12:37   0:00 postgres: stats collector process   

postgres  2716  0.0  0.3 228600  6440 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55188) idle

postgres  2717  0.0  0.3 228600  6452 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55189) idle

postgres  2718  0.0  0.3 228600  6460 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55190) idle

postgres  2719  0.0  0.3 228600  6452 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55191) idle

postgres  2720  0.0  0.3 228600  6472 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55192) idle

postgres  2721  0.0  0.3 228600  6448 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55193) idle

postgres  2722  0.0  0.3 228600  6464 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55194) idle

postgres  2723  0.0  0.3 228600  6436 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55195) idle

postgres  2724  0.0  0.3 228600  6452 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55196) idle

postgres  2725  0.0  0.3 228600  6444 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55197) idle

postgres  2727  0.0  0.3 228600  6464 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55198) idle

postgres  2728  0.0  0.3 228600  6520 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55199) idle

postgres  2729  0.0  0.3 228600  6448 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55200) idle

postgres  2730  0.0  0.3 228600  6464 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55201) idle

postgres  2731  0.0  0.3 228600  6464 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55202) idle

postgres  2732  0.0  0.3 228600  6480 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55203) idle

postgres  2733  0.0  0.3 228600  6456 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55204) idle

postgres  2734  0.0  0.3 228600  6472 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55205) idle

postgres  2735  0.0  0.3 228600  6464 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55206) idle

postgres  2736  0.0  0.3 228600  6444 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55207) idle

root      2886  0.0  0.0 103256   888 pts/0    S+   16:54   0:00 grep postgres

[root@david pgsql]# psql -U postgres -d lportal

psql (8.4.20)

输入 "help" 来获取帮助信息.


lportal=# pg_ctl stop

lportal-# \q

[root@david pgsql]# ps aux | grep postgres

postgres  1614  0.0  0.5 226268 11312 ?        S    12:37   0:00 /usr/bin/postgres

postgres  1676  0.0  0.0 179336  1500 ?        Ss   12:37   0:00 postgres: logger process   

postgres  1678  0.0  0.1 226384  2284 ?        Ss   12:37   0:02 postgres: writer process   

postgres  1679  0.0  0.0 226268  1680 ?        Ss   12:37   0:02 postgres: wal writer process   

postgres  1680  0.0  0.1 226688  2152 ?        Ss   12:37   0:00 postgres: autovacuum launcher process   

postgres  1681  0.0  0.0 179740  1864 ?        Ss   12:37   0:00 postgres: stats collector process   

postgres  2716  0.0  0.3 228600  6440 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55188) idle

postgres  2717  0.0  0.3 228600  6452 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55189) idle

postgres  2718  0.0  0.3 228600  6460 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55190) idle

postgres  2719  0.0  0.3 228600  6452 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55191) idle

postgres  2720  0.0  0.3 228600  6472 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55192) idle

postgres  2721  0.0  0.3 228600  6448 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55193) idle

postgres  2722  0.0  0.3 228600  6464 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55194) idle

postgres  2723  0.0  0.3 228600  6436 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55195) idle

postgres  2724  0.0  0.3 228600  6452 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55196) idle

postgres  2725  0.0  0.3 228600  6444 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55197) idle

postgres  2727  0.0  0.3 228600  6464 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55198) idle

postgres  2728  0.0  0.3 228600  6520 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55199) idle

postgres  2729  0.0  0.3 228600  6448 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55200) idle

postgres  2730  0.0  0.3 228600  6464 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55201) idle

postgres  2731  0.0  0.3 228600  6464 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55202) idle

postgres  2732  0.0  0.3 228600  6480 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55203) idle

postgres  2733  0.0  0.3 228600  6456 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55204) idle

postgres  2734  0.0  0.3 228600  6472 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55205) idle

postgres  2735  0.0  0.3 228600  6464 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55206) idle

postgres  2736  0.0  0.3 228600  6444 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55207) idle

root      2891  0.0  0.0 103256   888 pts/0    S+   16:55   0:00 grep postgres

[root@david pgsql]# ps aux | grep postgres

postgres  1614  0.0  0.5 226268 11312 ?        S    12:37   0:00 /usr/bin/postgres

postgres  1676  0.0  0.0 179336  1500 ?        Ss   12:37   0:00 postgres: logger process   

postgres  1678  0.0  0.1 226384  2284 ?        Ss   12:37   0:02 postgres: writer process   

postgres  1679  0.0  0.0 226268  1680 ?        Ss   12:37   0:02 postgres: wal writer process   

postgres  1680  0.0  0.1 226688  2152 ?        Ss   12:37   0:00 postgres: autovacuum launcher process   

postgres  1681  0.0  0.0 179740  1864 ?        Ss   12:37   0:00 postgres: stats collector process   

postgres  2716  0.0  0.3 228600  6444 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55188) idle

postgres  2717  0.0  0.3 228600  6452 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55189) idle

postgres  2718  0.0  0.3 228600  6464 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55190) idle

postgres  2719  0.0  0.3 228600  6452 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55191) idle

postgres  2720  0.0  0.3 228600  6472 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55192) idle

postgres  2721  0.0  0.3 228600  6460 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55193) idle

postgres  2722  0.0  0.3 228600  6464 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55194) idle

postgres  2723  0.0  0.3 228600  6436 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55195) idle

postgres  2724  0.0  0.3 228600  6456 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55196) idle

postgres  2725  0.0  0.3 228600  6444 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55197) idle

postgres  2727  0.0  0.3 228600  6464 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55198) idle

postgres  2728  0.0  0.3 228600  6524 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55199) idle

postgres  2729  0.0  0.3 228600  6448 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55200) idle

postgres  2730  0.0  0.3 228600  6464 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55201) idle

postgres  2731  0.0  0.3 228600  6464 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55202) idle

postgres  2732  0.0  0.3 228600  6480 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55203) idle

postgres  2733  0.0  0.3 228600  6460 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55204) idle

postgres  2734  0.0  0.3 228600  6472 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55205) idle

postgres  2735  0.0  0.3 228600  6464 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55206) idle

postgres  2736  0.0  0.3 228600  6448 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55207) idle

root      2897  0.0  0.0 103256   888 pts/0    S+   16:56   0:00 grep postgres

[root@david pgsql]# psql -U postgres 

psql (8.4.20)

输入 "help" 来获取帮助信息.


postgres=# pg_ctl stop

postgres-# \q

[root@david pgsql]# ps aux | grep postgres

postgres  1614  0.0  0.5 226268 11312 ?        S    12:37   0:00 /usr/bin/postgres

postgres  1676  0.0  0.0 179336  1500 ?        Ss   12:37   0:00 postgres: logger process   

postgres  1678  0.0  0.1 226384  3276 ?        Ss   12:37   0:02 postgres: writer process   

postgres  1679  0.0  0.0 226268  1680 ?        Ss   12:37   0:02 postgres: wal writer process   

postgres  1680  0.0  0.1 226688  2152 ?        Ss   12:37   0:00 postgres: autovacuum launcher process   

postgres  1681  0.0  0.0 179740  1864 ?        Ss   12:37   0:00 postgres: stats collector process   

postgres  2716  0.0  0.3 228600  6456 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55188) idle

postgres  2717  0.0  0.3 228600  6456 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55189) idle

postgres  2718  0.0  0.3 228600  6464 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55190) idle

postgres  2719  0.0  0.3 228600  6456 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55191) idle

postgres  2720  0.0  0.3 228600  6480 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55192) idle

postgres  2721  0.0  0.3 228600  6468 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55193) idle

postgres  2722  0.0  0.3 228600  6468 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55194) idle

postgres  2723  0.0  0.3 228600  6440 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55195) idle

postgres  2724  0.0  0.3 228600  6456 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55196) idle

postgres  2725  0.0  0.3 228600  6448 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55197) idle

postgres  2727  0.0  0.3 228600  6472 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55198) idle

postgres  2728  0.0  0.3 228600  6528 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55199) idle

postgres  2729  0.0  0.3 228600  6452 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55200) idle

postgres  2730  0.0  0.3 228600  6468 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55201) idle

postgres  2731  0.0  0.3 228600  6468 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55202) idle

postgres  2732  0.0  0.3 228600  6480 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55203) idle

postgres  2733  0.0  0.3 228600  6460 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55204) idle

postgres  2734  0.0  0.3 228600  6480 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55205) idle

postgres  2735  0.0  0.3 228600  6468 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55206) idle

postgres  2736  0.0  0.3 228600  6452 ?        Ss   16:23   0:00 postgres: postgres lportal 127.0.0.1(55207) idle

root      2908  0.0  0.0 103256   888 pts/0    S+   16:59   0:00 grep postgres


==================

用su davidqi切换到davidqi用户下,可以正常操作pg_ctl指令了。说明,可能停数据库的指令没有真正执行。因为指令不对,另外,可能在等进程结束后才能真正停止。


至此,觉得还是先在图形化的postgreSQL的管理端上查看更好。于是下载安装了pgadmin3.通过“

yum install pgadmin3

”来安装了。下面用VNC进入图形界面继续研究。
进入BCE的实例的VNC,后在Centos的Application菜单中自动发现了pgAdmin III的一项。点击进入后,要求数据库的名称密码等。名称填入postgres,密码是记在麦库记事中的5432 port后面的那项(第二次这么做的时候,发现不用输密码就可以),标题是PostGre SQL。


然后就进去了。为什么lportal上面有个红叉呢?但是点一下就没有了。





现在休息眼睛。过一会再继续。

==========
重新进入Centos的图形界面时,提示“ yum-complete-transaction.”。这个另外建了一个博文。 See another blog.


=========
通过pgAdmin III进入lportal数据库查看,并看了看companyid这个表。一切看起来正常。




下面还是想看看数据库错误的log数据。重启数据库,看看是否有改进。但是通过pgAdmin III看来是不能去重启数据库的。

============
继续研究:



lportal还是有个红叉。这是个问题。



尝试关闭数据库服务,结果如下。看来还得先设置好PGDATA环境变量。




PDDATA 好像已经设置好了。再.bash_profile里面已经有了。但是不管用。


用root执行数据库停止不可以。

[root@david pgsql]# pg_ctl stop

pg_ctl: 无法以 root 用户运行

请以服务器进程所属用户 (非特权用户) 登录 (或使用 "su")


用davidqi执行数据库停止说没有权限。


[root@david pgsql]# su davidqi pg_ctl stop

bash: pg_ctl: 权限不够


查看了postgres用户有权限,如下:(可是忘了postgres用户的密码!!!)


drwx------  24 postgres postgres 4.0K 10月 12 21:11pgsql


但是以postgres用户(通过root下的su postgres)去执行的时候,提示:


[root@david lib]# su postgres pg_ctl stop

/usr/bin/pg_ctl: /usr/bin/pg_ctl: cannot execute binary file


总体来看,安装和运行postgresql数据库的linux用户混乱,缺乏规划和记录,这是个重要问题。阿东提示的“为什么以root来运行数据库?”应该和这个有关。


20151012,今天就到这里吧。晚安!


==========================


停掉postgresql然后重启:



看来正常停会等待所有过程停掉,不会成功,需要快速停:

su - postgres -c 'pg_ctl stop -m fast'





然后重启

su - postgres -c 'pg_ctl start -l logfile'

之后的进程列表:



重启数据库后,重启Liferay,还是有问题。先将Tomcat停了,然后看数据库,直接停还是停不了:



强制停了重启,没有启动LifeRay的时候,通过pgAdmin直接看,还是有个红叉在lportal数据库上。我觉得这是个核心问题。








================================================================================

关于postgresql太多数据库连接的处理,网上文章:http://www.2cto.com/database/201306/220727.html


关于"

[root@david bin]# pg_ctl stop

pg_ctl: 无法以 root 用户运行

请以服务器进程所属用户 (非特权用户) 登录 (或使用 "su")


[root@david bin]# su davidqi pg_ctl stop

pg_ctl: pg_ctl: cannot execute binary file

[root@david bin]# su davidqi pg_ctl

pg_ctl: pg_ctl: cannot execute binary file


",网上文章:

http://blog.chinaunix.net/uid-23842323-id-2656599.html


关于postgresql数据库基础操作的网上文章:

http://www.sijitao.net/1454.html






PostgreSQL是以加州大学伯克利分校计算机系开发的POSTGRES,现在已经更名为PostgreSQL. PostgreSQL支持大部分SQL标准并且提供了许多其它现代特性:复杂查询、外键、触发器、视图、事务完整性等。 PostgreSQL 是一个免费的对象-关系数据库服务器(数据库管理系统),它在灵活的 BSD-风格许可证下发行。它提供了相对其他开放源代码数据库系统(比如 MySQL 和 Firebird),和专有系统(比如 Oracle、Sybase、IBM 的 DB2 和 Microsoft SQL Server)之外的另一种选择。 事实上, PostgreSQL 的特性覆盖了 SQL-2/SQL-92 和 SQL-3/SQL-99,首先,它包括了可以说是目前世界上最丰富的数据类型的支持,其中有些数据类型可以说连商业数据库都不具备, 比如 IP 类型和几何类型等;其次,PostgreSQL 是全功能的自由软件数据库,很长时间以来,PostgreSQL 是唯一支持事务、子查询、多版本并行控制系统(MVCC)、数据完整性检查等特性的唯一的一种自由软件的数据库管理系统。 Inprise 的 InterBase 以及SAP等厂商将其原先专有软件开放为自由软件之后才打破了这个唯一。最后,PostgreSQL拥有一支非常活跃的开发队伍,而且在许多黑客的努力下,PostgreSQL 的质量日益提高。从技术角度来讲,PostgreSQL 采用的是比较经典的C/S(client/server)结构,也就是一个客户端对应一个服务器端守护进程的模式,这个守护进程分析客户端来的查询请求,生成规划树,进行数据检索并最终把结果格式化输出后返回给客户端。为了便于客户端的程序的编写,由数据库服务器提供了统一的客户端 C 接口。而不同的客户端接口都是源自这个 C 接口,比如ODBC,JDBC,Python,Perl,Tcl,C/C++,ESQL等, 同时也要指出的是,PostgreSQL 对接口的支持也是非常丰富的,几乎支持所有类型的数据库客户端接口。这一点也可以说是 PostgreSQL 一大优点。 本课程作为PostgreSQL数据库管理之三,主要讲解以下内容:1.     PostgreSQL约束讲解和剖析2.     PostgreSQL数据类型3.     PostgreSQL的结构管理4.     PostgreSQL条件表达式和操作5.     PostgreSQL使用小技巧
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值