当我尝试运行服务器时:
postgres@ubuntu:~$/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data LOG: Could not bind IPv4 socket: Address already in use HINT: Is another postmaster already running on port 5432? If not,wait a few seconds and retry. WARNING: Could not create listen socket for "localhost" FATAL: Could not create any TCP/IP sockets postgres@ubuntu:~$
然后我将用户改为自己:
postgres@ubuntu:~$su - michael michael@ubuntu:~$ sudo netstat -tulpn | grep 5432 tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN 959/postgres
好吧,postgres似乎正在听端口,这似乎是问题所在.
让我们将pack更改为postgres并尝试终止此过程:
postgres@ubuntu:~$kill `cat /usr/local/pgsql/data/postmaster.pid`
反应是:
cat: /usr/local/pgsql/data/postmaster.pid: No such file or directory kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
你能推荐我怎么办吗?
解决方法
首先,运行Postgres pid:
ps -ef | grep postmaster | awk '{print $2}'
然后杀了它
kill <the_pid_you_just_got>
但除非你试图用Postgres(多个实例……)做一些非常特殊的事情,你应该使用sudo /etc/init.d/postgresql stop(或sudo /etc/init.d/postgres stop)来停止它并启动它使用sudo /etc/init.d/postgresql start
Postgres作为服务运行,因此它有一个服务控制文件/脚本,负责正确启动和停止它.这些控制文件曾经位于/etc/init.d中,但我必须承认,这些日子已经变得有点乱,服务管理系统越来越多(init,upstart,systemd …)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。