PostGreSQL数据库检查(3)

20151015:


在备份了数据库的备份文件(pg_dump)后,同时拷贝了LifeRay的目录出来,就重新安装了服务器。


重装之前,做了镜像,是“David-PostGreSQL-DB-Backup-Done-20151015”。


一开始实用的镜像是”run-for-days-until-5th-of-August”,还是不对。


然后使用的是”After-install-APR-correctly“镜像,成功恢复了LifeRay。http://180.76.147.172:8080/


界面如下:

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


登入BCE一看,磁盘已经100%满了。于是找到了如下两个最大的文件,也是增长最快的文件,直接删掉了。

-rw-r--r-- 1 root root 2.6G 10月 15 20:40 liferay.2015-10-15.log

-rw-r--r-- 1 root root 7.4G 10月 15 20:40 catalina.out


(不知道会不会引起问题。)估计原因是我在6点左右用手机access了这个网站。




再这种状态下,访问网站的时候,出来的都是很简化的样子,虽然还能响应,但是明显是不正常了。


干脆直接恢复一次。重新到镜像:“After-install-APR-correctly”。正常了。如上图的靠右边的部分。


[davidqi@david /]$ ps -elf | grep postgres

0 S postgres  1691     1  0  80   0 - 54081 poll_s 21:09 ?        00:00:00 /usr/bin/postgres

1 S postgres  1702  1691  0  80   0 - 44834 poll_s 21:09 ?        00:00:00 postgres: logger process   

1 S postgres  1704  1691  0  80   0 - 54110 poll_s 21:09 ?        00:00:00 postgres: writer process   

1 S postgres  1705  1691  0  80   0 - 54081 poll_s 21:09 ?        00:00:00 postgres: wal writer process   

1 S postgres  1706  1691  0  80   0 - 54114 poll_s 21:09 ?        00:00:00 postgres: autovacuum launcher process   

1 S postgres  1707  1691  0  80   0 - 44866 poll_s 21:09 ?        00:00:00 postgres: stats collector process   

1 S postgres  1968  1691  0  80   0 - 54608 sk_wai 21:10 ?        00:00:00 postgres: postgres lportal 127.0.0.1(53355) idle

1 S postgres  1969  1691  0  80   0 - 54608 sk_wai 21:10 ?        00:00:00 postgres: postgres lportal 127.0.0.1(53356) idle

1 S postgres  1970  1691  0  80   0 - 54608 sk_wai 21:10 ?        00:00:00 postgres: postgres lportal 127.0.0.1(53357) idle

1 S postgres  1971  1691  0  80   0 - 54608 sk_wai 21:10 ?        00:00:00 postgres: postgres lportal 127.0.0.1(53358) idle

1 S postgres  1972  1691  0  80   0 - 54608 sk_wai 21:10 ?        00:00:00 postgres: postgres lportal 127.0.0.1(53359) idle

1 S postgres  1973  1691  0  80   0 - 54608 sk_wai 21:10 ?        00:00:00 postgres: postgres lportal 127.0.0.1(53360) idle

1 S postgres  1974  1691  0  80   0 - 54608 sk_wai 21:10 ?        00:00:00 postgres: postgres lportal 127.0.0.1(53361) idle

1 S postgres  1975  1691  0  80   0 - 54608 sk_wai 21:10 ?        00:00:00 postgres: postgres lportal 127.0.0.1(53362) idle

1 S postgres  1976  1691  0  80   0 - 54608 sk_wai 21:10 ?        00:00:00 postgres: postgres lportal 127.0.0.1(53363) idle

1 S postgres  1977  1691  0  80   0 - 54608 sk_wai 21:10 ?        00:00:00 postgres: postgres lportal 127.0.0.1(53364) idle

1 S postgres  1989  1691  0  80   0 - 54622 sk_wai 21:10 ?        00:00:00 postgres: postgres lportal 127.0.0.1(53365) idle

1 S postgres  1990  1691  0  80   0 - 55242 sk_wai 21:10 ?        00:00:00 postgres: postgres lportal 127.0.0.1(53366) idle

1 S postgres  1991  1691  0  80   0 - 54622 sk_wai 21:10 ?        00:00:00 postgres: postgres lportal 127.0.0.1(53367) idle

1 S postgres  1992  1691  0  80   0 - 54622 sk_wai 21:10 ?        00:00:00 postgres: postgres lportal 127.0.0.1(53368) idle

1 S postgres  1993  1691  0  80   0 - 54622 sk_wai 21:10 ?        00:00:00 postgres: postgres lportal 127.0.0.1(53369) idle

1 S postgres  1994  1691  0  80   0 - 55159 sk_wai 21:10 ?        00:00:00 postgres: postgres lportal 127.0.0.1(53370) idle

1 S postgres  1995  1691  0  80   0 - 54622 sk_wai 21:10 ?        00:00:00 postgres: postgres lportal 127.0.0.1(53371) idle

1 S postgres  1996  1691  0  80   0 - 54622 sk_wai 21:10 ?        00:00:00 postgres: postgres lportal 127.0.0.1(53372) idle

1 S postgres  1997  1691  0  80   0 - 54622 sk_wai 21:10 ?        00:00:00 postgres: postgres lportal 127.0.0.1(53373) idle

1 S postgres  1998  1691  0  80   0 - 55038 sk_wai 21:10 ?        00:00:00 postgres: postgres lportal 127.0.0.1(53374) idle

0 S davidqi   2167  2132  0  80   0 - 25814 pipe_w 21:27 pts/0    00:00:00 grep postgres



重新安装了pgAdmin III(命令为:yum install pdadmin3,之前必须su到root权限下),进去后截屏如下:






现在的size是26M。比上一个的28M少2M。这是个线索?


加载了CDS后,导出数据库备份如下(之前,需要将/cds目录的用户改成davidqi, 组是postgres, 否则无法导出数据库备份文件,提示权限不够无法读写。),文件大小和有误的那个数据库基本一样大:


[root@david correct_DB]# ls -lh

总用量 3.3M

-rw-rw-r-- 1 davidqi davidqi 618K 10月 15 21:52 correct_20151015

-rw-rw-r-- 1 davidqi davidqi 1.1M 10月 15 21:53 correct_20151015_Plain

-rw-rw-r-- 1 davidqi davidqi 1.7M 10月 15 21:53 correct_20151015_Tar


拷贝了一份LifeRay文件目录到/mnt下面。




[root@david lr62]# cp -R liferay-portal-6.2-ce-ga4/ /mnt/liferay_image_correct/

[root@david lr62]# cd /

[root@david /]# cd mnt

[root@david mnt]# ls

liferay_image_correct  lost+found

[root@david mnt]# ls -lh

总用量 20K

drwxr-xr-x 3 root root 4.0K 10月 15 22:14liferay_image_correct

drwx------ 2 root root  16K 6月  30 20:03lost+found

[root@david mnt]# cd liferay_image_correct/

[root@david liferay_image_correct]# ls

liferay-portal-6.2-ce-ga4

[root@david liferay_image_correct]# df -h

Filesystem      Size  Used Avail Use% Mounted on

/dev/vda1        20G   12G  7.5G  61% /

tmpfs           939M  224K  939M   1% /dev/shm

/dev/vdb         20G  4.2G   15G  23% /mnt

/dev/vdc1       5.0G  4.2G  585M  88% /cds

[root@david liferay_image_correct]# 


然后发邮件把数据库备份文件到自己的邮箱里面。



接下来查数据库的LOG文件。有2个地方都有postgresql的文件夹,如下。那个是真正实际在用的呢?


[root@david /]# find -name postgresql.conf

./usr/local/pgsql/data/postgresql.conf

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


先看USR下面的:

[root@david /]# cd /usr/local/pgsql/data

[root@david data]# ls

base   pg_clog      pg_ident.conf pg_multixact pg_subtrans pg_twophase pg_xlog          postmaster.opts

global  pg_hba.conf pg_log        pg_stat_tmp  pg_tblspc    PG_VERSION   postgresql.conf  postmaster.pid

[root@david data]# ls -lh

总用量 80K

drwx------ 5 postgres postgres 4.0K 7月  14 12:30base

drwx------ 2 postgres postgres 4.0K 7月  14 15:26global

drwx------ 2 postgres postgres 4.0K 7月  14 12:30pg_clog

-rw------- 1 postgres postgres 3.6K 7月  14 12:30 pg_hba.conf

-rw------- 1 postgres postgres 1.6K 7月  14 12:30 pg_ident.conf

drwx------ 2 postgres postgres 4.0K 7月  14 15:19pg_log

drwx------ 4 postgres postgres 4.0K 7月  14 12:30pg_multixact

drwx------ 2 postgres postgres 4.0K 7月  14 15:26pg_stat_tmp

drwx------ 2 postgres postgres 4.0K 7月  14 12:30pg_subtrans

drwx------ 2 postgres postgres 4.0K 7月  14 12:30pg_tblspc

drwx------ 2 postgres postgres 4.0K 7月  14 12:30pg_twophase

-rw------- 1 postgres postgres    4 7月  14 12:30 PG_VERSION

drwx------ 3 postgres postgres 4.0K 7月  14 12:30pg_xlog

-rw------- 1 postgres postgres  17K 7月  14 12:30 postgresql.conf

-rw------- 1 postgres postgres   47 7月  14 15:21 postmaster.opts

-rw------- 1 postgres postgres   47 7月  14 15:21 postmaster.pid

[root@david data]# 


看上面的文件日期还是在7月份,不对。

然后看VAR下面的文件。

看来下面这个和今天的日期和时间有关系,是对的:


[root@david /]# cd /var/lib/pgsql/data

[root@david data]# ls -lh

总用量 80K

drwx------ 6 postgres postgres 4.0K 7月  14 13:44base

drwx------ 2 postgres postgres 4.0K 10月 15 21:09global

drwx------ 2 postgres postgres 4.0K 7月  14 12:14pg_clog

-rw------- 1 postgres postgres 3.6K 7月  14 12:14 pg_hba.conf

-rw------- 1 postgres postgres 1.6K 7月  14 12:14 pg_ident.conf

drwx------ 2 postgres postgres 4.0K 7月  20 00:00pg_log

drwx------ 4 postgres postgres 4.0K 7月  14 12:14pg_multixact

drwx------ 2 postgres postgres 4.0K 10月 15 22:48pg_stat_tmp

drwx------ 2 postgres postgres 4.0K 7月  14 12:14pg_subtrans

drwx------ 2 postgres postgres 4.0K 7月  14 12:14pg_tblspc

drwx------ 2 postgres postgres 4.0K 7月  14 12:14pg_twophase

-rw------- 1 postgres postgres    4 7月  14 12:14 PG_VERSION

drwx------ 3 postgres postgres 4.0K 7月  20 21:57pg_xlog

-rw------- 1 postgres postgres  17K 7月  14 12:14 postgresql.conf

-rw------- 1 postgres postgres   18 10月 15 21:09 postmaster.opts

-rw------- 1 postgres postgres   45 10月 15 21:09 postmaster.pid



接下来想干什么?比较2个数据库的备份之间有什么区别。这个明天再看。晚安!


Linux 下面比较文本文件的方法:diff 具体如下:


http://blog.csdn.net/johnsuna/archive/2009/09/01/4508332.aspx


还是喜欢用常用的工具软件,例如WORD,于是在WORD里面比较:


首先打开Word,切换到“审阅”选项卡下,找到“比较”,然后选“比较(比较文档的两个版本)”。于是有如下的比较界面:



共有56处区别。


另外,有专门的软件。Beyond Compare 4, Pro版本50美元,Standard版本30美元。如下:



Try 一 Try。明显这个好用多了。收费的就是不一样。(现在只是试用阶段)



初步查了一下数据库的区别,还没有发现大的问题。


准备增加CDS的容量。于是增加了20G,花费6.3元。之前先umount /dev/vdc1,然后在BCE管理界面中选择“扩容”。扩容后,挂载,然后去Terminal里面,fdisk /dev/vdc, 选择增加partition,记得最后要wq, 才真正操作了。 增加了/dev/vdc2。但是却无法格式化这个vdc2,提示“Could not stat /dev/vdc2 --no such file or directory”。后来,umount /dev/vdc1,在BCE管理界面中卸载CDS,再挂载CDS,就可以发现这个设备,并格式化它了。


接下来,周期性的备份数据库和LifeRay文件目录。继续研究。


接下来的文章,准备写入“PostGreSQL数据库检查(4)”.


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

关于备份,有这么一个参考文件:


http://kevdmx.blog.51cto.com/429766/547212






















  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值