【问题标题】:what is the optimal way to save table script in bigtable for prod environment在生产环境的 bigtable 中保存表脚本的最佳方法是什么
【发布时间】:2021-01-06 18:31:50
【问题描述】:

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

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

【问题讨论】:

    标签: google-cloud-bigtable


    【解决方案1】:

    您可以使用 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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多