小编Gan*_*alf的帖子

Postgres 远程访问

我正在尝试远程连接到 postgres。我已经按照本教程http://www.cyberciti.biz/faq/howto-fedora-linux-install-postgresql-server/执行了以下命令以查看远程访问是可能的。

[root@printmyworld ~]# egrep -i "(listen_addresses|port|tcpip_socket).*=.+" /var     /lib/pgsql/data/postgresql.conf
#listen_addresses = '*'         # what IP address(es) to listen on;
#port = 5432
[root@printmyworld ~]# lsof +c0 -anPiTCP -upostgres
COMMAND     PID     USER   FD   TYPE     DEVICE SIZE NODE NAME
postmaster 9323 postgres    3u  IPv4 2875987353       TCP 127.0.0.1:5432 (LISTEN     )
postmaster 9323 postgres    4u  IPv6 2875987354       TCP [::1]:5432 (LISTEN)
Run Code Online (Sandbox Code Playgroud)

我怀疑这条线:

postmaster 9323 postgres    3u  IPv4 2875987353       TCP 127.0.0.1:5432 (LISTEN 
Run Code Online (Sandbox Code Playgroud)

我的服务器ip地址是1yy.000.1xx.000 应该是1yy.000.1xx.000:5432

编辑:我已经删除了 centos 并安装了 ubuntu 和 postgres 8.4

我在这个目录中:/etc/postgresql/8.4/main

pg_hba.conf

# …
Run Code Online (Sandbox Code Playgroud)

postgresql

6
推荐指数
1
解决办法
9360
查看次数

在 ubuntu 上打开 5432 端口

我正在尝试使用 ufw 在 ubuntu 上打开端口 5432 使用 sudo ufw allow 5432/tcp

然后我使用 nmap 来查看端口 5432 是否已打开,我得到了这个:

root@domain:~# sudo nmap -sS -O 127.0.0.1

Starting Nmap 5.21 ( http://nmap.org ) at 2011-12-01 14:28 MSK
Nmap scan report for localhost.localdomain (127.0.0.1)
Host is up (0.000084s latency).
Not shown: 994 closed ports
PORT      STATE SERVICE
22/tcp    open  ssh
25/tcp    open  smtp
80/tcp    open  http
587/tcp   open  submission
5432/tcp  open  postgresql
10000/tcp open  snet-sensor-mgmt
Device type: general purpose
Running: Linux 2.6.X
OS details: Linux 2.6.15 …
Run Code Online (Sandbox Code Playgroud)

ubuntu vps firewall port ufw

6
推荐指数
1
解决办法
3万
查看次数

标签 统计

firewall ×1

port ×1

postgresql ×1

ubuntu ×1

ufw ×1

vps ×1