【发布时间】:2021-01-06 18:31:50
【问题描述】:
请告诉我在生产环境的 bigtable 中保存表脚本的最佳方法是什么。 示例:和数据库一样,我们可以保存 .sql 脚本并使用 shell 文件执行。
有没有类似的方法可以将table ddl脚本保存在bigtable中。
【问题讨论】:
请告诉我在生产环境的 bigtable 中保存表脚本的最佳方法是什么。 示例:和数据库一样,我们可以保存 .sql 脚本并使用 shell 文件执行。
有没有类似的方法可以将table 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
【讨论】: