This topic describes how to connect self-managed databases that are not deployed on Alibaba Cloud to Database Autonomy Service (DAS). The databases include self-managed databases that are deployed in data centers or on VMs provided by other cloud service providers and database instances that are provided by other cloud service providers.
Prerequisites
The following types of self-managed databases can be connected to DAS:- MySQL
- MongoDB
- PostgreSQL
- RedisNote Only self-managed 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 self-managed databases that are not deployed 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 database instances 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 database instances. All DAS features are supported in this mode, such as full request analysis, SQL response time, and security audit. For more information, see Features for three connection modes.
Important DAS gateways can be deployed only on Linux servers.

Features for three connection modes
Feature | Direct mode | Centralized mode | Host mode (recommended) |
---|---|---|---|
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 |
Request response time | Not supported | Not supported | Supported |
Security audit | Not supported | Not supported | Supported |
Connect databases to DAS in direct mode
- Log on to the DAS console.
- In the Recommended Features section of the Overview page, click Access Instance.
- Click Other On-premise and Cloud Databases.
- Click Method 1: Direct Access.
- Configure the parameters that are described in the following table.
Parameter Description Select Region Select the region that is nearest to the location of the database. Select Engine Select the type of the database. Database Account Enter an account used to log on to the database. Password Enter a password used to log on to the database. Instances Enter the names of instances in the Address:port
format. - Click Test Connection.
- If Verified is displayed in the Status column, click Save Instance. If Verified is not displayed, modify the parameters and then click Test Connection.
- If you want to add more databases, click Add More.
Connect databases to DAS in centralized mode
- Log on to the DAS console.
- In the Recommended Features section of the Overview page, click Access Instance.
- Click Other On-premise and Cloud Databases.
- Click Method 2: DBGateway in Centralized Mode.
- 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
- In the dialog box that appears, click Deploy a new DAS DBGateway and search for instances.
- 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 DBGateway 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 other cloud service providers that are connected over a leased line, select Proprietary Network (VPC/Leased Line).
- Network Domain: Configure this parameter to manage different environments such as self-managed databases deployed in data centers or those provided by other cloud service providers.
- Network Type: Configure this parameter based on the connection mode between the host on which DBGateway is deployed and Alibaba Cloud. Examples:
- 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, refer to Common issues about DBGateway to troubleshoot this issue. - If Normal is displayed in the Current Status column, click Next.
- Use existing DAS DBGateway to scan for new instances
- In the dialog box that appears, click Use existing DAS DBGateway to search for instances.
- In the Select DBGateway step, select the DAS gateway and then click Discover Instance.
- Deploy a new DAS DBGateway and search for instances
- In the Discover Instance step, scan and discover the database instances that you want to access.
- You can use one of the following methods to discover database instances:
- Select Automatic Scan
- Enter the CIDR block that you want to scan in the Scanned Address field.
- Enter the port range in the Port Range field.
- Click Scan.
- Select Enter Instances
- Enter instances in the correct format in the Instances field.
- Click Scan. Note The DAS gateway automatically scans and discovers the database instance.
- Select Automatic Scan
- Click Next Step.
- You can use one of the following methods to discover database instances:
- Configure the parameters that are described in the following table.
Parameter Description Select Engine Select the type of the database. Database Account Enter an account used to log on to the database. Password Enter a password used to log on to the database. IP Address Select the IP address of the database server. NoteThe 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.
- 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 instance downtime occur.
- Authentication Failed: The database account or password is incorrect.
- Insufficient Permissions: The instance can be connected, but the permissions are insufficient. For more information, see Permissions.
- Click OK.
Connect databases to DAS in host mode
- Log on to the DAS console.
- In the Recommended Features section of the Overview page, click Access Instance.
- Click Other On-premise and Cloud Databases.
- Click Method 3: DBGateway in Host Mode.
- 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 DBGateway 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 other cloud service providers that are connected over a leased line, select Proprietary Network (VPC/Leased Line).
- Network Domain: Configure this parameter to manage different environments such as self-managed databases deployed in data centers or those provided by other cloud service providers.
- Network Type: Configure this parameter based on the connection mode between the host on which DBGateway is deployed and Alibaba Cloud. Examples:
- 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 Normal is displayed in the Current Status column, click Next. If the DAS gateway failed to be deployed, refer to Common issues about DBGateway to troubleshoot this issue. - Configure the parameters that are described in the following table.
Parameter Description Select Engine Select the type of the database. Database Account Enter an account used to log on to the database. Password Enter a password used to log on to the database. IP Address Select the IP address of the database server. NoteThe 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.
- 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 instance downtime occur.
- Authentication Failed: The database account or password is incorrect.
- Insufficient Permissions: The instance can be connected, but the permissions are insufficient. For more information, see Permissions.
- Click OK.