Updated on 2023-11-21 GMT+08:00

Connecting to an Instance Using a Private IP Address

This section uses the Linux OS as an example to describe how to connect to a GeminiDB Influx instance over a private network.

Precautions

  • The DB instances must be in the same VPC and subnet as the ECS.
  • The ECS must be in a security group that has access to the instances.
    • If the instance is associated with the default security group, you do not need to configure security group rules.
    • If the instance is not associated with the default security group, check whether the security group rules allow the ECS to connect to the instance. For details, see Configuring Security Group Rules.

      If the security group rules allow the access from the ECS, the ECS can connect to the instance.

      If the security group rule does not allow the access from the ECS, add an inbound rule to the security group.

Prerequisites

  • An ECS has been created. The following uses a Linux ECS as an example. For details, see Purchasing an ECS in Getting Started with Elastic Cloud Server.
  • Download the InfluxDB client. The following uses the Linux 64-bit client as an example.

SSL Connection

  1. Log in to the ECS. For details, see Logging In to an ECS in Elastic Cloud Server Getting Started.
  2. Upload the InfluxDB client installation package to the ECS using file transfer tools like XFTP.
  3. Decompress the client tool package.

    tar -xzf influxdb-1.7.9-static_linux_amd64.tar.gz

  4. Connect to the DB instance in the directory where the influx tool is located.

    1. Run the following command to go to the InfluxDB directory:

      cd influxdb-1.7.9-1

    2. Connect to a GeminiDB Influx instance.
      • Use the default certificate for connection.

        ./influx -ssl -unsafeSsl -host <DB_HOST> -port <DB_PORT>

        Example:

        ./influx -ssl -unsafeSsl -host 192.xx.xx.xx -port 8635

      Table 1 Parameter description

      Parameter

      Description

      <DB_HOST>

      Specifies the private IP address of the node to be connected.

      To obtain this IP address, go to the Instances page, locate the instance whose node IP addresses you want to view, and click its name. The IP address can be found in the Private IP Address column at the Node Information area.

      If the instance you purchased has multiple nodes, select the private IP address of any node.

      <DB_PORT>

      The port of the DB instance to be connected. The default value is 8635 and cannot be changed.

      Click the target instance to go to the Basic Information page. In the Network Information area, you can find the database port.

    3. Run the following command for authentication:

      auth

      Enter the username and password as prompted.

      username:<DB_USER>

      password:<DB_PWD>

      Table 2 Parameter description

      Parameter

      Description

      <DB_USER>

      Username of the administrator account. The default value is rwuser.

      On the Instances page, click the target DB instance. In the DB Information area on the Basic Information page, you can find the administrator username.

      <DB_PWD>

      Administrator password

  5. After the identity verification is successful, run the following command:

    show databases

    If the following information is displayed, the connection is successful.

    name: databases
    name
    ----
    _internal

Non-SSL Connection

  1. Log in to the ECS. For details, see Logging In to an ECS in Getting Started with Elastic Cloud Server.
  2. Upload the InfluxDB client installation package to the ECS using file transfer tools like XFTP.
  3. Decompress the client tool package.

    tar -xzf influxdb-1.7.9-static_linux_amd64.tar.gz

  4. Connect to the DB instance in the directory where the influx tool is located.

    1. Run the following command to go to the InfluxDB directory:

      cd influxdb-1.7.9-1

    2. Connect to a GeminiDB Influx instance.

      ./influx -host <DB_HOST> -port <DB_PORT>

      Example:

      ./influx -host 192.xx.xx.xx -port 8635

      Table 3 Parameter description

      Parameter

      Description

      <DB_HOST>

      Specifies the private IP address of the node to be connected.

      To obtain this IP address, go to the Instances page, locate the instance whose node IP addresses you want to view, and click its name. The IP address can be found in the Private IP Address column at the Node Information area.

      If the instance you purchased has multiple nodes, select the private IP address of any node.

      <DB_PORT>

      The port of the DB instance to be connected. The default value is 8635 and cannot be changed.

      Click the target instance to go to the Basic Information page. In the Network Information area, you can find the database port.

    3. Run the following command for authentication:

      auth

      Enter the username and password as prompted.

      username:<DB_USER>

      password:<DB_PWD>

      Table 4 Parameter description

      Parameter

      Description

      <DB_USER>

      Username of the administrator account. The default value is rwuser.

      On the Instances page, click the target DB instance. In the DB Information area on the Basic Information page, you can find the administrator username.

      <DB_PWD>

      Administrator password

  5. After the identity verification is successful, run the following command:

    show databases

    If the following information is displayed, the connection is successful.

    name: databases
    name
    ----
    _internal