how to implement Citus across multiple nodes

66 Views Asked by At

I am new to Citus. I want to know how to implement Citus across multiple nodes. I have already created three virtual machines using VirtualBox, but I don't have any idea how to connect these three.

I just want to know what I am doing wrong while connecting these three nodes. Here is the configuration files for one coordinator node and two worker nodes, along with their pg_hba.conf files:

Coordinator Node (pg_hba.conf):

    # 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
    # Allow connections from the worker nodes
    host    all             all             192.168.3.77/32         md5
    host    all             all             192.168.3.187/32        md5
    # IPv6 local connections:
    host    all             all             ::1/128                trust

Worker Node 1 (pg_hba.conf):

    # 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
    # Allow connections from the coordinator node
    host    all             all             192.168.3.71/32         md5
    # IPv6 local connections:
    host    all             all             ::1/128                trust

Worker Node 2 (pg_hba.conf):

    # 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
    # Allow connections from the coordinator node
    host    all             all             192.168.3.71/32         md5
    # IPv6 local connections:
    host    all             all             ::1/128                trust
1

There are 1 best solutions below

0
On

(Would be a mess as a comment)

I am also new to Citus and after checking it in a docker container, I tried to set it up on virtual boxes. Here is what worked for me (following this Citus MultiNode documentation):

  • I used VMWare Fusion Player and created 5 Ubuntu machines. (warning: Ubuntu 23.10 did not work, 22.04.3 LTS works)

In configuration step, I did as what they suggested:

# Allow unrestricted access to nodes in the local network. The following ranges
# correspond to 24, 20, and 16-bit blocks in Private IPv4 address spaces.
host    all             all             192.168.94.0/24         trust

# Also allow the host unrestricted access to connect to itself
host    all             all             127.0.0.1/32            trust
host    all             all             ::1/128                 trust

and it worked with this setup.

There they warn that this is too permissive and for increasing security they have this sample:

# Require password access and a ssl/tls connection to nodes in the local
# network. The following ranges correspond to 24, 20, and 16-bit blocks
# in Private IPv4 address spaces.
hostssl    all             all             10.0.0.0/8              md5

# Require passwords and ssl/tls connections when the host connects to
# itself as well.
hostssl    all             all             127.0.0.1/32            md5
hostssl    all             all             ::1/128                 md5

and also edits the pgpass file to have the connection information for each node:

hostname:port:database:username:password

In your case it seems like you need to use hostssl instead of host and also edit your pgpass file.