Technology Encyclopedia Home >How to connect the basic network CVM to TencentDB for CTSDB?

How to connect the basic network CVM to TencentDB for CTSDB?

To connect a basic network Cloud Virtual Machine (CVM) to TencentDB for CTSDB, you typically follow these steps:

  1. Ensure Network Accessibility: Make sure that the CVM and TencentDB for CTSDB are in the same VPC (Virtual Private Cloud) or that there is proper routing configured between their respective VPCs if they are in different ones. This ensures that network traffic can flow between them.

  2. Configure Security Groups: Both the CVM and TencentDB for CTSDB are protected by security groups, which act as virtual firewalls. You need to configure the security groups to allow inbound traffic on the necessary ports (typically port 3306 for MySQL-compatible databases like CTSDB).

  3. Obtain Database Connection Information: From the TencentDB for CTSDB console, obtain the necessary connection details such as the host IP address, port number, database name, username, and password.

  4. Install Database Client Software: On your CVM, install the appropriate database client software if it's not already installed. For CTSDB, which is MySQL-compatible, you would typically install MySQL client software.

  5. Test the Connection: Use the database client software to test the connection to TencentDB for CTSDB using the connection details obtained earlier. This can typically be done using a command-line tool like mysql or a GUI tool like MySQL Workbench.

  6. Establish the Connection in Your Application: Once you've confirmed that the connection works, configure your application to connect to TencentDB for CTSDB using the same connection details.

Example:

  • Suppose you have a CVM instance running in the vpc-12345678 VPC and a TencentDB for CTSDB instance also in the same VPC.
  • You configure the security groups of both instances to allow inbound traffic on port 3306.
  • From the TencentDB for CTSDB console, you obtain the connection details: host IP 172.16.0.100, port 3306, database name mydatabase, username myuser, and password mypassword.
  • On your CVM, you install the MySQL client and test the connection using the command:
    mysql -h 172.16.0.100 -P 3306 -u myuser -p
    
  • After successfully connecting, you configure your application to use these details to connect to the database.

For more advanced networking configurations or if you need to connect across different VPCs, you might need to use VPN, Direct Connect, or other networking services provided by Tencent Cloud.