Skip to main content

Access MySQL Local Data Source through the NineData Gateway

NineData supports connecting to MySQL data sources through a gateway. This setup keeps MySQL in a private or dedicated network without exposing a public IP address.

Before you begin

  • The host where the gateway is deployed must be in the private network of the MySQL data source host and must be able to access the MySQL data source.
  • The host where the gateway is deployed must be able to access the public internet. If the host cannot access the public internet and is in a local network, deploy it through a proxy gateway. For more information, see Using Proxy Gateway.

Step 1: Deploy Gateway

Use this step when the gateway host can access the public internet. If the host can access only a local area network, use Proxy Gateway to deploy the gateway.

  1. Sign in to the NineData console on the host where you want to deploy the gateway.

  2. In the left navigation pane, select Datasource > Gateway.

  3. Select Create Gateway.

  4. Configure the following parameters.

    ParameterDescription
    NameEnter a gateway name that is easy to search and manage. Manual names are supported.
    EnvironmentSelect the operating system of the gateway host. NineData displays the corresponding gateway installation method. The following operating systems are supported:
    • Windows(x86_64)
    • Linux(x86_64)
    • macOS
    Access RegionSelect the region closest to the gateway host to reduce network latency.
    AdvancedNo configuration required.
  5. Follow the displayed installation method to install and configure the gateway on the deployment host. When the gateway connects successfully, the connection diagram changes from Waiting for the local gateway to launch... to The local gateway is connected successfully.

  6. Select Create Datasource, choose the data source to add in the selection window, and proceed to Step 2.

Step 2: Accessing the MySQL Data Source

  1. On the Create Datasource page, configure the parameters in the table.

    Parameter
    Description
    NameEnter the data source name. Use a meaningful name to identify and manage the data source later.
    ConnectionSelect Gateway.
    GatewaySelect the Gateway ID deployed in Step 1.
    HostEnter the access address and port number of the MySQL data source.
    • If MySQL is installed on the local machine: enter localhost or 127.0.0.1 on the left and the actual access port of MySQL on the right.
    • If MySQL is installed on another host in the private network: enter the private IP address of that host on the left and the actual access port of MySQL on the right.
    DB AccountEnter the login username of MySQL.
    DB PasswordEnter the login password of MySQL.
    Access RegionSelect the region closest to the host of your MySQL server to effectively reduce network latency.
    EnvironmentSelect the environment that matches the business purpose of the data source. The default provides the PROD and DEV environments, and also supports you to create a custom environment.
    Note: In organization mode, the database environment can also be applied to permission policy management. For example, the default Prod Admin role only supports access to data sources in the PROD environment and cannot access data sources in other environments. For more information, see Managing Roles.
    EncryptionConfigure SSL encryption for the data source (enabled by default). If the data source requires SSL encrypted connections, keep this option enabled or the connection fails.
    Use the switch to enable or disable encrypted transmission. Click > to the left of Encryption to expand the detailed settings.
    • SSL Options: Supports the following two methods.
      • If Available: Detects the server SSL status. If SSL is enabled, NineData connects over SSL first. Otherwise, it uses a non-SSL connection.
      • Require: Always connects to the data source over SSL. If the server does not support SSL or the SSL connection cannot be established, the connection fails.
    • SSL Cipher: Specifies the SSL-Cipher encryption algorithm.
    • Verify Server Certificate (SSL CA): If the MySQL server uses a self-signed CA certificate, upload the root certificate of that CA.
    • Verify Server Identity (SSL Identify): Verify the server name and IP address to ensure that the connection reaches the genuine MySQL server and helps prevent man-in-the-middle attacks.
    • Authenticate Client: If the MySQL server requires a client certificate, upload the client certificate and key. The MySQL server verifies the uploaded information to secure the connection.
    Note: In most cases, if the MySQL server supports SSL encrypted connections, select Require. No other configuration is required. NineData generates a key for the connection.
  2. After configuring the parameters, click Connection Test next to Create Datasource to verify that NineData can reach the data source. When Connection Successfully appears, click Create Datasource to add the data source. If the test fails, review the connection settings and run the test again.

Appendix: Using Proxy Gateway

If the gateway host cannot access the public internet, use a proxy gateway. Prepare two hosts in the same LAN that can reach each other:

  • Host A: A host that can access the public internet.
  • Host B: The host where you deploy the gateway.

Create a gateway on Host A to act as a proxy so Host B can connect to the NineData server through it.

Procedure

  1. Sign in to the NineData console on Host A.

  2. In the left navigation bar, select Datasource > Gateway.

  3. Select Create Gateway.

  4. Configure the following parameters.

    ParameterDescription
    NameEnter a gateway name that is easy to search and manage. Specify the gateway name manually.
    EnvironmentSelect the operating system of the gateway host. NineData displays the corresponding gateway installation method. The following operating systems are supported:
    • Windows (x86_64)
    • Linux (x86_64)
    • macOS
    Access RegionSelect the region closest to the gateway host to reduce network latency.
    AdvancedNo configuration is required.
  5. Follow the displayed installation method to install and configure the gateway on Host A. When the gateway connects successfully, the connection diagram changes from Waiting for the local gateway to launch... to The local gateway is connected successfully.

  6. Select Completed and back to List, and then select Create Gateway again.

  7. In Environment, select the operating system of Host B.

  8. Select Advanced, select Use Proxy, and open the dropdown under Proxy. Select the gateway created on Host A.

    tip

    NineData opens a proxy port on Host A for Host B. When the page shows <gateway_name> has enabled proxy function, port <port>, the proxy gateway is ready.

  9. Follow the displayed installation steps to install the gateway on Host B.

  10. Wait until the connection diagram changes from Waiting for the local gateway to launch... to The local gateway is connected successfully.

  11. Select Create Datasource to proceed to Step 2.