postgres=# select * from pgxc_node;
node_name | node_type | node_port | node_host | nodeis_primary | nodeis_preferred | node_id
-----------+-----------+-----------+-----------+----------------+------------------+------------
coord3 | C | 20004 | localhost | f | f | 1638403545
(1 row)
而问题是出在coordPgHbaEntries=(10.21.13.0/25)和datanodePgHbaEntries=(10.21.13.0/25)的访问权限控制上,一定要和实际的子网掩码匹配,不然各个datanode节点和coord节点间是无法正常通讯的。
由于没有注意各个细节,让这个问题困扰我一周时间。一直在找为什么datanode之间不能相互识别的原因,其实就是很小的一个点。
[postgres@ip-10-21-13-109 pgxc_ctl]$ ifconfig
eth0 Link encap:Ethernet HWaddr 02:57:E7:56:4C:70
inet addr:10.21.13.109 Bcast:10.21.13.127 Mask:255.255.255.128<<<<<<10.21.13.0/25
inet6 addr: fe80::57:e7ff:fe56:4c70/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:9001 Metric:1
RX packets:29500 errors:0 dropped:0 overruns:0 frame:0
TX packets:28538 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3113614 (2.9 MiB) TX bytes:4653853 (4.4 MiB)
Interrupt:160
2. 如果遇到建表,建库失败,也是遇到上面的访问控制权限问题。在部署完成之后,这个参数是在/home/postgres/pgxc/nodes/dn_master/pg_hba.conf和/home/postgres/pgxc/nodes/coord/pg_hba.conf中设置的。但是重新init,会覆盖掉这些文件的。
postgres=# create database test;
ERROR: Failed to get pooled connections
HINT: This may happen because one or more nodes are currently unreachable, either because of node or network failure.
Its also possible that the target node may have hit the connection limit or the pooler is configured with low connections.
Please check if all nodes are running fine and also review max_connections and max_pool_size configuration parameters
3. 有很多人的安装方式,是最后通过手动执行下面命令,添加coord和datanode,其实前面的pgxc_ctl.conf配置正确的话,脚本都是自动帮你完成的,没有必要人工干预
create node coord1 with (type=coordinator,host='c6702', port=20004);
create node coord2 with (type=coordinator,host='c6703', port=20005);
alter node coord3 with (type=coordinator,host='c6704', port=20004);
create node datanode1 with (type=datanode, host='c6702',port=20008);
create node datanode2 with (type=datanode, host='c6703',port=20008);
alter node datanode3 with (type=datanode, host='c6704',port=20008);
4. 第8步,make PGXL软件过程中,一定要仔细查看输出,有错误一定要纠正。不然后续会发现,有很多命令软件,都没有安装成功。
5.如果你在远程登陆postgres sql遇到如下问题
[root@c6703 ~]# psql -h 10.21.13.67 -p 20004 -U postgres
psql: FATAL: no pg_hba.conf entry for host "172.16.32.116", user "postgres", database "postgres"