Search code examples
postgresqlpostgres-xl

About coordinator and datanode in Postgres-XL


thanks for your help. I failed to build a Postgres-XL cluster. My gtm.confg :

listen_addresses = '0.0.0.0'
port = 6668

at 10.80.19.47. My gtm_proxy.confg:

listen_addresses = '0.0.0.0'
port = 6666
gtm_host = '10.80.19.47'
gtm_port = 6668

after start gtm and gtm_proxy ,i show net information use lsof -i :

gtm       11730 postgres    6u  IPv4 355914      0t0  TCP 10.80.19.47:ircu-4->10.80.19.46:44017 (ESTABLISHED
gtm       11730 postgres    7u  IPv4 355915      0t0  TCP 10.80.19.47:ircu-4->10.80.19.46:44018 (ESTABLISHED)
gtm       11730 postgres    8u  IPv4 355916      0t0  TCP 10.80.19.47:ircu-4->10.80.19.46:44019 (ESTABLISHED)

Then i configure datanode like:

listen_addresses = '0.0.0.0'
port = 5432
pooler_port = 20002
gtm_host = '127.0.0.1'
gtm_port = 6666 

and coordinator like:

listen_addresses = '0.0.0.0'
port = 3456
pooler_port = 20003
gtm_host = '127.0.0.1'
gtm_port = 6666

others are default ,then i start datanode with :

/usr/postgres-xl-9.2/bin/postgres --datanode -D /data1/pgsql/data &

start coordinator with:

/usr/postgres-xl-9.2/bin/postgres --coordinator -D /data1/pgsql/coordinator &

when i connect to Postgres-XL use coordinator with :

 psql -h 127.0.0.1 -p 3456 postgres;

when i want to create a database with:

 create database test;

but failed,it shows :

No Datanode defined in cluster
You need to define at least 1 Datanode with CREATE NODE.

then i check the cluster with :

 psql -h 127.0.0.1 -p 3456  postgres  -c "select * from pgxc_node order by 1";

it shows just one node like:

node_name     | node_type | node_port | node_host | nodeis_primary | nodeis_preferred |  node_id  
-------------------+-----------+-----------+-----------+----------------+------------------+-----------
coordinator_node2 | C         |      5432 | localhost | f              | f                | 738118815

and i connect to port 5432 it shows the similar information like:

 node_name  | node_type | node_port | node_host | nodeis_primary | nodeis_preferred |  node_id   
------------+-----------+-----------+-----------+----------------+------------------+------------
data_node2 | C         |      5432 | localhost | f              | f                | -923817565

what wrong with my Configuration? Thanks all.


Solution

  • You need to define datanode something like this.

    ./psql -c "CREATE NODE datanode1 WITH (TYPE = 'datanode', PORT = 7777)" postgres -p 3456 -h 127.0.0.1