ftr*_*ter 8 temporal-database mariadb
Generally, I am excited by the Temporal Database feature.
However, mysqldump is not supported for database export and restore.
I can find no resource in the documentation (linked to above) that indicates which methods of backup and restore are safe to use for this type of database. Google searches do not seem to help.
Does anyone have any insights into using these MariaDB temporal databases in production environments? Or more specifically, in using them in development environments, and then transferring the database to a production environment and still keeping the history of the database intact?
I understands this something of a dev-ops question, but it seems pretty central issue to how to work with and around this new feature. Does anyone have an insights in moving these databases around and relying on that process in-production? Just wondering how mature this technology is, given that this issue (which seems pretty central) is not covered in the documentation.
不幸的是,正如文档所述,虽然mysqldump会转储这些表,但不包括不可见的时间列 - 该工具只会备份表的当前状态。
幸运的是,这里有几个选择;
您可以使用mariadb-enterprise-backupor mariabackupwhich should support the new format of temportal data 并正确备份它(这些工具执行二进制备份而不是表转储);
https://mariadb.com/docs/usage/mariadb-enterprise-backup/#mariadb-enterprise-backup https://mariadb.com/kb/en/library/full-backup-and-restore-with-mariabackup/
不幸的是,我们发现该工具有些不可靠——尤其是在使用 MyRocks 存储引擎时。但是,它正在不断改进。
为了解决这个问题,在我们的生产服务器中,我们利用了从属复制——它在我们的所有节点上保持时间数据(和其他一切)完整。然后我们通过关闭从节点并直接复制数据库数据文件来进行二级备份。有关如何设置复制的更多信息,请参阅文档;
https://mariadb.com/kb/en/library/setting-up-replication/
因此,您可以通过复制设置数据库的开发副本,然后从那里复制数据。但是,在您的情况下,mariabackup也可以解决问题。
无论您如何操作,在设置复制或在系统之间移动这些文件时都要注意系统时钟。当时钟不同步(或系统位于不同的时区)时,您可能会遇到一些问题。还有一些关于这个主题的官方文档(和缓解措施);
https://mariadb.com/kb/en/library/temporal-data-tables/#use-in-replication-and-binary-logs
查看您的附加评论 - 我不知道有什么方法可以直接从 MariaDB 本身获取数据库的完整图像,因为它查看给定日期(包括时间数据)。我不认为这些信息的存储方式使这成为可能。但是,即使是这样,也有一种解决方法。您可以将上述方法与增量 rdiff 备份结合使用。然后你会做什么来解决它;
这将允许您获取数据库如何查看您选择的任何给定日期的精确副本。rdiff-backup 还完全支持 ssh,允许您执行以下操作:
rdiff-backup -r 10D host.net::/var/lib/mariadb /my/tmp/mariadb
这将获取 10 天前查看的那些备份文件的副本。