FrontPage > DataBase > PostgreSQL > PostgreSQL外部接続方法
外部接続を可能にするための設定(Vine Linux 2.6 & 2.93) /var/lib/pgsql/data/pg_hba.conf ----- # どなたでもどうぞ状態の設定 host all all 0.0.0.0 0.0.0.0 trust # ローカルのみの設定 host all all 192.168.1.0 255.255.255.0 trust ----- ※クライアントの接続設定。 /var/lib/pgsql/data/postgresql.conf ----- tcpip_socket = true port = 5432 ----- ※tcpip_spcketのOFFからONへ変更。ポートの指定。 上記実行後、サービスのリブート。 # /etc/init.d/postgresql restart
pg_hba.conf ----- # どなたでもどうぞ状態の設定 host all all 0.0.0.0 0.0.0.0 trust # ローカルのみの設定 host all all 192.168.1.0/24 trust ----- ※クライアント接続情報 「/24」は、「 255.255.255.0」と同じ。 ※ デフォルトのパスは、「/usr/local/pgsql/data/pg_hba.conf」 ※Ubuntu + PostgreSQL 8.3では「/etc/postgresql/8.3/main/pg_hba.conf」でした。 postgresql.conf ----- listen_addresses = '*' port = 5432 ----- ※listenアドレスの指定、「port=5432」はデフォルト。 ※デフォルトのパスは、「/usr/local/pgsql/data/postgresql.conf」 ※Ubuntu + PostgreSQL 8.3では「/etc/postgresql/8.3/main/postgresql.conf」 PostgreSQLサーバの再起動 $ /usr/local/pgsql/bin/pg_ctl restart or # /etc/init.d/postgresql restart # /etc/init.d/postgresql-8.3 restart 他
pg_hba.conf ----- # IPv6全許可の設定 host all all ::1/128 trust # IPv4全許可の設定 host all all 0.0.0.0/0 trust ----- ※クライアント接続情報 「/24」は、「 255.255.255.0」と同じ。 postgresql.conf ----- listen_addresses = '*' port = 5432 ----- ※listenアドレスの指定、「port=5432」はデフォルト。 ※IPv4のみの場合は、「listen_addresses=0.0.0.0」を指定。
<TCPのポート5432を解放> # iptables -I INPUT -p tcp -m tcp --dport 5432 -j ACCEPT <「/etc/sysconfig/iptables」に保存> # service iptables save
又は、
<アプリにて「TCP:5432」を追加> # system-config-securitylevel