【问题标题】:How to connect to a bigtable emulator using cbt command line如何使用 cbt 命令行连接到 bigtable 模拟器
【发布时间】:2018-04-20 15:26:32
【问题描述】:

我运行了命令gcloud beta emulators bigtable start,但是当我运行命令cbt listinstances时,出现以下错误

Getting list of instances: rpc error: code = Unimplemented desc = unknown service google.bigtable.admin.v2.BigtableInstanceAdmin

如何使用cbt 命令连接我的本地bigtable 模拟器?

模拟器命令https://cloud.google.com/sdk/gcloud/reference/beta/emulators/bigtable/start

cbt 命令 https://cloud.google.com/bigtable/docs/go/cbt-reference

【问题讨论】:

    标签: command-line google-cloud-bigtable


    【解决方案1】:

    Cloud Bigtable 模拟器不支持任何实例级操作(针对实例的 CRUD)。您可以在连接到它时使用任意实例名称并从创建表开始。

    【讨论】:

      【解决方案2】:

      前缀cbt可以使用本地模拟器:

      cbt -project <PROJECT NAME> -instance localhost:8086
      

      希望这会有所帮助!

      【讨论】:

      • 这对我不起作用。它认为“localhost:8086”是要查找的真实 GCP 项目中的实例名称。当我运行 cbt -project test -instance localhost:8086 ls 时,我会收到类似 Getting list of tables: rpc error: code = InvalidArgument desc = When parsing 'projects/test/instances/localhost:8086' : Instance name expected in the form 'projects/&lt;project_id&gt;/instances/&lt;instance_id&gt;'. 的错误。
      • 搞定了。必须设置 BIGTABLE_EMULATOR_HOST 环境变量。看起来 googleapis 库和 cbt CLI 工具都使用该 env var 来控制它们是查看 GCP 还是连接到模拟器。模拟器出现在命名空间-project-instance,所以如果你用一对创建东西,你需要在执行读取命令时指定同一对才能在模拟器中看到它。
      猜你喜欢
      • 2016-11-29
      • 2018-08-07
      • 1970-01-01
      • 2019-05-12
      • 2022-01-13
      • 2020-12-25
      • 1970-01-01
      • 1970-01-01
      • 2021-03-02
      相关资源
      最近更新 更多