This topic describes how to access ECS-based self-managed databases from DAS.
Prerequisites
DAS can access the following types of ECS-based self-managed databases: MySQL, MongoDB,
Redis, and PostgreSQL.
Access methods
DAS can access other self-managed 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.
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 |
Capacity 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 auditing |
Not supported |
Not supported |
Supported |
Direct access
- Log on to the Database Autonomy Service console.
- In the Recommended Features section of the Overview page, click Access Instance.
- Click ECS-based User-created Database.
- Click Direct Access.
- Select the security group in the Add DAS access rules column and then click Save.
- Select the ECS instance and then click Next.
Note You must select one or more private networks of security groups.
- 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. |
Note 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 database, click Authorize.
- 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.
- Insufficient Permissions: The instance can be connected normally, but the permissions are insufficient. For
more information, see Permissions.
- Click Complete.
Centralized-mode access
- Log on to the Database Autonomy Service console.
- In the Recommended Features section of the Overview page, click Access Instance.
- Click ECS-based User-created Database.
- Click DBGateway in Centralized Mode.
- Click New deployment DAS Gateway (dbgateway) and scanning instance.
Note 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. The go directly to Step 8.
- Select the Region and ECS and then click Generate Deployment Command.
- Copy the deployment command. Log on to the ECS instance and run the command.
Note 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 DAS gateway is not deployed, you can
submit a ticket.
- In the Discover Instance step, scan and discover the database instance.
-
DAS can discover instances in the following ways:
- Select Automatic Scan:
- Enter the scanned CIDR block in the Scanned Address field.
- Enter the port range in the Port Range field.
- Click Scan.
- Select Enter Instances:
- Enter instances in the correct form in the Instances field.
- Click Scan.
The DAS gateway will automatically scan and discover the database instance.
-
Click Next.
- 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. |
Note 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 database, click Authorize.
- 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.
- Insufficient Permissions: The instance can be connected normally, but the permissions are insufficient. For
more information, see Permissions.
- Click Complete.
Host-mode access
- Log on to the Database Autonomy Service console.
- In the Recommended Features section of the Overview page, click Access Instance.
- Click ECS-based User-created Database.
- Click DBGateway in Centralized Mode.
- Select the Region and ECS and then click Generate Deployment Command.
- Copy the deployment command. Log on to the ECS instance and run the command.
Note If
successful
is returned in the command line window, the DAS gateway is deployed. If the DAS gateway
is not deployed, you can
submit a ticket. If
Current Status is
Normal, click
Next.
- 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. |
Note 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.
- 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.
- Insufficient Permissions: The instance can be connected normally, but the permissions are insufficient. For
more information, see Permissions.
- Click Complete.