2

I am having issues starting Postgres 9.6.6 on Windows Server 2016 on an Azure VM.

When I try to start Postgres it generates a log file with the following:

LOG:  could not bind IPv6 socket: Permission denied
HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
LOG:  could not bind IPv4 socket: Permission denied
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
LOG:  database system is shut down

Its a completely brand new VM, I've amended postgresql.conf and the listen_addresses to include 127.0.0.1 but I still get the same binding errors.

If I run nslookup on the VM I receive back the following;

Server: Unknown
Address:  148.43.119.15
*** UnKnown can't find localhost: Non-existent domain

So I think the fact that lookup is failing for localhost is possibly causing the problem. I've amended the hosts file on the VM to have:

127.0.0.1       localhost
:1             localhost

But the same errors are occurring, so I think its something that I've not setup in terms of networking but not sure where to look.

DevOverflow
  • 491
  • 1
  • 5
  • 16
  • please share postgreqls.conf for `listen_addresses` and `unix_socket_directories` – Vao Tsun Dec 18 '17 at 10:11
  • listen_addresses = '127.0.0.1,localhost,148.43.119.15' The unix socket directories is blank and commented out. #unix_socket_directories = '' – DevOverflow Dec 18 '17 at 10:28
  • Which usser it is running the postgrees process ? this users must have permissions to bind and lsiten in these ports. – Gabriel Monteiro Nepomuceno Dec 18 '17 at 11:08
  • The user running the process is a member of the Windows Administrators group. – DevOverflow Dec 18 '17 at 11:16
  • @DevOverflow When you stop postgresql `net stop postgresql-x64-9.6`, then execute `netstat -atn|findstr 5432` what is the result, port 5432 is listening? – Shui shengbao Dec 19 '17 at 06:33
  • @DevOverflow But based on my experience, you could listen service on a public IP(not bind on this VM). You could bind `*`, `localhost`, `VM private IP(like 10.0.0.4)`. – Shui shengbao Dec 19 '17 at 06:34
  • @DevOverflow Hi, does it work now? – Shui shengbao Dec 19 '17 at 08:15
  • Its still failing. I have listen_addresses as * in PostgreSQL.conf. When I stop the PostgreSQL service and execute netstat-atn|findstr 5432 nothing is listening. When I start it again and execute the same command it displays the following; TCP 0.0.0.0:5432 0.0.0.0:0 LISTENING InHost TCP [::]:5432 [::]:0 LISTENING InHost – DevOverflow Dec 19 '17 at 15:52
  • According to the result of `netstat -ant|findstr 5432`, postgresql is listening. Do you check you could access the service inside the VM? – Shui shengbao Dec 20 '17 at 05:38
  • I install postgresql in my Windows Server 2016 and use the default configuration, it works fine for me. Do you change other configuration? If possible, could you show you full postgreqls.conf. Maybe you could save it to github and give a link for you to check it. – Shui shengbao Dec 20 '17 at 05:39
  • `listen_addresses = '*'` what error log return? – Shui shengbao Dec 20 '17 at 05:41

1 Answers1

0

If my understanding is right, 148.43.119.15 is your VM's public IP. You could not listen postgresql on the IP, I get the same result if I set similar with you.

enter image description here

Please modify postgreqls.conf

listen_addresses = '*'

For Azure VM, if you want to access postgresql with Public IP you need open port on Azure NSG and Windows Firewall.

enter image description here

Shui shengbao
  • 18,746
  • 3
  • 27
  • 45