Configuring App Profiles

This page explains how to create and manage a Cloud Bigtable instance's application profiles, or app profiles. It also shows how to use a custom app profile to connect to Cloud Bigtable.

Before you read this page, you should understand what app profiles are and how they work. If you're using app profiles to configure replication, you should also be familiar with the overview of Cloud Bigtable replication, and you should review the examples of replication settings and decide what settings are best for your use case.

Creating a custom app profile

You can create many different custom app profiles for each instance. Use custom app profiles to control how each application, or each distinct function within an application, interacts with an instance. For example, you might use one app profile for a batch application to isolate its traffic to a single cluster, and you might use a different app profile to provide high availability for another application.

To create a custom app profile:

Console

  1. Open the list of Cloud Bigtable instances in the Cloud Console.

    Open the instance list

  2. Click the instance where you want to create the app profile.

  3. In the left pane, click Application profiles.

  4. Click Create application profile.

  5. Enter the application profile ID.

    The application profile ID is a permanent identifier for the app profile. Your application provides this ID when it connects to Cloud Bigtable.

  6. Enter a description of the app profile.

  7. Under Cluster routing, select a cluster ID to use single-cluster routing or Any cluster to use multi-cluster routing. Learn more.

  8. Under Single-row transactions, select the Allow single-row transactions checkbox if you need to enable single-row transactions. Learn more.

    To enable single-row transactions, you must use single-cluster routing.

  9. Click Create to create the app profile.

  10. Update your application's code for connecting to Cloud Bigtable so that it uses the new app profile.

gcloud

  1. If you don't know the instance ID, use the bigtable instances list command to view a list of your project's instances:

    gcloud bigtable instances list
    
  2. Use the bigtable app-profiles create command to create an app profile:

    gcloud bigtable app-profiles create APP_PROFILE_ID \
        --instance=INSTANCE_ID \
        [--description=DESCRIPTION] \
        [--force] \
        [--route-any] \
        [--route-to=CLUSTER_ID] \
        [--transactional-writes]
    

    Provide the following values:

    • APP_PROFILE_ID: The permanent identifier for the app profile.
    • INSTANCE_ID: The permanent identifier for the instance.

    The command accepts the following optional flags:

    • --description=DESCRIPTION: A detailed description of the app profile.
    • --force: Ignore warnings about potential issues and conflicts with other app profiles.
    • --route-any: Enable multi-cluster routing to route requests to any available cluster.

      You cannot combine this flag with the --route-to or --transactional-writes flags.

    • --route-to=CLUSTER_ID: The cluster ID that all requests should be routed to. This flag enables single-cluster routing.

      You cannot combine this flag with the --route-any flag.

    • --transactional-writes: Enable single-row transactions in the app profile.

      You cannot combine this flag with the --route-any flag.

  3. Update your application's code for connecting to Cloud Bigtable so that it uses the new app profile.

Connecting with a custom app profile

After you create a custom app profile, you can update your code so that your application uses the custom app profile when it connects to Cloud Bigtable.

The following examples show how to specify an app profile when your app creates a Cloud Bigtable client and connects to an instance. Replace [APP_PROFILE_ID] with the appropriate value.

C#

var client = BigtableClient.Create(appProfileId: "[APP_PROFILE_ID]");

Go

clientConf := bigtable.ClientConfig{AppProfile:"[APP_PROFILE_ID]"}
client, err = bigtable.NewClientWithConfig(ctx, project, instance, clientConf)

HappyBase

The HappyBase client library does not support custom app profiles. This client library always uses the default app profile.

HBase Java

// If using BigtableOptions directly:
optionsBuilder.setAppProfileId("[APP_PROFILE_ID]");

// If using BigtableOptionsFactory:
configuration.set(BigtableOptionsFactory.APP_PROFILE_ID_KEY, "[APP_PROFILE_ID]");

// If using system properties, set "google.bigtable.app_profile.id" to
// "[APP_PROFILE_ID]"

// If using CloudBigtableIO for Cloud Dataflow:
config.withConfiguration(BigtableOptionsFactory.APP_PROFILE_ID_KEY,
                         "[APP_PROFILE_ID]");

Node.js

const bigtable = new Bigtable({appProfileId: '[APP_PROFILE_ID]'});

Python

from google.cloud import bigtable

client = bigtable.Client(project=project_id)
instance = client.instance(instance_id)
table = bigtable.table.Table(table_id, instance, '[APP_PROFILE_ID]')

Updating an app profile

You can view an instance's app profiles and update their settings at any time. Cloud Bigtable warns you about any updates that might cause unexpected changes in behavior.

To view or update an existing app profile:

Console

  1. Open the list of Cloud Bigtable instances in the Cloud Console.

    Open the instance list

  2. In the Application profiles column, click the app profile you want to view or update.

    If you don't see the app profile you want to edit, you can view a complete list by clicking the name of the instance, then clicking Application profiles in the left pane.

  3. Update the settings as needed, then click Save, or click Cancel to exit without saving.

gcloud

  1. If you don't know the instance ID, use the bigtable instances list command to view a list of your project's instances:

    gcloud bigtable instances list
    
  2. If you don't know the app profile's ID, use the bigtable app-profiles list command to view a list of the instance's app profiles:

    gcloud bigtable app-profiles list --instance=INSTANCE_ID
    

    Replace INSTANCE_ID with the permanent identifier for the instance.

  3. (Optional) Use the bigtable app-profiles describe command to view the app profile's settings:

    gcloud bigtable app-profiles describe APP_PROFILE_ID \
        --instance=INSTANCE_ID
    

    Provide the following values:

    • APP_PROFILE_ID: The permanent identifier for the app profile.
    • INSTANCE_ID: The permanent identifier for the instance.
  4. Use the bigtable app-profiles update command to update the app profile's settings:

    gcloud bigtable app-profiles update APP_PROFILE_ID \
        --instance=INSTANCE_ID \
        [--description=DESCRIPTION] \
        [--force] \
        [--route-any] \
        [--route-to=CLUSTER_ID] \
        [--transactional-writes]
    

    Provide the following values:

    • APP_PROFILE_ID: The permanent identifier for the app profile.
    • INSTANCE_ID: The permanent identifier for the instance.

    The command accepts the following optional flags:

    • --description=DESCRIPTION: A detailed description of the app profile.
    • --force: Ignore warnings about potential issues and conflicts with other app profiles.
    • --route-any: Enable multi-cluster routing to route requests to any available cluster.

      You cannot combine this flag with the --route-to or --transactional-writes flags.

    • --route-to=CLUSTER_ID: The cluster ID that all requests should be routed to. This flag enables single-cluster routing.

      You cannot combine this flag with the --route-any flag.

    • --transactional-writes: Enable single-row transactions in the app profile.

      You cannot combine this flag with the --route-any flag.

Deleting a custom app profile

You can delete an instance's custom app profiles, but not the default app profile.

To delete a custom app profile:

Console

  1. Open the list of Cloud Bigtable instances in the Cloud Console.

    Open the instance list

  2. Click the instance that contains the app profile you want to delete.

  3. In the left pane, click Application profiles.

  4. Open the more actions menu , then click Delete application profile. A confirmation dialog appears.

  5. Follow the instructions in the confirmation dialog, then click Delete.

gcloud

  1. If you don't know the instance ID, use the bigtable instances list command to view a list of your project's instances:

    gcloud bigtable instances list
    
  2. If you don't know the app profile's ID, use the bigtable app-profiles list command to view a list of the instance's app profiles:

    gcloud bigtable app-profiles list --instance=INSTANCE_ID
    

    Replace INSTANCE_ID with the permanent identifier for the instance.

  3. Use the bigtable app-profiles delete command to delete the app profile:

    gcloud bigtable app-profiles delete APP_PROFILE_ID \
        --instance=INSTANCE_ID \
        [--force]
    

    Provide the following values:

    • APP_PROFILE_ID: The permanent identifier for the app profile.
    • INSTANCE_ID: The permanent identifier for the instance.

    The command accepts the following optional flag:

    --force: Ignore warnings about potential issues and conflicts with other app profiles.

Oliko tästä sivusta apua? Kerro mielipiteesi

Palautteen aihe:

Tämä sivu
Cloud Bigtable Documentation