Manager Handbook for Distributed AntDB-T - P23–3
Published: 2023-08-25 06:17:48

Hba table

The hba table is used to manage the configuration items in the pg_hba.conf file that holds all nodes in the AntDB cluster. When a configuration item is added, it is recorded in this table and used to identify it. For the added configuration items, you can display them by list hba command. The explanation of each column of the hba table is as follows:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5zk1gh3vglb7awb7jz8j.png)
Examples of common commands for hba table operations are as follows (refer to Chapter 4, hba table related commands for specific usage of the commands).

```
--Add the HBA content of the coordinator to the HBA table: 
add hba coordinator all ("host all all 10.0.0.0 8 md5"); 
-- Add the HBA content of DataNode to the HBA table: 
add hba datanode all ("host all all 10.0.0.0 8 trust"); 
--Displays the contents of the HBA table： 
list hba; 
--Delete the contents of the HBA table： 
drop hba coordinator all ("host all all 10.0.0.0 8 trust"); 
```
Parameter configuration for operating system
Turn off the firewall

```
# centos 6 
servcie iptables stop  
chkconfig iptables off 
 
# centos 7 
systemctl stop firewalld.service 
systemctl disable firewalld.service 
 
# suse12 
systemctl stop SuSEfirewall2.service 
systemctl disable SuSEfirewall2.service 
```
Shutting down numa and THP

```
# redhat/centos 6 
# vim /etc/grub.conf 
default=0 
timeout=5 
splashimage=(hd0,0)/grub/splash.xpm.gz 
hiddenmenu 
title Red Hat Enterprise Linux 6 (2.6.32-504.el6.x86_64) 
        root (hd0,0) 
        kernel /vmlinuz-2.6.32-504.el6.x86_64 ro root=/dev/mapper/vg_os-lv_os rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=vg_os/lv_os  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet numa=off transparent_hugepage=never 
# Shut down the service 
service tuned stop 
chkconfig tuned off 
service ktune stop 
chkconfig ktune off 
 
 
# redhat/centos 7 
grubby --update-kernel=ALL --args="numa=off "  # 该命令修改的是这个文件：/etc/grub2.cfg 
grub2-mkconfig  
 
#Shut down the service 
systemctl stop tuned 
systemctl disable tuned 
 
After this method is modified, the restart of the host takes effect. 
 
# After rebooting, verify the cmdline of GRUB： 
cat /proc/cmdline 
 
 
#Check NUMA
numactl --hardware 
The expected result is： 
available: 1 nodes (0) 
 
#Check the transparent_hugepage 
cat /sys/kernel/mm/transparent_hugepage/enabled 
The expected results are: 
always madvise [never] 
```
Configure sysctl.conf

```
cat >>  /etc/sysctl.conf << EOF 
# add for antdb 
kernel.shmmax=137438953472 137438953472 
kernel.shmall=53689091 
kernel.shmmni=4096 
kernel.msgmnb=4203520 
kernel.msgmax=65536 
kernel.msgmni=32768 
kernel.sem=501000 641280000 501000 12800 
 
fs.aio-max-nr=6553600 
fs.file-max=26289810 
net.core.rmem_default=8388608 
net.core.rmem_max=16777216 
net.core.wmem_default=8388608 
net.core.wmem_max=16777216 
net.core.netdev_max_backlog=262144 
net.core.somaxconn= 65535 
net.ipv4.tcp_rmem=8192 87380 16777216 
net.ipv4.tcp_wmem=8192 65536 16777216 
net.ipv4.tcp_max_syn_backlog=262144 
net.ipv4.tcp_keepalive_time=180 
net.ipv4.tcp_keepalive_intvl=10 
net.ipv4.tcp_keepalive_probes=3 
net.ipv4.tcp_fin_timeout=1 
net.ipv4.tcp_synack_retries=1 
net.ipv4.tcp_syn_retries=1 
net.ipv4.tcp_syncookies=1 
net.ipv4.tcp_timestamps=1 
net.ipv4.tcp_tw_recycle=1 
net.ipv4.tcp_tw_reuse=1 
net.ipv4.tcp_max_tw_buckets=256000 
net.ipv4.tcp_retries1=2 
net.ipv4.tcp_retries2=3 
vm.dirty_background_ratio=5 
vm.dirty_expire_centisecs=6000 
vm.dirty_writeback_centisecs=500 
vm.dirty_ratio=20 
vm.overcommit_memory=0 
vm.overcommit_ratio= 120 
vm.vfs_cache_pressure = 100 
vm.swappiness=10 
vm.drop_caches = 2 
vm.min_free_kbytes = 2048000 
vm.zone_reclaim_mode=0 
kernel.core_uses_pid=1 
kernel.core_pattern= /data/antdb/core/core-%e-%p-%s-%t 
fs.suid_dumpable=1 
kernel.sysrq=0 
EOF 
```
The path of kernel.core_patternneeds to be modified according to the actual environment information.
Execute sysctl -p to make above parameters effective
Operating system time zone check
Check whether all server operating system time zones are China time zones and whether the time is consistent between servers.

```
echo `date "+%Y-%m-%d %H:%M:%S %z"` 
```
atabase parameter setting
Cluster version
Parameter reference for adbmgr
•database parameters

```
cat  >> ${mgrdata}/postgresql.conf << EOF 
port = 18610 
listen_addresses = '*' 
log_directory = 'pg_log' 
log_destination ='csvlog' 
logging_collector = on 
log_min_messages = error 
max_wal_senders = 3 
hot_standby = on 
wal_level = replica 
EOF 
```
•HBA parameters

```
cat  >> ${mgrdata}/pg_hba.conf << EOF 
host    replication     all        10.0.0.0/8                 trust 
host    all             all          10.0.0.0/8               trust 
EOF 
```
Where 10.0.0.0/8 needs to be modified according to the actual situation.