All Products
Search
Document Center

Tablestore:Start the Tablestore CLI and configure access information

最終更新日:Dec 03, 2024

After you download the Tablestore CLI, you must start the CLI and configure the access information about Tablestore, such as the AccessKey pair and instance information.

Prerequisites

  • The Tablestore CLI is downloaded. For more information, see Download the Tablestore CLI.

  • An AccessKey pair is obtained. To use Tablestore, you must configure the AccessKey pair of your Alibaba Cloud account in the Tablestore CLI. For more information, see Create an AccessKey pair.

    Important

    You must use your Alibaba Cloud account to activate Tablestore. For security purposes, we recommend that you use Tablestore features as a RAM user. You can create a RAM user, attach the AliyunOTSFullAccess policy to the RAM user to grant the RAM user the permissions to manage Tablestore, and then create an AccessKey pair for the RAM user. For more information, see Create a RAM user, Grant permissions to a RAM user, and Create an AccessKey pair.

Procedure

  1. Decompress the Tablestore CLI package that you downloaded. Go to the root directory of the package and select a method that is used to start the Tablestore CLI based on your operating system.

    1. For Windows, double-click the ts.exe file.

    2. For Linux and macOS, run the ./ts command.

    Note

    If you do not have the required permissions to run the command in Linux or macOS, run the chmod 755 ts command to obtain the permissions and then run the command to start the Tablestore CLI.

    If the "ts" cannot be opened because Apple cannot check it for malicious software message appears in macOS, you must specify that the ts command is allowed to run in the Privacy & Security setting of macOS.

    The following information is displayed upon startup:

    # Welcome to use Command Line Tool for Aliyun Tablestore. Current Version is '2021-11-11'.
    #    _______      _      _              _
    #   |__   __|    | |    | |            | |
    #      | |  __ _ | |__  | |  ___   ___ | |_   ___  _ __    ___
    #      | | / _' || '_ \ | | / _ \ / __|| __| / _ \ | '__| / _ \
    #      | || (_| || |_) || ||  __/ \__ \| |_ | (_) || |   |  __/
    #      |_| \__,_||_.__/ |_| \___| |___/ \__| \___/ |_|    \___|
    #
    # Please visit our product website: https://www.aliyun.com/product/ots
    # You can also join our DingTalk Chat Group (ID: 11789671 or 23307953) to discuss and ask Tablestore related questions.
    #
    tablestore>
  1. Configure access information.

  • If you do not activate Tablestore or create an instance, you need to only configure the AccessKey pair.

    The following sample code provides an example of the configuration:

    config --id NTS********************** --key 7NR2****************************************
  • If you activate Tablestore or create instances, you can configure information about the instance that you want to access when you configure the AccessKey pair.

    The following sample code provides an example of the configuration:

    config --endpoint https://myinstance.cn-hangzhou.ots.aliyuncs.com --instance myinstance --id NTS********************** --key 7NR2****************************************
  • If you want to access Tablestore based on temporary authorization, you can obtain temporary access credentials from Security Token Service (STS) and use the temporary access credentials to configure the access information. The following sample code provides an example of the configuration:

    config --endpoint https://myinstance.cn-hangzhou.ots.aliyuncs.com --instance myinstance --id NTS********************** --key 7NR2**************************************** --token STS.6MC2****************************************

    The following table describes the configuration items.

    Configuration item

    Required

    Example

    Description

    --endpoint

    No

    https://myinstance.cn-hangzhou.ots.aliyuncs.com

    The endpoint that is used to access the Tablestore instance. For more information, see Endpoints. You must specify this configuration item if you want to access an existing instance.

    --instance

    No

    myinstance

    The name of the Tablestore instance that you want to access. You must specify this configuration item if you want to access an existing instance.

    --id

    Yes

    NTS**********************

    The AccessKey ID and AccessKey secret of your Alibaba Cloud account or RAM user.

    Note

    If you use the temporary access credentials obtained from STS to access Tablestore, set this configuration item to the STS-returned temporary AccessKey ID and AccessKey secret.

    --key

    Yes

    7NR2****************************************

    --token

    No

    STS.6MC2****************************************

    The temporary security token. You must specify this configuration item if you use the temporary access credentials obtained from STS to access Tablestore.

References

  • For information about RAM users and how to use RAM users to manage enterprise identities and permissions, see What is a RAM user?

  • For information about how to activate Tablestore, see Activate Tablestore.

  • For information about how to create a Tablestore instance, see Instance operations.

  • If you create Tablestore instances and configure information about the instance that you want to access in the Tablestore CLI, you can use Tablestore features based on the data storage model required by your applications.

    Data storage model

    Operation

    Wide Column model

    1. Create data tables and perform operations on the tables. For more information, see Operations on data tables.

    2. Use indexes to accelerate data queries. For more information, see Secondary index and Search index.

    3. Query data by executing SQL statements. For more information, see SQL query.

    4. If you want to migrate data or use compute engines to process data, use Tunnel Service. For more information, see Tunnel Service.

    TimeSeries model

    1. Create time series tables and perform operations on the tables. For more information, see Operations on a time series table.

    2. Query data by executing SQL statements. For more information, see SQL query.