更新时间:2025-08-07 GMT+08:00
GaussDB集中式版为源任务配置方法
GaussDB集中式版为源任务配置方法有两种,修改配置文件、通过gs_guc修改。
修改配置文件操作步骤
- 登录GaussDB集中式版数据库所有节点,如果选择容灾同步场景,也需要登录到容灾实例上所有节点进行以下配置。
- 查询配置文件位置:
find / -name "pg_hba.conf" 或者 find / -name "gs_hba.conf"
- 打开pg_hba.conf或者gs_hba.conf,增加配置如下。
host all <user> 0.0.0.0/0 sha256
host replication <user> 0.0.0.0/0 sha256
- 在源数据库使用系统管理员用户执行以下语句,或重启数据库实例,使修改生效。
select pg_reload_conf();
通过gs_guc修改操作步骤
- 云上数据库,进入沙箱需执行以下命令;自建数据库,source gauss_env_file环境变量文件即可
登录数据库实例任一节点,切换至Ruby用户,su - Ruby
- 2.0(V500R002C00)以前版本
/usr/sbin/chroot /var/chroot /bin/bash source /etc/profile && source ~/.bashrc
- 2.0(V500R002C00)及以后版本
chroot /var/chroot source /etc/profile; source /home/Ruby/.bashrc ;source /home/Ruby/gauss_env_file
GaussDB实例,需要数据库oncall同事实施变更,如果选择容灾同步场景,也需要登录到容灾实例上进行配置。
- 2.0(V500R002C00)以前版本
- 1)普通连接
如果放开所有用户、ip普通连接到dn节点:
gs_guc reload -N all -I all -h "host all all 0.0.0.0/0 sha256"
如果放开指定<user>、<ip>普通连接到dn节点:
gs_guc reload -N all -I all -h "host all <user> <ip>/32 sha256"
2)逻辑复制连接
如果放开所有用户、ip复制连接到dn节点:
gs_guc reload -N all -I all -h "host replication all 0.0.0.0/0 sha256"
如果放开指定<user>、<ip>复制连接到dn节点:
gs_guc reload -N all -I all -h "host replication <user> <ip>/32 sha256"
父主题: GaussDB远程连接配置方法