hgdb HAC集群中,计划重新初始化数据库使用原集群配置的操作方法(二)

本文档详述了在hgdb高可用集群(HAC)中,如何重新初始化数据库并解决系统ID不匹配的问题。步骤包括停止服务、删除data目录、在节点1上initdb、启动服务以及使用hghactl命令进行集群清理和恢复。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

续“hgdb HAC集群中,计划重新初始化数据库使用原集群配置的操作方法(一)”

1、停止所有节点的hghac服务并删除所有节点的data目录
[root@db ~]# systemctl stop hghac-vip
[root@db hgdbdata]# rm -rf data/
[root@db2 ~]# systemctl stop hghac-vip
[root@db2 hgdbdata]# rm -rf data/
[root@db3 ~]# systemctl stop hghac-vip
[root@db3 hgdbdata]# rm -rf data/

2、在节点1 initdb,不在sm4选项
[root@db hgdbdata]# initdb -c "echo 12345678" -D  /db/hgdbdata/data
initdb: error: encryption cipher must be specified when encryption passphrase command is specified
[root@db hgdbdata]# initdb -D  /db/hgdbdata/data
The files belonging to this database system will be owned by user "root".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.
Data encryption is disabled.

Enter new sysdba password: 
Enter it again: 

Enter new syssao password: 
Enter it again: 

Enter new syssso password: 
Enter it again: 

creating directory /db/hgdbdata/data ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... PRC
creating configuration files ... ok
running bootstrap script ... 2022-04-02 14:05:55.364 CST [15293] LOG:  Switchover the SSHA Role. Current is NONE
ok
performing post-bootstrap initialization ... 2022-04-02 14:05:55.663 CST [15295] LOG:  Switchover the SSHA Role. Current is NONE
ok
syncing data to disk ... ok

initdb: warning: enabling "sm3" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    hg_sslkeygen.sh /db/hgdbdata/data
    pg_ctl -D /db/hgdbdata/data -l logfile start


[root@db hgdbdata]# hg_sslkeygen.sh /db/hgdbdata/data
Setting the ssl configuration to /db/hgdbdata/data
Generating RSA private key, 2048 bit long modulus
........................................................................................+++
.....+++
e is 65537 (0x10001)
[root@db hgdbdata]# 
[root@db hgdbdata]# cd data/
[root@db data]# ls
base     pg_commit_ts  pg_ident.conf  pg_notify  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值