cbt 參考資料

Cbt 是用於與 Cloud Bigtable 進行基本互動的工具。

用法:

cbt [options] command [arguments]

指令包括:

count                     Count rows in a table
createinstance            Create an instance with an initial cluster
createcluster             Create a cluster in the configured instance
createfamily              Create a column family
createtable               Create a table
updatecluster             Update a cluster in the configured instance
deleteinstance            Delete an instance
deletecluster             Delete a cluster from the configured instance
deletecolumn              Delete all cells in a column
deletefamily              Delete a column family
deleterow                 Delete a row
deletetable               Delete a table
doc                       Print godoc-suitable documentation for cbt
help                      Print help text
listinstances             List instances in a project
listclusters              List clusters in an instance
lookup                    Read from a single row
ls                        List tables and column families
mddoc                     Print documentation for cbt in Markdown format
read                      Read rows
set                       Set value of a cell
setgcpolicy               Set the GC policy for a column family
waitforreplication        Block until all the completed writes have been replicated to all the clusters
version                   Print the current cbt version
createappprofile          Creates app profile for an instance
getappprofile             Reads app profile for an instance
listappprofile            Lists app profile for an instance
updateappprofile          Updates app profile for an instance
deleteappprofile          Deletes app profile for an instance

使用「cbt help」可取得關於指令的詳細資訊。

選項包括:

-project string
    project ID, if unset uses gcloud configured project
-instance string
    Cloud Bigtable instance
-creds string
    if set, use application credentials in this file

Alpha 測試版功能目前不提供給大部分的 Cloud Bigtable 客戶使用。這些功能可能會以回溯不相容的方式變更,因此不建議用於實際工作環境。且不適用於任何服務水準協議或廢止政策。

為方便理解,可能會使用如下格式,在 ~/.cbtrc 中指定 -project、-instance、-creds、-admin-endpoint 和 -data-endpoint 標記的值:

project = my-project-123
instance = my-instance
creds = path-to-account-key.json
admin-endpoint = hostname:port
data-endpoint = hostname:port

這些全是選用值,都可以透過標記加以覆寫。

計數資料表中的資料列

cbt count <table>

建立具有初始叢集的執行個體

cbt createinstance <instance-id> <display-name> <cluster-id> <zone> <num-nodes> <storage type>
  instance-id                   Permanent, unique id for the instance
  display-name              Description of the instance
  cluster-id                        Permanent, unique id for the cluster in the instance
  zone                              The zone in which to create the cluster
  num-nodes                 The number of nodes to create
  storage-type                  SSD or HDD

在已設定的執行個體中建立叢集

cbt createcluster <cluster-id> <zone> <num-nodes> <storage type>
  cluster-id        Permanent, unique id for the cluster in the instance
  zone                The zone in which to create the cluster
  num-nodes   The number of nodes to create
  storage-type  SSD or HDD

建立資料欄系列

cbt createfamily <table> <family>

建立資料表

cbt createtable <table> [families=family[:(maxage=<d> | maxversions=<n>)],...] [splits=split,...]
  families: Column families and their associated GC policies. See "setgcpolicy".
                     Example: families=family1:maxage=1w,family2:maxversions=1
  splits:   Row key to be used to initially split the table

在已設定的執行個體中更新叢集

cbt updatecluster <cluster-id> [num-nodes=num-nodes]
  cluster-id        Permanent, unique id for the cluster in the instance
  num-nodes     The number of nodes to update to

刪除執行個體

cbt deleteinstance <instance>

從已設定的執行個體中刪除叢集

cbt deletecluster <cluster>

刪除資料欄中的所有儲存格

cbt deletecolumn <table> <row> <family> <column> [app-profile=<app profile id>]
  app-profile=<app profile id>      The app profile id to use for the request

刪除資料欄系列

cbt deletefamily <table> <family>

刪除資料列

cbt deleterow <table> <row> [app-profile=<app profile id>]
  app-profile=<app profile id>      The app profile id to use for the request

刪除資料表

cbt deletetable <table>
cbt doc
cbt help [command]

列出專案中的執行個體

cbt listinstances

列出執行個體中的叢集

cbt listclusters

讀取單一資料列

cbt lookup <table> <row> [columns=[family]:[qualifier],...] [cells-per-column=<n>] [app-profile=<app profile id>]
  columns=[family]:[qualifier],...  Read only these columns, comma-separated
  cells-per-column=<n>          Read only this many cells per column
  app-profile=<app profile id>      The app profile id to use for the request

列出資料表和資料欄系列

cbt ls          List tables
cbt ls <table>      List column families in <table>
cbt mddoc

讀取資料列

cbt read <table> [start=<row>] [end=<row>] [prefix=<prefix>] [regex=<regex>] [columns=[family]:[qualifier],...] [count=<n>] [cells-per-column=<n>] [app-profile=<app profile id>]
  start=<row>               Start reading at this row
  end=<row>             Stop reading before this row
  prefix=<prefix>           Read rows with this prefix
  regex=<regex>             Read rows with keys matching this regex
  columns=[family]:[qualifier],...  Read only these columns, comma-separated
  count=<n>             Read only this many rows
  cells-per-column=<n>          Read only this many cells per column
  app-profile=<app profile id>      The app profile id to use for the request

設定儲存格的值

cbt set <table> <row> [app-profile=<app profile id>] family:column=val[@ts] ...
  app-profile=<app profile id>      The app profile id to use for the request
  family:column=val[@ts] may be repeated to set multiple cells.

  ts is an optional integer timestamp.
  If it cannot be parsed, the `@ts` part will be
  interpreted as part of the value.

設定資料欄系列的 GC 政策

cbt setgcpolicy <table> <family> ( maxage=<d> | maxversions=<n> | never)

  maxage=<d>        Maximum timestamp age to preserve (e.g. "1h", "4d")
  maxversions=<n>   Maximum number of versions to preserve

封鎖直到所有完成的寫入作業都已複製到所有叢集為止

cbt waitforreplication <table>

  table The name of the table to create
cbt version

建立執行個體的應用程式設定檔

cbt createappprofile <instance-id> <profile-id> <description> <etag> <routing-policy>
[cluster-id=<cluster-id>] [allow-transactional-writes=<allow-transactional-writes>]
set multi_cluster_routing_use_any or single_cluster_routing as possible values for routing policy
provide cluster-id=clusterID and allow-transactional-writes=true or false in case of single_cluster_routing

讀取執行個體的應用程式設定檔

cbt getappprofile <instance-id> <profile-id>

列出執行個體的應用程式設定檔

cbt listappprofile <instance-id>

更新執行個體的應用程式設定檔

cbt updateappprofile  <instance-id> <profile-id> <description> <routing-policy>[cluster-id=<cluster-id>] [allow-transactional-writes=<allow-transactional-writes>]
set multi_cluster_routing_use_any or single_cluster_routing as possible values for routing policy
provide cluster-id=clusterID and allow-transactional-writes=true or false in case of single_cluster_routing

刪除執行個體的應用程式設定檔

cbt deleteappprofile <instance-id> <profile-id>
本頁內容對您是否有任何幫助?請提供意見:

傳送您對下列選項的寶貴意見...

這個網頁
Cloud Bigtable 說明文件