citus icon indicating copy to clipboard operation
citus copied to clipboard

Always writing table in to a single node. Percona postgres Citus , Sharding not working

Open SHUFIL opened this issue 1 year ago • 5 comments

Hi Team, Very good morning, I Hope you doing well.

First up on, Thanks to you, for giving a wonderful cluster solution with table sharing, I have installed the Percona Postgres cluster using Citus in ubuntu 22 servers.

I have installed using the below doc

Used 3 nodes, and 192.168.1.101 is coordinator_host, 192.168.1.100 and 192.168.1.1.150 servers are used as nodes , all are used same version even percona postgres cluster and Citus.

Also, I make changes as per the doc in pg_hba.conf and postgresql.conf, in each server to allow connection from other nodes, and each server is connected with private IP .

My problem is when I do testing like importing data , it is only writes table the 192.168.1.100 server not writing 192.168.1.150 server, Sharding not working as expected, I have tested using below command.

SET citus.explain_all_tasks TO on;
EXPLAIN ANALYZE SELECT * FROM events;

When I do analyze using analyze command , it is write only in single system , not both, below you can see that out put.

testdb=# EXPLAIN ANALYZE SELECT * FROM events;
                                                          QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------
 Custom Scan (Citus Adaptive)  (cost=0.00..0.00 rows=100000 width=52) (actual time=38.927..38.928 rows=5 loops=1)
   Task Count: 32
   Tuple data received from nodes: 290 bytes
   Tasks Shown: One of 32
   ->  Task
         Tuple data received from node: 0 bytes
         Node: host=192.168.1.100 port=5432 dbname=testdb
         ->  Seq Scan on events_102040 events  (cost=0.00..20.20 rows=1020 width=52) (actual time=0.005..0.006 rows=0 loops=1)
             Planning Time: 0.509 ms
             Execution Time: 0.032 ms
 Planning Time: 1.453 ms
 Execution Time: 38.974 ms
(12 rows)

SHUFIL avatar Aug 27 '24 11:08 SHUFIL

I can see that you've SET citus.explain_all_tasks TO on, but explain still tells this

Tasks Shown: One of 32

I think it'd better if you can make sure you've enabled citus.explain_all_tasks in the same session where you're executing EXPLAIN ANALYZE command.

onurctirtir avatar Aug 29 '24 10:08 onurctirtir

I have used the same and yes I getting a detailed view of each table with node name and IP address. But my problem is it is written into a single node, not for both.

SHUFIL avatar Aug 29 '24 12:08 SHUFIL

Could you also share the expanded explain output while "explain all tasks" is enabled?

onurctirtir avatar Aug 29 '24 16:08 onurctirtir

Thanks for support , I have used new version , and resolved that issue,

And I have one more query , like , I need to move data from one table to another, after x month , is that possible using any extension , or any automated method ?

SHUFIL avatar Sep 03 '24 07:09 SHUFIL

Also, I have one more doubt that is , citus postgress percona cluster started with one control host and two nodes , is this cluster will share database with all nodes like one database data replicate with two nodes or it will only share table which is selected using the citus configuration?

Because I have created one db in the host control system, but it is not listing in node server

SHUFIL avatar Sep 04 '24 14:09 SHUFIL