All Products
Search
Document Center

Access an DB instance on ECS

Last Updated: Jun 02, 2020

This topic describes how to access ECS-based user-created databases from DAS (formerly HDM).

Types of database engines

DAS can access the following types of ECS-based user-created databases: MySQL, MongoDB, Redis, and PostgreSQL.

Access methods

DAS can access other user-created databases in the following methods:

  • Direct access: No DAS gateway (DBGateway) is deployed. DAS actively accesses databases over the Internet. You can quickly access database instances after entering accounts and passwords. This method is suitable for scenarios where a few ECS instances are involved and you must specify security groups.

  • Centralized-mode access: DAS gateways are deployed on at least one server (we recommend that you use two of more servers for disaster recovery scenarios) and database instances are automatically discovered. This method is suitable for rapid access to VPC-type ECS instances and classic network-type ECS instances are not recommended.

  • Host-mode access: DAS gateways are deployed on every server and database instances are automatically discovered. In this method, all DAS features are available, such as full SQL analysis, SQL response time, and security auditing. For more information, see Features for three access methods.

    Access methods

Features for three access methods

The MySQL engine is used as an example.

Feature Direct access Centralized-mode access Host-mode access
Database monitoring metrics Supported Supported Supported
Real-time performance Supported Supported Supported
Real-time session Supported Supported Supported
Storage analysis Supported Supported Supported
SQL diagnosis Supported Supported Supported
Slow query request analysis Partially supported (only when slow-query logs are stored in tables) Partially supported (only when slow-query logs are stored in tables) Supported
Host monitoring metrics Not supported Not supported Supported
Full request analysis Not supported Not supported Supported
SQL response time Not supported Not supported Supported
Security audit Not supported Not supported Supported

Procedure

Direct access

  1. Log on to the DAS console.

  2. In the Recommended Features section of the Overview page, click Access Instance.

  3. Click ECS-based User-created Database.

  4. Click Direct Access.

  5. Select the target security group in the Add DAS access rules column and then click Save.

    You must select one or more private networks of security groups.

  6. Select the target ECS instance and then click Next.

  7. Configure the following parameters.

    Parameter Description
    Select Engine The type of the database. Valid values: MySQL, MongoDB, Redis, and PostgreSQL.
    Port The port for the database.
    Database Account The account used to log on to the database.
    Password The password used to log on to the database.

    If the database has an existing account with required permissions, you can enter the account and password and then click Authorize.If the database does not have an existing account with required permissions, you can enter the database account and password and then click Generate Authorization Command. After you copy and run the authorization command on the target database, click Authorize.

  8. Click Authorize.

    After you click Authorize, Accessed is displayed to indicate successful connection. The following common errors also may be displayed:

    • Unauthorized: No account or password is specified.
    • Connection Failed: indicates errors such as network failure or instance downtime.
    • Authentication Failed: indicates incorrect username or password.
  9. Click Complete.

Centralized-mode access

  1. Log on to the DAS console.

  2. In the Recommended Features section of the Overview page, click Access Instance.

  3. Click ECS-based User-created Database.

  4. Click DBGateway in Centralized Mode.

  5. Click New deployment DAS Gateway (dbgateway) and scanning instance.

    Note: If you have not deployed a DAS gateway in the corresponding VPC, click New deployment DAS Gateway (dbgateway) and scanning instance.If you have deployed a DAS gateway in the corresponding VPC, click Use existing DAS DBGateway to scan for new instances.

  6. Select the target Region and ECS and then click Generate Deployment Command.

  7. Copy the deployment command. Log on to the ECS instance and run the command.

    HDM_user_manual_18

    If successful is returned in the command line window, the DAS gateway is deployed and will be automatically discovered by DAS.If Current Status is Normal, click Next.If the deployment is not successful, you can submit a ticket at .

  8. In the Discover Instance step, scan and discover the target database instance.

    1. DAS can discover instances in the following ways:

      • Select Automatic Scan:
        1. Enter the scanned CIDR block in the Scanned Address field.
        2. Enter the port range in the Port Range field.
        3. Click Scan.
      • Select Enter Instances:
        1. Enter instances in the correct form in the Instances field.
        2. Click Scan.

      The DAS gateway will automatically scan and discover the target database instance.

    2. Click Next.

  9. Configure the following parameters.

    Parameter Description
    Select Engine The type of the database.
    Database Account The account used to log on to the database.
    Password The password used to log on to the database.
    IP Address The IP address of the database.

    If the database has an existing account with required permissions, you can enter the account and password and then click Authorize.If the database does not have an existing account with required permissions, you can enter the database account and password and then click Generate Authorization Command. After you copy and run the authorization command on the target database, click Authorize.

  10. Click Authorize.

    After you click Authorize, Accessed is displayed to indicate successful connection. The following common errors also may be displayed:

    • Unauthorized: No account or password is specified.
    • Connection Failed: indicates errors such as network failure or instance downtime.
    • Authentication Failed: indicates incorrect username or password.
  11. Click Complete.

Host-mode access

  1. Log on to the DAS console.

  2. In the Recommended Features section of the Overview page, click Access Instance.

  3. Click ECS-based User-created Database.

  4. Click DBGateway in Centralized Mode.

  5. Select the target Region and ECS and then click Generate Deployment Command.

  6. Copy the deployment command. Log on to the ECS instance and run the command.

    HDM_user_manual_18

    If successful is returned in the command line window, the DAS gateway is deployed and will be automatically discovered by DAS. If the deployment is not successful, you can submit a ticket at .If Current Status is Normal, click Next.

  7. Configure the following parameters.

    Parameter Description
    Select Engine The type of the database.
    Database Account The account used to log on to the database.
    Password The password used to log on to the database.
    IP Address The IP address of the database.

    If the database has an existing account with required permissions, you can enter the account and password and then click Authorize.If the database does not have an existing account with required permissions, you can enter the database account and password and then click Generate Authorization Command. After you copy and run the authorization command on the target database, click Authorize.

  8. Click Authorize.

    After you click Authorize, Accessed is displayed to indicate successful connection. The following common errors also may be displayed:

    • Unauthorized: No account or password is specified.
    • Connection Failed: indicates errors such as network failure or instance downtime.
    • Authentication Failed: indicates incorrect username or password.
  9. Click Complete.