1.问题:服务器突然断电,连接数据库报错。计划重启,发现postgresql重启失败。
psql: error: could not connect to server: 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"?
执行:service postgresql restart显示failed
2.查看/tmp目录下并没有.s.PGSQL.5432;尝试删除postmaster.pid,重启postgresql依然失败,所以猜测不是删除/tmp/.s.PGSQL.5432和postmaster.pid能解决的
3.尝试切换到pgadmin用户,执行su - pgadmin失败,查看cat /etc/passwd,发现pgadmin:x:500:500::/home/pgadmin:/sbin/nologin,用户pgadmin无法登录。
4.解决方法:执行usermod -s /bin/bash pgadmin,允许pgadmin用户登录,重新启动psql成功。
博客记录了服务器突然断电后,PostgreSQL重启失败的问题。连接数据库报错,查看/tmp目录缺少相关文件,删除postmaster.pid也无法解决,且pgadmin用户无法登录。最终通过执行usermod -s /bin/bash pgadmin允许用户登录,成功重启psql。

2124

被折叠的 条评论
为什么被折叠?



