pgadmin4: not possible to create server

Started by robert rottermannabout 8 years ago15 messagesgeneral
Jump to latest
#1robert rottermann
robert@redcor.ch

Hi there,

I have installed pgadmin4 locally using its docker image.

this i did running the following command:

docker run -p 80:80 -e "PGADMIN_DEFAULT_EMAIL=admin" -e
"PGADMIN_DEFAULT_PASSWORD=admin" -d dpage/pgadmin4

I then could access it and log into it.

However all my attempts end in:

Unable to connect to server:

could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?

can anybody give me a hint, what to do?

thanks

robert

in /etc/postgresql/10/main/postgresql.conf

i have:

#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------

# - Connection Settings -

listen_addresses = '*'          # what IP address(es) to listen on;
                                        # comma-separated list of
addresses;

and this is my /etc/postgresql/10/main/pg_hba.conf

# DO NOT DISABLE!
# If you change this first entry you will need to make sure that the
# database superuser can access the database using some other method.
# Noninteractive access to all databases is required during automatic
# maintenance (custom daily cronjobs, replication, and similar tasks).
#
# Database administrative login by Unix domain socket
local   all             postgres peer

# TYPE  DATABASE        USER            ADDRESS METHOD

# "local" is for Unix domain socket connections only
local   all             all trust
# IPv4 local connections:
host    all             all             127.0.0.1/32 trust
# IPv6 local connections:
host    all             all             ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all peer
host    replication     all             127.0.0.1/32 md5
host    replication     all             ::1/128 md5

#2Adrian Klaver
adrian.klaver@aklaver.com
In reply to: robert rottermann (#1)
Re: pgadmin4: not possible to create server

On 02/06/2018 09:24 AM, robert rottermann wrote:

Hi there,

I have installed pgadmin4 locally using its docker image.

this i did running the following command:

docker run -p 80:80 -e "PGADMIN_DEFAULT_EMAIL=admin" -e
"PGADMIN_DEFAULT_PASSWORD=admin" -d dpage/pgadmin4

I then could access it and log into it.

However all my attempts end in:

Unable to connect to server:

could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?

So where is the Postgres server located?

can anybody give me a hint, what to do?

thanks

robert

in /etc/postgresql/10/main/postgresql.conf

i have:

#------------------------------------------------------------------------------

# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------

# - Connection Settings -

listen_addresses = '*'          # what IP address(es) to listen on;
                                        # comma-separated list of
addresses;

and this is my /etc/postgresql/10/main/pg_hba.conf

# DO NOT DISABLE!
# If you change this first entry you will need to make sure that the
# database superuser can access the database using some other method.
# Noninteractive access to all databases is required during automatic
# maintenance (custom daily cronjobs, replication, and similar tasks).
#
# Database administrative login by Unix domain socket
local   all             postgres peer

# TYPE  DATABASE        USER            ADDRESS METHOD

# "local" is for Unix domain socket connections only
local   all             all trust
# IPv4 local connections:
host    all             all             127.0.0.1/32 trust
# IPv6 local connections:
host    all             all             ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all peer
host    replication     all             127.0.0.1/32 md5
host    replication     all             ::1/128 md5

--
Adrian Klaver
adrian.klaver@aklaver.com

#3Murtuza Zabuawala
murtuza.zabuawala@enterprisedb.com
In reply to: robert rottermann (#1)
Re: pgadmin4: not possible to create server

Add following in your pg_hba.conf,

host all all 0.0.0.0/ <http://127.0.0.1/32&gt;0 md5

restart your Postgres database server and try to connect again from
pgAdmin4.

On Tue, Feb 6, 2018 at 10:54 PM, robert rottermann <robert@redcor.ch> wrote:

Show quoted text

Hi there,

I have installed pgadmin4 locally using its docker image.

this i did running the following command:

docker run -p 80:80 -e "PGADMIN_DEFAULT_EMAIL=admin" -e
"PGADMIN_DEFAULT_PASSWORD=admin" -d dpage/pgadmin4

I then could access it and log into it.

However all my attempts end in:

Unable to connect to server:

could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?

can anybody give me a hint, what to do?

thanks

robert

in /etc/postgresql/10/main/postgresql.conf

i have:

#-----------------------------------------------------------
-------------------
# CONNECTIONS AND AUTHENTICATION
#-----------------------------------------------------------
-------------------

# - Connection Settings -

listen_addresses = '*' # what IP address(es) to listen on;
# comma-separated list of
addresses;

and this is my /etc/postgresql/10/main/pg_hba.conf

# DO NOT DISABLE!
# If you change this first entry you will need to make sure that the
# database superuser can access the database using some other method.
# Noninteractive access to all databases is required during automatic
# maintenance (custom daily cronjobs, replication, and similar tasks).
#
# Database administrative login by Unix domain socket
local all postgres peer

# TYPE DATABASE USER ADDRESS METHOD

# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all peer
host replication all 127.0.0.1/32 md5
host replication all ::1/128 md5

#4robert
robert@redo2oo.ch
In reply to: Murtuza Zabuawala (#3)
Re: pgadmin4: not possible to create server

thanks

unfortunately id did not help
On 06.02.2018 18:29, Murtuza Zabuawala wrote:

Add following in your pg_hba.conf,

host all             all             0.0.0.0/ <http://127.0.0.1/32&gt;0md5

restart your Postgres database server and try to connect again from
pgAdmin4.

from pgadmin3 I can connect

any more ideas?
robert
On Tue, Feb 6, 2018 at 10:54 PM, robert rottermann <robert@redcor.ch
<mailto:robert@redcor.ch>>wrote:

Hi there,

I have installed pgadmin4 locally using its docker image.

this i did running the following command:

docker run -p 80:80 -e "PGADMIN_DEFAULT_EMAIL=admin" -e
"PGADMIN_DEFAULT_PASSWORD=admin" -d dpage/pgadmin4

I then could access it and log into it.

However all my attempts end in:

Unable to connect to server:

could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?

can anybody give me a hint, what to do?

thanks

robert

in /etc/postgresql/10/main/postgresql.conf

i have:

#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------

# - Connection Settings -

listen_addresses = '*'          # what IP address(es) to listen on;
          # comma-separated list of addresses;

and this is my /etc/postgresql/10/main/pg_hba.conf

# DO NOT DISABLE!
# If you change this first entry you will need to make sure that the
# database superuser can access the database using some other method.
# Noninteractive access to all databases is required during automatic
# maintenance (custom daily cronjobs, replication, and similar tasks).
#
# Database administrative login by Unix domain socket
local   all             postgres peer

# TYPE  DATABASE        USER            ADDRESS METHOD

# "local" is for Unix domain socket connections only
local   all             all trust
# IPv4 local connections:
host    all             all 127.0.0.1/32 <http://127.0.0.1/32&gt; trust
# IPv6 local connections:
host    all             all             ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all peer
host    replication     all 127.0.0.1/32 <http://127.0.0.1/32&gt; md5
host    replication     all             ::1/128 md5

--
Robert Rottermann CEO

031 333 10 20
robert@redo2oo.ch <mailto:robert@redo2oo.ch>
Sickingerstrasse 3, 3014 Bern
<http://maps.apple.com/?q=Sickingerstrasse%203,3014%20Bern&gt;

https://Redo2oo.ch <https://redo2oo.ch&gt;

*Ihr Partner wenn es um ERP Lösungen geht.*

#5robert
robert@redo2oo.ch
In reply to: Adrian Klaver (#2)
Re: pgadmin4: not possible to create server

On 06.02.2018 18:28, Adrian Klaver wrote:

On 02/06/2018 09:24 AM, robert rottermann wrote:

Hi there,

I have installed pgadmin4 locally using its docker image.

this i did running the following command:

docker run -p 80:80 -e "PGADMIN_DEFAULT_EMAIL=admin" -e
"PGADMIN_DEFAULT_PASSWORD=admin" -d dpage/pgadmin4

I then could access it and log into it.

However all my attempts end in:

Unable to connect to server:

could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?

So where is the Postgres server located?

on my local desktop
robert

#6robert rottermann
robert@redcor.ch
In reply to: Murtuza Zabuawala (#3)
Re: pgadmin4: not possible to create server

thanks

unfortunately id did not help
On 06.02.2018 18:29, Murtuza Zabuawala wrote:

Add following in your pg_hba.conf,

host all             all             0.0.0.0/ <http://127.0.0.1/32&gt;0md5

restart your Postgres database server and try to connect again from
pgAdmin4.

from pgadmin3 I can connect

any more ideas?
robert
On Tue, Feb 6, 2018 at 10:54 PM, robert rottermann <robert@redcor.ch
<mailto:robert@redcor.ch>>wrote:

Show quoted text

Hi there,

I have installed pgadmin4 locally using its docker image.

this i did running the following command:

docker run -p 80:80 -e "PGADMIN_DEFAULT_EMAIL=admin" -e
"PGADMIN_DEFAULT_PASSWORD=admin" -d dpage/pgadmin4

I then could access it and log into it.

However all my attempts end in:

Unable to connect to server:

could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?

can anybody give me a hint, what to do?

thanks

robert

in /etc/postgresql/10/main/postgresql.conf

i have:

#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------

# - Connection Settings -

listen_addresses = '*'          # what IP address(es) to listen on;
          # comma-separated list of addresses;

and this is my /etc/postgresql/10/main/pg_hba.conf

# DO NOT DISABLE!
# If you change this first entry you will need to make sure that the
# database superuser can access the database using some other method.
# Noninteractive access to all databases is required during automatic
# maintenance (custom daily cronjobs, replication, and similar tasks).
#
# Database administrative login by Unix domain socket
local   all             postgres peer

# TYPE  DATABASE        USER            ADDRESS METHOD

# "local" is for Unix domain socket connections only
local   all             all trust
# IPv4 local connections:
host    all             all 127.0.0.1/32 <http://127.0.0.1/32&gt; trust
# IPv6 local connections:
host    all             all             ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all peer
host    replication     all 127.0.0.1/32 <http://127.0.0.1/32&gt; md5
host    replication     all             ::1/128 md5

#7robert rottermann
robert@redcor.ch
In reply to: Adrian Klaver (#2)
Re: pgadmin4: not possible to create server

On 06.02.2018 18:28, Adrian Klaver wrote:

On 02/06/2018 09:24 AM, robert rottermann wrote:

Hi there,

I have installed pgadmin4 locally using its docker image.

this i did running the following command:

docker run -p 80:80 -e "PGADMIN_DEFAULT_EMAIL=admin" -e
"PGADMIN_DEFAULT_PASSWORD=admin" -d dpage/pgadmin4

I then could access it and log into it.

However all my attempts end in:

Unable to connect to server:

could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?

So where is the Postgres server located?

on my local desktop
robert

#8Adrian Klaver
adrian.klaver@aklaver.com
In reply to: robert rottermann (#7)
Re: pgadmin4: not possible to create server

On 02/06/2018 02:08 PM, robert wrote:

On 06.02.2018 18:28, Adrian Klaver wrote:

On 02/06/2018 09:24 AM, robert rottermann wrote:

Hi there,

I have installed pgadmin4 locally using its docker image.

this i did running the following command:

docker run -p 80:80 -e "PGADMIN_DEFAULT_EMAIL=admin" -e
"PGADMIN_DEFAULT_PASSWORD=admin" -d dpage/pgadmin4

I then could access it and log into it.

However all my attempts end in:

Unable to connect to server:

could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?

So where is the Postgres server located?

on my local desktop

So you pgAdmin4 running in a container on your local machine and
Postgres running in the native OS(the OS is?) on your local machine. Is
the Docker container set up to 'see' the local machine?

robert

--
Adrian Klaver
adrian.klaver@aklaver.com

#9robert rottermann
robert@redcor.ch
In reply to: Adrian Klaver (#8)
Re: pgadmin4: not possible to create server
Show quoted text

On 06.02.2018 23:12, Adrian Klaver wrote:

On 02/06/2018 02:08 PM, robert wrote:

On 06.02.2018 18:28, Adrian Klaver wrote:

On 02/06/2018 09:24 AM, robert rottermann wrote:

Hi there,

I have installed pgadmin4 locally using its docker image.

this i did running the following command:

docker run -p 80:80 -e "PGADMIN_DEFAULT_EMAIL=admin" -e
"PGADMIN_DEFAULT_PASSWORD=admin" -d dpage/pgadmin4

I then could access it and log into it.

However all my attempts end in:

Unable to connect to server:

could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?

So where is the Postgres server located?

on my local desktop

So you pgAdmin4 running in a container on your local machine and
Postgres running in the native OS(the OS is?) on your local machine.
Is the Docker container set up to 'see' the local machine?

#10robert rottermann
robert@redcor.ch
In reply to: Adrian Klaver (#8)
Re: pgadmin4: not possible to create server

On 06.02.2018 23:12, Adrian Klaver wrote:

On 02/06/2018 02:08 PM, robert wrote:

On 06.02.2018 18:28, Adrian Klaver wrote:

On 02/06/2018 09:24 AM, robert rottermann wrote:

Hi there,

I have installed pgadmin4 locally using its docker image.

this i did running the following command:

docker run -p 80:80 -e "PGADMIN_DEFAULT_EMAIL=admin" -e
"PGADMIN_DEFAULT_PASSWORD=admin" -d dpage/pgadmin4

I then could access it and log into it.

However all my attempts end in:

Unable to connect to server:

could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?

So where is the Postgres server located?

on my local desktop

So you pgAdmin4 running in a container on your local machine and
Postgres running in the native OS(the OS is?) on your local machine.
Is the Docker container set up to 'see' the local machine?

what do you mean by see?

#11Adrian Klaver
adrian.klaver@aklaver.com
In reply to: robert rottermann (#10)
Re: pgadmin4: not possible to create server

On 02/06/2018 02:19 PM, robert wrote:

On 06.02.2018 23:12, Adrian Klaver wrote:

On 02/06/2018 02:08 PM, robert wrote:

On 06.02.2018 18:28, Adrian Klaver wrote:

On 02/06/2018 09:24 AM, robert rottermann wrote:

Hi there,

I have installed pgadmin4 locally using its docker image.

this i did running the following command:

docker run -p 80:80 -e "PGADMIN_DEFAULT_EMAIL=admin" -e
"PGADMIN_DEFAULT_PASSWORD=admin" -d dpage/pgadmin4

I then could access it and log into it.

However all my attempts end in:

Unable to connect to server:

could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?

So where is the Postgres server located?

on my local desktop

So you pgAdmin4 running in a container on your local machine and
Postgres running in the native OS(the OS is?) on your local machine.
Is the Docker container set up to 'see' the local machine?

what do you mean by see?

For fuller explanation see:

https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach

--
Adrian Klaver
adrian.klaver@aklaver.com

#12Adrian Klaver
adrian.klaver@aklaver.com
In reply to: robert rottermann (#10)
Re: pgadmin4: not possible to create server

On 02/06/2018 02:19 PM, robert wrote:

So you pgAdmin4 running in a container on your local machine and
Postgres running in the native OS(the OS is?) on your local machine.
Is the Docker container set up to 'see' the local machine?

what do you mean by see?

Meant to ask earlier, why you are using the Docker image instead of one
of the binaries listed here:

https://www.pgadmin.org/download/

--
Adrian Klaver
adrian.klaver@aklaver.com

#13robert rottermann
robert@redcor.ch
In reply to: Adrian Klaver (#11)
solution: Re: pgadmin4: not possible to create server

Adrian

So you pgAdmin4 running in a container on your local machine and
Postgres running in the native OS(the OS is?) on your local machine.
Is the Docker container set up to 'see' the local machine?

what do you mean by see?

For fuller explanation see:

https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach

your hint pointed in the right direction:
it is not localhost, on which the server is running, because localhost
is relative to the container, so it is in effect the container itself.
Postgres is running on the gatway of the containers network.
This I found out by issuing:
docker inspect reverent_volhard (where reverent_volhard is the
containers name in which pgadmin4 runs)
this providest:
...
          "Networks": {
                "bridge": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID":
"df33249ff65c37ea1ca1f142b4a74283c4429c44c3ed1eb5ea80c695c87ab86d",
                    "EndpointID":
"905c0c78145ef1847854f221200d8e4a7788f99b901030460111258ab9156b29",
                    "Gateway": "172.17.0.1",
                    "IPAddress": "172.17.0.2",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:ac:11:00:02",
                    "DriverOpts": null
                }

so postgres runs on 172.17.0.1

and bingo, it works

thanks again
robert

#14robert rottermann
robert@redcor.ch
In reply to: Adrian Klaver (#12)
Re: pgadmin4: not possible to create server

On 06.02.2018 23:33, Adrian Klaver wrote:

On 02/06/2018 02:19 PM, robert wrote:

So you pgAdmin4 running in a container on your local machine and
Postgres running in the native OS(the OS is?) on your local machine.
Is the Docker container set up to 'see' the local machine?

what do you mean by see?

Meant to ask earlier, why you are using the Docker image instead of
one of the binaries listed here:

https://www.pgadmin.org/download/

i tried to install pgadmin4 some 10 months ago and found it confusing
with the server and desktop mode

#15Adrian Klaver
adrian.klaver@aklaver.com
In reply to: robert rottermann (#14)
Re: pgadmin4: not possible to create server

On 02/06/2018 03:11 PM, robert wrote:

On 06.02.2018 23:33, Adrian Klaver wrote:

On 02/06/2018 02:19 PM, robert wrote:

So you pgAdmin4 running in a container on your local machine and
Postgres running in the native OS(the OS is?) on your local machine.
Is the Docker container set up to 'see' the local machine?

what do you mean by see?

Meant to ask earlier, why you are using the Docker image instead of
one of the binaries listed here:

https://www.pgadmin.org/download/

i tried to install pgadmin4 some 10 months ago and found it confusing
with the server and desktop mode

When I was kicking the tires on pgAdmin4 I found the easiest way to use
it was to install the Python wheel into a Python virtual environment:

https://www.pgadmin.org/download/pgadmin-4-python-wheel/

I have not played with for a while though as a find psql is the better
interface.

--
Adrian Klaver
adrian.klaver@aklaver.com