续“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