PostgreSQL database server listener settings and Client Connection Methods tutorial, postgresql Server

Source: Internet
Author: User
Tags unix domain socket postgresql version

PostgreSQL database server listener settings and Client Connection Methods tutorial, postgresql Server

As we all know, PostgreSQL is a free object-relational database server (Database Management System). It is an open-source database system that can be used for free. This article describes in detail the listener settings and Client Connection Methods of the PostgreSQL database server, as follows:

I. background:

The PostgreSQL server is running on RedHat Linux. The IP address is 192.168.230.128.
The client is installed on Windows XP with the IP address 192.168.230.1

Ii. configuration method:

1. Modify the/opt/postgresql/data/postgresql. conf file on the server:

#listen_address='localhost'

Change

listen_address='*'

2. Modify the/opt/postgresql/data/gp_assist.conf file:

Add the Client ip address as follows. Pay attention to the last line:

# TYPE DATABASE  USER    CIDR-ADDRESS     METHOD# "local" is for Unix domain socket connections onlylocal  all     all                trust# IPv4 local connections:host  all     all     127.0.0.1/32     trust# IPv6 local connections:host  all     all     ::1/128        trust#kevin add# IPv4 local connections:host  all     all     192.168.230.1/32     trust

3. Restart the PG service:

[postgres@localhost data]$ pg_ctl restartwaiting for server to shut down....LOG: received smart shutdown requestLOG: autovacuum launcher shutting downLOG: shutting downLOG: database system is shut down doneserver stoppedserver starting[postgres@localhost data]$ LOG: database system was shut down at 2011-07-09 14:54:29 CSTLOG: autovacuum launcher startedLOG: database system is ready to accept connections[postgres@localhost data]$

4. Use the client to connect. The configuration is as follows:

5. Click "OK" to connect. After the connection is successful, it is as follows:


How can I set the full ip address of the Local Network monitored by the PostgreSQL server?

For example

Pg_cmd.conf Configuration:

Host all (your network segment). 0/24 md5

How Should postgreSQL be configured to connect from external programming?

By default, postgreSQL does not allow external connections. You need to configure this feature. The postgreSQL version is 8.4.4. Go to the % postgreSQL_path % \ 8 \ data directory, open the pg_hba.conf file, and find the following section:

# Type database user CIDR-ADDRESS METHOD

# IPv4 local connections:
Host all
127.0.0.1/32 md5
# IPv6 local connections:
# Host all
All: 1/128 md5
Add a line to a series of hosts under # IPv4:
Host
All 192.168.80.1/24 md5
This line allows all 192.168.80 .***
In this way, the ip address accesses the local postgreSQL service. The original
Host all
All 127.0.0.1/32
Md5
Do not delete this line. When I configure this line for the first time, the postgreSQL service cannot be started. However, after postgreSQL fails to start, many ipvs processes cannot be automatically closed, and task manager cannot be used to manually close all of them, because postgreSQL will automatically start new processes, you often turn off one and many more. Finally, I used the cports tool's "terminate processes that open the selected window" function to disable postgreSQL.

The postgreSQL service cannot be started. The solution is as follows:
Modify Local Link Attributes:
Local Link-> properties-> Internet Protocol (TCP/IP)-> properties-> General
-> Advanced-> WINS-> Start
LMHOSTS Query
If selected, click to go to the front hook (if not, click it ). OK, OK, and close.
Then you will find that the postgres service can be started.

The reason is that the working method of Dr.com has modified Winsock.
LSP causes the ipvs service to fail to start normally.

The postgres service is always available after it is started. During this period, Dr.com can be used normally (in the pop-up dialog box, do not choose to restart), but PostgreSQL cannot be used after it is restarted.

In this case, repeat the above steps to check or remove the "start"
LMHOSTS query.
Then you can try again.

The problem I encountered does not belong to this situation and is not valid after testing.

Modify the postgresql. conf file at the same time,
Listen_addresses =
'*'
In my local machine, the above configuration is used by default, that is, all addresses are allowed during installation.

Configuration instructions:
# TYPE DATABASE USER
CIDR-ADDRESS
METHOD
It indicates that each row has five fields,
They are: Connection type, available database name, user, DIDR address, and verification method.
Below, I will only introduce some common options for each field.

Field 1: TYPE.
You can select local or host.
The former can only allow local users to log on to the ipvs database; the latter can accept remote client login. So,
We should use "host ".

Field 2: DATWABSE.
Name of the database that can be used by the connection user. It can make a specific
Data... the remaining full text>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.