由于包含着有价值的数据,Gbase 8c数据库需要定期备份。
备份
1.对集群每个cn和dn配置日志归档,命令如下:
gha_ctl configure wal_archive datanode hg_name dn_name 'ssh user@remote "flock -x path archive_wal dn_host dir/%p path %f"' -l dcslist -c cluster
gha_ctl configure wal_archive coordinator cn_name 'ssh user@remote "flock -x path archive_wal cn_host dir/%p path %f"' -l dcslist -c cluster
2.备份topo、dcs、gtm、cn、及各个高可用组:
命令:
gha_ctl backup xxx host path -l dcslist -c cluster
举例:
gha_ctl backup topo host path/topo.json -l dcslist -c cluster
gha_ctl backup dcs host path -l dcslist -c cluseter
gha_ctl backup gtm host path -l dcslist -c cluseter
gha_ctl backup coordinator host path tbs_path -l dcslist -c cluster
gha_ctl backup datanode group host path tbs_path -l dcslist -c cluster
恢复
1.停止新集群;
2.备份新集群topo信息;
gha_ctl backup topo host path/topo.json -l dcslist -c cluster
3.还原dcs、topo、gtm、各个高可用组、cn;
命令:
gha_ctl restore xxx host path -l dcslist -c cluster
举例:
gha_ctl restore dcs host path -l dcslist -c cluster
gha_ctl restore topo host path/topo.json -l dcslist -c cluster
gha_ctl restore gtm host path -l dcslist -c cluster
gha_ctl restore datanode hg host path tbs_path wal_host wal_path target_type target_info -l dcslist -c cluster
gha_ctl restore coordinator host path tbs_path wal_host wal_path target_type target_info -l dcslist -c cluster
4.还原过程,只会还原第一个gtm、cn及每个高可用组的第一个dn。其他节点,检测到上述节点变为running后,直接start就行了