最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501
当前位置: 首页 - 科技 - 知识百科 - 正文

Postgres文件所有者更改造成异常处理

来源:懂视网 责编:小采 时间:2020-11-09 16:07:42
文档

Postgres文件所有者更改造成异常处理

Postgres文件所有者更改造成异常处理:Postgres文件所有者更改造成异常处理 本地一台测试机,被同事一不小将根目录下所有文件的属主都改成了root( chown -R root:root /,这是个坑爹而且危险的操作),postgres数据库是用其他用户安装的,上面还有其他应用,这里简单说下postgres数据库的恢
推荐度:
导读Postgres文件所有者更改造成异常处理:Postgres文件所有者更改造成异常处理 本地一台测试机,被同事一不小将根目录下所有文件的属主都改成了root( chown -R root:root /,这是个坑爹而且危险的操作),postgres数据库是用其他用户安装的,上面还有其他应用,这里简单说下postgres数据库的恢

Postgres文件所有者更改造成异常处理 本地一台测试机,被同事一不小将根目录下所有文件的属主都改成了root( chown -R root:root /,这是个坑爹而且危险的操作),postgres数据库是用其他用户安装的,上面还有其他应用,这里简单说下postgres数据库的恢复过程

Postgres文件所有者更改造成异常处理

本地一台测试机,被同事一不小将根目录下所有文件的属主都改成了root( chown -R root:root /,这是个坑爹而且危险的操作),postgres数据库是用其他用户安装的,上面还有其他应用,这里简单说下postgres数据库的恢复过程。

1.环境

OS:CentOS 6.2

DB:postgres 9.2.4

2.异常现象

a.数据库进程没了

b.日志情况

[postgresql@localhost pg_log]$ tail -f postgresql-2013-05-06_000000.csv

2013-05-06 17:11:21.923 CST,"test","testdb",664,"172.25.10.1:13906",51876c10.298,3,"idle",2013-05-06 16:38:40 CST,37/0,0,WARNING,57P02,"terminating connection because of crash of another server process","The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.","In a moment you should be able to reconnect to the database and repeat your command.",,,,,,,""

2013-05-06 17:11:21.921 CST,"test","testdb",2633,"172.25.10.88:45681",5187730e.a49,3,"idle",2013-05-06 17:08:30 CST,14/0,0,WARNING,57P02,"terminating connection because of crash of another server process","The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.","In a moment you should be able to reconnect to the database and repeat your command.",,,,,,,""

.....

2013-05-06 17:11:21.926 CST,,,24842,,5162b7b7.610a,8,,2013-04-08 20:27:35 CST,,0,LOG,00000,"all server processes terminated; reinitializing",,,,,,,,,""

2013-05-06 17:11:21.955 CST,,,24842,,5162b7b7.610a,9,,2013-04-08 20:27:35 CST,,0,LOG,42501,"could not open file ""postmaster.pid"": Permission denied",,,,,,,,,""

2013-05-06 17:11:22.011 CST,,,24842,,5162b7b7.610a,10,,2013-04-08 20:27:35 CST,,0,PANIC,42501,"could not open control file ""global/pg_control"": Permission denied",,,,,,,,,""

3.恢复过程

a.首先改回用户权限

[root@localhost ~]#chown -R postgresql:postgresql /var/postgres

[root@localhost ~]#chown -R postgresql:postgresql /data/pgdata

b.重新启动

[postgresql@localhost pg_log]$ pg_start

server starting

[postgresql@localhost pg_log]$ FATAL: could not open lock file "/tmp/.s.PGSQL.lock": Permission denied

could not open control file ""global/pg_control"": Permission denied

重新启动的时候发现数据库仍然不能起来,但是这里给出了一个信息,tmp下socket文件权限不够

返回到root用户下授权,再启动

[root@localhost home]#cd /tmp

[root@localhost tmp]#ls -a .s.PGSQL*

.s.PGSQL.5432 .s.PGSQL.5432.lock

[root@localhost tmp]#chown postgresql:postgresql ./.s.PGSQL*

[root@localhost tmp]#su - postgresql

[postgresql@localhost ~]$ pg_start

--还是报上面的错误,因为socket文件是本地通信文件,故先删除再启动DB,平时没事不要手贱去删

[root@localhost tmp]#rm -f ./.s.PGSQL*

[postgresql@localhost ~]$ pg_start

server starting

[postgresql@localhost ~]$ LOG: could not bind Unix socket: Address already in use

HINT: Is another postmaster already running on port 5432? If not, remove socket file "/tmp/.s.PGSQL.5432" and retry.

WARNING: could not create Unix-domain socket

c.登陆检查

[postgresql@localhost ~]$ psql

psql: could not connect to server: No such file or directory

Is the server running locally and accepting

connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

[postgresql@localhost ~]$ psql -h 192.168.10.38

Password:

psql (9.2.4)

Type "help" for help.

postgres=# \q

检查了一下,刚才启动的时候在tmp下面socket文件没有生成,导致psql登陆直接报错。若想psql能直接登陆,再重启一下DB,socket文件会随着服务器的启动而生成。

声明:本网页内容旨在传播知识,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文档

Postgres文件所有者更改造成异常处理

Postgres文件所有者更改造成异常处理:Postgres文件所有者更改造成异常处理 本地一台测试机,被同事一不小将根目录下所有文件的属主都改成了root( chown -R root:root /,这是个坑爹而且危险的操作),postgres数据库是用其他用户安装的,上面还有其他应用,这里简单说下postgres数据库的恢
推荐度:
标签: 文件 更改 修改
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top