All Products
Search
Document Center

Database Autonomy Service:Connect databases that are not on Alibaba Cloud to DAS

Last Updated:Mar 05, 2024

This topic describes how to connect databases that are not on Alibaba Cloud to Database Autonomy Service (DAS). The databases include databases deployed in data centers, self-managed databases on VMs provided by third-party cloud service providers, and databases provided by third-party cloud service providers.

Prerequisites

The database that you want to connect to DAS is of one of the following types:

  • MySQL

  • MongoDB

  • PostgreSQL

  • Redis

    Note

    Only Redis databases that run Redis 6.0 or earlier versions can be connected to DAS.

Usage notes

DAS opens only port 80. Database gateways can access DAS only by using port 80. Data is encrypted and transmitted by using gRPC and Transport Layer Security (TLS). This ensures data transmission security.

Connection modes

You can connect databases that are not on Alibaba Cloud to DAS in one of the following modes:

  • Direct mode: No DAS gateways (DBGateways) are deployed. DAS accesses your database over the Internet. You need to only enter your database account and password. Only MySQL, MongoDB, and Redis databases can be accessed in this mode.

  • Centralized mode: A DAS gateway is deployed on at least one server to automatically discover databases by means of CIDR blocks. We recommend that you deploy DAS gateways on two or more servers for disaster recovery.

  • Host mode: A DAS gateway is deployed on every server to automatically discover databases. All DAS features are supported in this mode, such as full request analysis, SQL response time analysis, and security audit. For more information, see the Features for three connection modes section of this topic.

Important

DAS gateways can be deployed only on Linux servers.

Features for three connection modes

Feature

Direct mode

Centralized mode

(Recommend) Host mode

Database metric monitoring

Supported

Supported

Supported

Real-time performance monitoring

Supported

Supported

Supported

Real-time session monitoring

Supported

Supported

Supported

Storage analysis

Supported

Supported

Supported

Slow request analysis

Supported

Supported

Supported

Host metric monitoring

Not supported

Not supported

Supported

Request diagnostics

Not supported

Not supported

Supported

Full request analysis

Not supported

Not supported

Supported

SQL response time analysis

Not supported

Not supported

Supported

Security audit

Not supported

Not supported

Supported

Connect databases to DAS in direct mode

  1. Log on to the DAS console.

  2. Log on to the DAS console. In the Recommended Features section of the Overview page, click Access Instance.

  3. Click Other On-premise and Cloud Databases.

  4. Click Method 1: Direct Access.

  5. Configure the parameters that are described in the following table.

    Parameter

    Description

    Select Region

    The region that is nearest to the location of the database.

    Select Engine

    The type of the database.

    Database Account

    The account that is used to log on to the database.

    Password

    The password that is used to log on to the database.

    Instances

    The databases to be connected to DAS. You must specify the databases in the format of Address:port.

  6. Click Test Connection.

  7. If Verified is displayed in the Status column, click Save Instance. If Verified is not displayed, modify the parameters and then click Test Connection.

  8. If you want to add another database, click Add More.

Connect databases to DAS in centralized mode

  1. Log on to the DAS console.

  2. Log on to the DAS console. In the Recommended Features section of the Overview page, click Access Instance.

  3. Click Other On-premise and Cloud Databases.

  4. Click Method 2: DBGateway in Centralized Mode.

  5. In the dialog box that appears, select an access method.

    Note

    If you have not deployed a DAS gateway in the corresponding virtual private cloud (VPC), click Deploy a new DAS DBGateway and search for instances.. If you have deployed a DAS gateway in the corresponding VPC, click Use existing DAS DBGateway to scan for new instances .

    • Deploy a new DAS DBGateway and search for instances.

      1. Click Deploy a new DAS DBGateway and search for instances..

      2. Select a network type and then click Generate Deployment Command.

        Note
        • Network Type: Configure this parameter based on the connection mode between the host on which the DAS gateway is deployed and Alibaba Cloud. Examples:

          • For self-managed databases connected over the Internet, select Public Network (Classic Network).

          • For databases in data centers or databases from third-party cloud service providers that are connected over a leased line, select Proprietary Network (VPC/Leased Line).

        • Network Domain: Configure this parameter to manage databases from different environments, such as databases deployed in data centers and those provided by third-party cloud service providers.

      3. Copy the deployment command. Then, log on to the corresponding host and run the command.

        Note

        If successfully is returned, the DAS gateway is deployed. DAS can automatically discover the gateway. If the DAS gateway failed to be deployed, see the "Deployment issue troubleshooting" section of the Common issues about DBGateway topic to troubleshoot the issue.

      4. If Normal is displayed in the Current Status column, click Next.

    • Use existing DAS DBGateway to scan for new instances

      1. Click Use existing DAS DBGateway to scan for new instances .

      2. In the Select DBGateway step, select the DAS gateway that you want to use and then click Discover Instance.

  6. In the Discover Instance step, scan and discover the databases that you want to connect to DAS.

    1. You can use one of the following methods to discover databases:

      • Select Automatic Scan

        1. Enter the CIDR block that you want to scan in the Scanned Address field.

        2. Enter the port range in the Port Range field.

        3. Click Scan.

      • Select Enter Instances

        1. Enter databases in the correct format in the Instances field.

        2. Click Scan.

          Note

          The DAS gateway automatically scans and discovers the databases.

    2. Click Next Step.

  7. Configure the parameters that are described in the following table.

    Parameter

    Description

    Select Engine

    The type of the database.

    Database Account

    The account that is used to log on to the database.

    Password

    The password that is used to log on to the database.

    IP Address

    The IP address of the database server.

    Note

    The database account must be granted the required permissions. For more information, see Permissions.

    • If the database has an existing account that is granted the required permissions, you can enter the account and password and then click Authorize.

    • If the database does not have an existing account that is granted the required permissions, you can enter a new database account and password and then click Generate Authorization Command. After you copy and run the authorization command on the database, click Authorize.

  8. Click Authorize. If Accessed is displayed after you click Authorize, the connection is successful. The following common errors may also be displayed:

    • Unauthorized: No account or password is specified.

    • Connection Failed: Errors such as network failure or database downtime occur.

    • Authentication Failed: The database account or password is incorrect.

    • Insufficient Permissions: The database can be connected, but the permissions are insufficient. For more information, see Permissions.

  9. Click OK.

Connect databases to DAS in host mode

  1. Log on to the DAS console.

  2. Log on to the DAS console. In the Recommended Features section of the Overview page, click Access Instance.

  3. Click Other On-premise and Cloud Databases.

  4. Click Method 3: DBGateway in Host Mode.

  5. Select a network type and then click Generate Authorization Command.

    Note
    • Network Type: Configure this parameter based on the connection mode between the host on which the DAS gateway is deployed and Alibaba Cloud. Examples:

      • For self-managed databases connected over the Internet, select Public Network (Classic Network).

      • For databases in data centers or databases from third-party cloud service providers that are connected over a leased line, select Proprietary Network (VPC/Leased Line).

    • Network Domain: Configure this parameter to manage databases from different environments, such as databases deployed in data centers or those provided by third-party cloud service providers.

  6. Copy the deployment command. Log on to the corresponding device and run the command.

    Note

    If successful is returned, the DAS gateway is deployed. DAS can automatically discover the gateway. If Normal is displayed in the Current Status column, click Next. If the DAS gateway failed to be deployed, see the "Deployment issue troubleshooting" section of the Common issues about DBGateway topic to troubleshoot the issue.

  7. Configure the parameters that are described in the following table.

    Parameter

    Description

    Select Engine

    The type of the database.

    Database Account

    The account that is used to log on to the database.

    Password

    The password that is used to log on to the database.

    IP Address

    The IP address of the database server.

    Note

    The database account must be granted the required permissions. For more information, see Permissions.

    • If the database has an existing account that is granted the required permissions, you can enter the account and password and then click Authorize.

    • If the database does not have an existing account that is granted the required permissions, you can enter a new database account and password and then click Generate Authorization Command. After you copy and run the authorization command on the database, click Authorize.

  8. Click Authorize. If Accessed is displayed after you click Authorize, the connection is successful. The following common errors may also be displayed:

    • Unauthorized: No account or password is specified.

    • Connection Failed: Errors such as network failure or database downtime occur.

    • Authentication Failed: The database account or password is incorrect.

    • Insufficient Permissions: The database can be connected, but the permissions are insufficient. For more information, see Permissions.

  9. Click OK.

Related API operation

Operation

Description

AddHDMInstance

Connects a database instance to DAS.