端口5432不会监听Raspberry PI

时间:2017-03-02 22:57:11

标签: postgresql raspberry-pi port raspberry-pi3 postgresql-9.4

我正在尝试在我的Raspberry PI 3上运行postgresql 9.4,但没有成功。

我的/etc/postgresql/9.4/main/pg_hba.conf

host    all     all     10.0.1.0/24     md5

这是/etc/postgresql/9.4/main/postgresql.conf

listen_addresses = '*'                  # what IP address(es) to listen on;
                                        # comma-separated list of addresses;
                                        # defaults to 'localhost'; use '*' for all
                                        # (change requires restart)
port = 5432                             # (change requires restart)
max_connections = 100                   # (change requires restart)

当我启动服务并获得状态时:

pi@raspberrypi:~ $ sudo service postgresql start
pi@raspberrypi:~ $ sudo service postgresql status
● postgresql.service - PostgreSQL RDBMS
   Loaded: loaded (/lib/systemd/system/postgresql.service; enabled)
   Active: active (exited) since Thu 2017-03-02 22:51:27 UTC; 29s ago
  Process: 2840 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
 Main PID: 2840 (code=exited, status=0/SUCCESS)

Mar 02 22:51:27 raspberrypi systemd[1]: Started PostgreSQL RDBMS.

我只获得ssh端口:

pi@raspberrypi:~ $ sudo netstat -anpt | grep LISTEN
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      577/sshd
tcp6       0      0 :::22                   :::*                    LISTEN      577/sshd

从我的Mac我尝试连接:

❯  psql -h 10.0.1.4 jdmclub_development pguser
psql: could not connect to server: Connection refused
    Is the server running on host "10.0.1.4" and accepting
    TCP/IP connections on port 5432?

我不知道我做错了什么,有人能帮助我吗?

修改

Postgresql日志说:

2017-03-02 23:18:06 UTC [3993-1] LOG: invalid value for parameter "lc_messages": "en_GB.UTF-8" 
2017-03-02 23:18:06 UTC [3993-2] LOG: invalid value for parameter "lc_monetary": "en_GB.UTF-8" 
2017-03-02 23:18:06 UTC [3993-3] LOG: invalid value for parameter "lc_numeric": "en_GB.UTF-8" 
2017-03-02 23:18:06 UTC [3993-4] LOG: invalid value for parameter "lc_time": "en_GB.UTF-8" 
2017-03-02 23:18:06 UTC [3993-5] FATAL: configuration file "/etc/postgresql/9.4/main/postgresql.conf" contains errors

1 个答案:

答案 0 :(得分:1)

使用以下步骤修复它:

sudo raspi-config
  1. 4本地化选项
  2. 选择
  3. I1更改区域设置
  4. 选择
  5. 检查en_GB.UTF-8 UTF8
  6. C.UTF-8
  7. 尝试再次启动postgres服务。

    这对我有用。