Re: BDR Across Distributed Nodes - Mailing list pgsql-general

From Tomas Vondra
Subject Re: BDR Across Distributed Nodes
Date
Msg-id 55396030.10301@2ndquadrant.com
Whole thread Raw
In response to BDR Across Distributed Nodes  (billythebomber <billythebomber@gmail.com>)
List pgsql-general
Hi!

On 04/23/15 20:42, billythebomber wrote:
> I'm starting to test BDR, and I've followed the quickstart included in
> the documentation successfully.
>
> The problem I'm encountering is when two servers are on different hosts,
> which is not covered in the documentation. Node1 is 10.0.0.1, node2 is
> 10.0.0.2, but when I try to connect from node2:
>
> demo=# SELECT bdr.bdr_group_join(
>        local_node_name := 'node2',
>        node_external_dsn := 'port=5432 dbname=demo',
>        join_using_dsn := 'port=5432 dbname=demo host=10.0.0.1'
>
> ERROR:  node identity for node_external_dsn does not match current node
> when connecting back via remote
> DETAIL: The dsn '' connects to a node with identity
> (6140654556124456820,1,16385) but the local node is
> (6140654709151998583,1,16385)
> HINT:  The 'node_external_dsn' parameter must refer to the node you're
> running this function from, from the perspective of the node pointed to
> by join_using_dsn

The problem apparently is that 'node2' connects to 'node1', using the
join_using_dsn and passes it the node_external_dsn. node1 takes that,
and attempts to connect to that. Sadly, the DSN does not contain any
host, so node1 uses localhost and connects to itself. And finds that the
identity does not match the expected one (because it expects *583,
assigned to node2, but gets *820, which is probably node1).

>
> If I add node2 host entry:
>
> demo=# SELECT bdr.bdr_group_join(
>        local_node_name := 'node2',
>        node_external_dsn := 'port=5432 dbname=demo host=10.0.0.2',
>        join_using_dsn := 'port=5432 dbname=demo host=10.0.0.1'
> );
> FATAL:  could not connect to the server in non-replication mode: could
> not connect to server: Connection refused
>      Is the server running on host "10.0.0.2" and accepting
>      TCP/IP connections on port 5432?

This seems correct, but apparantly node1 can't connect to node2, using
the external_dsn. Try connecting using psql from 10.0.0.1 to 10.0.0.2
and then from 10.0.0.2 to 10.0.0.1. So something like this:

# from 10.0.0.1
psql -h 10.0.0.2 -p 5432 demo

# from 10.0.0.2
psql -h 10.0.0.1 -p 5432 demo

If that does not work, you probably need to investigate - firewall
settings, pg_hba.conf and postgresql.conf (maybe it's not listening on
this address)?

regards

--
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Invalid memory alloc
Next
From: Andrey Lizenko
Date:
Subject: rolled back transactions logging