在bigtable for prod环境中保存表脚本的最佳方式是什么



请告诉我在bigtable中为prod环境保存表脚本的最佳方式是什么。示例:就像在数据库中一样,我们可以保存.sql脚本并使用shell文件执行它。

有没有类似的方法可以将表ddl脚本保存在bigtable中。

您可以使用CBT命令行工具创建和定义表,一旦确定了模式,就可以将这些命令放入shell文件中。当前无法导出架构。

CBT工具可以创建表、列族、垃圾收集、行拆分,因此它应该为您提供所需的所有功能。以下是文档中的一个示例https://cloud.google.com/bigtable/docs/cbt-reference#create_a_table

cbt createtable <table-id> [families=<family>:gcpolicy=<gcpolicy-
expression>,...]
[splits=<split-row-key-1>,<split-row-key-2>,...]
families     Column families and their associated garbage collection (gc) policies.
Put gc policies in quotes when they include shell operators && and ||. For gcpolicy,
see "setgcpolicy".
splits       Row key(s) where the table should initially be split
Example: cbt createtable mobile-time-series "families=stats_summary:maxage=10d||maxversions=1,stats_detail:maxage=10d||maxversions=1" splits=tablet,phone

最新更新