Documentation de référence de cbt

Cbt est un outil permettant d'exécuter des interactions de base avec Cloud Bigtable.

Utilisation :

cbt [options] command [arguments]

Les commandes sont les suivantes :

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

Utilisez la commande "cbt help" pour en savoir plus sur une commande.

Vous disposez des options suivantes :

-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

Les fonctionnalités Alpha ne sont actuellement pas disponibles pour la plupart des clients Cloud Bigtable. Ces fonctionnalités peuvent faire l'objet de modifications susceptibles d'affecter la rétrocompatibilité. Elles ne sont pas recommandées pour une utilisation en production. Elles ne sont soumises à aucun contrat de niveau de service ni aucun règlement d'obsolescence.

Par commodité, les valeurs des indicateurs -project, -instance, -creds, -admin-endpoint et -data-endpoint peuvent être spécifiées dans ~/.cbtrc au format suivant :

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

Toutes les valeurs sont facultatives et seront remplacées par les indicateurs correspondants.

Compter les lignes dans une table

cbt count <table>

Créer une instance avec un cluster initial

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

Créer un cluster dans l'instance configurée

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

Créer une famille de colonnes

cbt createfamily <table> <family>

Créer une table

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

Mettre à jour un cluster dans l'instance configurée

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

Supprimer une instance

cbt deleteinstance <instance>

Supprimer un cluster de l'instance configurée

cbt deletecluster <cluster>

Supprimer toutes les cellules d'une colonne

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

Supprimer une famille de colonnes

cbt deletefamily <table> <family>

Supprimer une ligne

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

Supprimer une table

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

Lister les instances dans un projet

cbt listinstances

Lister les clusters dans une instance

cbt listclusters

Lire une seule ligne

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

Lister les tables et les familles de colonnes

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

Lire les lignes

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

Définir la valeur d'une cellule

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.

Définir la stratégie GC pour une famille de colonnes

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

Bloquer jusqu'à ce que toutes les écritures aient été répliquées sur tous les clusters

cbt waitforreplication <table>

  table The name of the table to create
cbt version

Créer un profil d'application pour une instance

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

Lire le profil d'application pour une instance

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

Afficher le profil d'application pour une instance

cbt listappprofile <instance-id>

Mettre à jour le profil d'application pour une instance

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

Supprimer le profil d'application pour une instance

cbt deleteappprofile <instance-id> <profile-id>