All Products
Search
Document Center

DBGateway FAQ

Last Updated: Aug 27, 2020

1. Overview and basic operations

(1) DBGateway directory structure

The DBGateway component is installed in the /opt/dbgateway directory. The directory structure is described as follows:

  1. dbgateway
  2. |-- bin
  3. | |-- dbgateway
  4. | \-- dbgateway-manager
  5. |-- conf
  6. | |-- dbgateway.conf
  7. | \-- server.crt
  8. \-- log
  9. |-- dbgateway.err
  10. |-- dbgateway.log
  11. \-- dbgateway_manager.log

The bin directory stores the following two elements: dbgateway and dbgateway-manager. The dbgateway element is the primary program. The dbgateway-manager element includes the script that is used to manage and maintain the dbgateway primary program.

The conf directory stores following two files: dbgateway.conf and server.crt. The dbgateway.conf file is the DBGateway configuration file, and the server.crt file includes the public key.

The log directory stores the following three files: dbgateway.err, dbgateway.log, and dbgateway_manager.log. The three files include DBGateway errors, DBGateway log records, and the log records about the DBGateway management script, respectively.

(2) View DBGateway log records

The path for a DBGateway log file is /opt/dbgateway/log/dbgateway.log.

Log files are stored in the TXT format. You can use tools such as the vim, tail, cat, and less commands to view the log files.

The customer service or technical support personnel of Database Autonomy Service (DAS) may require DBGateway log files for troubleshooting. In this scenario, you can run the following command to view the last 200 log records. You can copy and send these log records to the relevant personnel for troubleshooting.

  1. tail -n 200 /opt/dbgateway/log/dbgateway.log

(3) Check whether a DBGateway process is alive

Notes: You can perform the following steps to check whether a DBGateway process is alive. However, you cannot perform these steps to check whether the process is running as expected.

Step 1: In the left-side navigation pane of the DAS console, click DBGateways. On the page that appears, check whether the DBGateway is in the Normal state. If the DBGateway is in the Normal state, the DBGateway process is alive.

If the DBGateway is not in the Normal state, perform the following steps for troubleshooting:

Step 2: Run the following command on the server where the DBGateway is deployed:

  1. /opt/dbgateway/bin/dbgateway-manager -d status

The following command output is returned if the DBGateway process is alive.

  1. DBGateway is running.

The following command output is returned if the DBGateway process does not exist.

  1. DBGateway is dead.

(4) Restart a DBGateway

Methods of restarting a DBGateway vary based on the status of the DBGateway process. Therefore, before you restart a DBGateway, follow the steps in the preceding section to check the status of the DBGateway process.

  • Scenario 1: The DBGateway process exists.

    • Method 1: In the left-side navigation pane of the DAS console, click DBGateways. On the page that appears, find the target DBGateway, click Manage in the Actions column for the DBGateway, and then click Restart.
      restart-dbgateway

    • Method 2: Run the following command on the server where the DBGateway is deployed:

      1. /opt/dbgateway/bin/dbgateway-manager -d restart
  • Scenario 2: The DBGateway process does not exist.

    In this scenario, you cannot restart the DBGateway in the DAS console. You can restart the DBGateway only by running the following command on the server where the DBGateway is deployed:

    1. /opt/dbgateway/bin/dbgateway-manager -d restart

(5) Upgrade a DBGateway

In the left-side navigation pane of the DAS console, click DBGateways. On the page that appears, find the target DBGateway, click Manage in the Actions column for the DBGateway, and then click Upgrade.
upgrade-dbgateway

(6) Stop a DBGateway

  • Method 1:In the left-side navigation pane of the DAS console, click DBGateways. On the page that appears, find the target DBGateway, click Manage in the Actions column for the DBGateway, and then click Stop.
    stop-dbgateway

  • Method 2: Run the following command on the server where the DBGateway is deployed:

    1. /opt/dbgateway/bin/dbgateway-manager -d stop

(7) Delete a DBGateway

Notes:

  • After a DBGateway is deleted, all the DAS features of the database instances that are associated with the DBGateway become unavailable.

  • If a DBGateway is in the Normal state, you must stop the DBGateway before you delete it. To stop the DBGateway, follow the steps in the previous section.

Step 1: In the left-side navigation pane of the DAS console, click DBGateways. On the page that appears, find the target DBGateway, click Manage in the Actions column for the DBGateway, and then click Delete.delete-dbgateway

Step 2: Optional. Run the following command on the physical server where the DBGateway is deployed to delete the installation directory of the DBGateway.

  1. rm -rf /opt/dbgateway

2. Troubleshoot DBGateway deployment issues

You can find the DBGateway deployment command in the DAS console. In the following command, the virtual private cloud (VPC) ID and the token are used only as examples. You must replace the VPC ID and the token with the actual values.
setup-dbgateway

(1) The DBGateway deployment script cannot be downloaded

Troubleshoot the issue based on the following possible causes:

  • Check whether the wget command exists. If the following message appears, the wget command does not exist.

    1. wget command not found

    The wget command is a Linux command line utility that you can use to download files. If the wget command is not found, use the following method to install the wget command:

    1. sudo apt-get install wget

    You can also use the following method to install the wget command:

    1. yum -y install wget
  • Check whether the server is connected to Alibaba Cloud Object Storage Service (OSS).

    Obtain the OSS domain name, and run the following ping command to check whether the server is connected to Alibaba Cloud OSS. In the following example, the OSS domain name is hdm-dbgateway-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com. The OSS domain name that is included in the deployment command prevails.

    1. ping hdm-dbgateway-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com
    • If the domain name cannot be resolved, check whether your Alibaba Cloud DNS server settings are valid and whether the domain name resolution service runs as expected.

      1. ping: unknown host hdm-dbgateway-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com
      2. If the command output includes unknown host, the domain name cannot be resolved.
    • If you run the ping command, and you fail to receive a response a long period later, the network connection fails. In this scenario, perform the following checks:

      • Check whether the network configurations of the server are valid.

      • Check whether the network of the server is a virtual private cloud (VPC) or a classic network. In the Alibaba Cloud DNS console, select the correct network type for the server.

      • Check whether you have selected the correct region where the VPC is deployed. For example, you can select the China (Beijing), China (Shanghai), and China (Shenzhen) region in the console.

(2) DAS is not connected to the DBGateway as expected

In this example, the domain name of the DAS service is master-hdm-cn-hangzhou.aliyuncs.com. Replace the domain name with the actual one that is included in your deployment command. Perform the following steps for troubleshooting:

Run the following command on the server where the DBGateway is deployed:

  1. telnet master-hdm-cn-hangzhou.aliyuncs.com 80
  • The domain name cannot be resolved if the following command output is returned:

    Name or service not known

    In this scenario, check whether your Alibaba Cloud DNS server settings are valid and whether the domain name resolution service runs as expected.

  • A network connectivity failure occurs if the following command is returned:

    Trying xxx.xxx.xxx.xxx…

    In this scenario, perform the following checks:

    • Check whether the network configurations of the server are valid.

    • Check whether the network of the server is a VPC or a classic network. In the Alibaba Cloud DNS console, select the correct network type for the server.

    • Check whether you have selected the correct region where the VPC is deployed. For example, you can select the China (Beijing), China (Shanghai), and China (Shenzhen) region in the console.

  • The connection to the DAS master node is successful if the following command output is returned:

    1. Connected to master-hdm-cn-hangzhou.aliyuncs.com.
    2. Escape character is '^]'.

    If the DBGateway still fails to start, follow the instructions in the “View DBGateway log records” section for troubleshooting.

3. Troubleshoot DBGateway running exceptions

(1) Authentication failures or insufficient permissions

Troubleshoot the issues based on the following possible causes:

  • Check whether the authorized account and password have the following permissions:

    • MySQL

      1. SHOW DATABASES, PROCESS, REPLICATION SLAVE, REPLICATION CLIENT ON *.*
      2. SELECT ON mysql.*
      3. SELECT ON performance_schema.*
    • MongoDB

      1. Permissions of a database administrator and a root user
    • You do not need to create Redis accounts to use the Redis service. You need only to ensure that the password is valid to access the Redis service.

      Notes: To change the password that is used to access the Redis service, modify the requirepass setting in the configuration file and restart the Redis service. For more information, see Redis configuration.

  • Check whether the authorized account and the password are valid. We recommend that you initiate a remote connection request from the server and use the authorized account and the password to connect to the database instance.

  • Restart the DBGateway and check whether the database instance is connected as expected.

  • We recommend that you upgrade the DBGateway to the latest version.

(2) Connectivity failures

A connectivity failure occurs because the DBGateway cannot connect to a database instance. Troubleshoot the issues based on the following possible causes:

  • Check whether the database instance runs as expected.

    If the database instance is not running as expected, check whether the process of the database instance exists. The examples of the database instance include MySQL, MongoDB, and Redis instances.

  • Check whether the server where the DBGateway is deployed is connected to the database instance.

    To perform the check, run the following command:

    1. telnet <IP-address-or-domain-name-of-the-database instance> <Service-port-number-of-the-database instance>
    2. For example, you can run this command: telnet 192.168.100.1 3306.

    The following message indicates that the network connection is successful. In this scenario, follow the instructions in the “View DBGateway log records” section for troubleshooting.

    1. Connected to xxxxxx.
    2. Escape character is '^]'.

    If the following message does not appear: Connected to and Escape character is ‘^]’, a connectivity issue exists. In most cases, the possible causes include that networks are isolated among servers and that the route settings are invalid. Another possible cause is that the firewall or the database instance denies remote access requests.

(3) Monitoring exceptions

  • Check the status of a DBGateway process by performing the steps that are provided in the “Check whether a DBGateway process is alive” section.

  • Restart the DBGateway and check whether the monitoring feature recovers from the exceptions.

  • We recommend that you upgrade the DBGateway to the latest version.

(4) “Authorized. Verifying” (remains for more than 2 minutes)

In most cases, the status of the instance changes to Accessed within 1 to 2 minutes after the authorization is successful. If the message “Authorized. Verifying” remains for more than 2 minutes, perform the following steps:

  • Check the status of a DBGateway process by performing the steps that are provided in the “Check whether a DBGateway process is alive” section.

  • Restart the DBGateway and check whether the database instance is connected as expected.

  • We recommend that you upgrade the DBGateway to the latest version.