This topic describes the network connection configurations for OceanBase Cloud Flagship Edition instances and how to enable applications to connect to the database.
Prerequisites
- You have registered an OceanBase Cloud account and created a cluster instance and tenant. For details, see Create a cluster instance and Create a tenant.
- You have identified the application deployment location (local development machine, cloud-based ECS/VM, etc.) and the cloud provider, so that you can select an appropriate connection method.
Choose a connection method
Note
Verify that the client has a route to the database address and that the relevant firewalls and security groups allow TCP traffic on the database port.
Connection method |
Cloud provider |
Use case |
Access control requirements |
|---|---|---|---|
| Public connection | All | Local development, testing, or cross-cloud access. | Add the client’s public egress IP address to the tenant allowlist. For instructions, see Set allowlist groups. |
| Private connection | Alibaba Cloud | Access the database using an Alibaba Cloud private address. | Add the client IP address to the tenant allowlist. For Alibaba Cloud Marketplace purchases, you can also associate the security group of your application ECS instances with the tenant. For instructions, see Set allowlist groups. |
| Private Link | Alibaba Cloud | Access the database through Alibaba Cloud Private Link. | Allow inbound traffic from application clients to the database port in the endpoint security group. No tenant allowlist entry is required. For instructions, see Alibaba Cloud security group rules. |
| Huawei Cloud | Access the database through Huawei Cloud VPC Endpoint. | Allow inbound traffic from application clients to the database port in the endpoint security group. No tenant allowlist entry is required. For instructions, see Huawei Cloud security group rules. |
|
| AWS | Access the database through AWS Private Link. | Configure the endpoint security group to allow application clients to access the database port. For a one-part connection string, also add the client IP address to the tenant allowlist. For instructions, see AWS security group rules and Set allowlist groups. |
|
| Azure | Access the database through an Azure Private Link endpoint. | Add the client IP address to the tenant allowlist for a one-part connection string. A two-part connection string requires no additional tenant allowlist entry. For instructions, see Azure Private Link. |
|
| Google Cloud | Access the database through a Google Cloud Private Service Connect (PSC) endpoint. | Enter the Google Cloud project ID when creating the service and the PSC connection ID when binding the endpoint. Neither step requires configuring the tenant allowlist. For instructions, see Private Service Connect. |
|
| VPC peering | Huawei Cloud, AWS | Access the database through peered VPCs of the same cloud provider. | Add the client IP address or CIDR block of the peer VPC to the tenant allowlist and configure routing and security groups. For instructions, see Set allowlist groups. |
Port description
Compatibility mode |
Default port |
Description |
|---|---|---|
| MySQL Compatible | 3306 | Used by JDBC, the mysql and obclient command-line clients, and other tools. |
| Oracle Compatible | 1521 | Used by jdbc:oceanbase:// and obclient. |
| KV Compatible | 3307 | The port used to connect to a KV tenant. |
Note
The actual port is subject to the connection string obtained from the console. Different tenants may use different ports.
Connection account format
The page for obtaining a connection string in the console automatically generates a correctly formatted connection string based on the selected connection method. We recommend copying and using it directly. For more information, see Connect to OceanBase Cloud using OBClient.
Access the database through a public IP address. This is suitable for local development and debugging, quick testing, or scenarios requiring cross-cloud vendor access. For detailed operations, see Connect to a database using a public IP address.
Procedure |
Action |
Description |
|---|---|---|
| 1 | Apply for a public IP address | Apply for a public IP address for the target tenant in the OceanBase Cloud console. |
| 2 | Configure tenant allowlist | Add the client outbound IP address to the tenant's allowlist (the console supports "Add Current Browser IP Address"). |
| 3 | Configure SSL certificate | Download the CA certificate and configure it on the client. For more information, see SSL encryption. |
| 4 | Configure network outbound rules | Make sure that TCP outbound traffic from the client to the public endpoint and port is not blocked (see the description below). |
| 5 | Obtain the connection string and test the connection | Create a database and an account, copy the connection string, and test the connection using the client. |
Note
- Local development machine: Usually no additional configuration is required; if the connection times out, check whether the local firewall or company network allows outbound TCP (such as 3306, 1521).
- Cloud-hosted ECS instance or VM: You must configure the instance security group to allow outbound TCP traffic to the port of the OceanBase Cloud public endpoint. Alibaba Cloud users can refer to Security Group Rules.
Perform the following checks to confirm that the public network connection is successful.
Check item |
Requirements |
|---|---|
| Public endpoint | Created and displayed in the console. |
| Tenant allowlist | The client egress IP address has been added. |
| SSL certificate | The CA certificate has been downloaded and configured if SSL is required. |
| Network outbound rules | The local firewall or ECS/VM security group allows access. |
| Database connection | The connection string generated by the console has passed the connection test. |
Access the database through a cloud vendor's private network channel. This is suitable for production environments where traffic does not need to go over the public network. The specific operations vary by cloud vendor.
Alibaba Cloud
Alibaba Cloud instances support the original private network connection mode and Private Link. After Private Link is enabled for a UID, subsequent private connection addresses covered by this feature use Private Link. Existing private connection addresses are not migrated automatically.
Original private network connection mode
In the OceanBase Cloud console, enter your Alibaba Cloud primary account ID, VPC, and vSwitch to create a private connection address directly. You do not need to create a separate endpoint in the cloud provider's console.
Procedure |
Action |
Description |
|---|---|---|
| 1 | Create a private endpoint | In the OceanBase Cloud console, enter the Alibaba Cloud primary account ID, VPC, and VSwitch to create a private endpoint. |
| 2 | Configure access control | Configure the tenant allowlist as needed. |
| 3 | Configure security group outbound rules | The application ECS/VM is in the same VPC as the private IP address, and the security group allows TCP outbound traffic to the port of the private IP address. |
| 4 | Obtain the connection string and test the connection | After the private IP address is created, select the database and account, copy the connection string, and test the connection. |
Perform the following checks to confirm that the Alibaba Cloud private network connection is successful.
Check item |
Requirements |
|---|---|
| Private endpoint | Created in the OceanBase Cloud console and in the Available state. |
| Network location | The application ECS/VM is in the same region, VPC, and VSwitch as the private endpoint. |
| ECS/VM security group | Allows outbound TCP traffic to the private endpoint port. |
| Database connection | The connection test is successful. |
Alibaba Cloud Private Link
Create an endpoint service in OceanBase Cloud, then create an endpoint in the Alibaba Cloud console and enter its information in OceanBase Cloud. Configure the endpoint security group before connecting to the database. You do not need to add application client IP addresses to the OceanBase Cloud tenant allowlist.
Step |
Action |
Description |
|---|---|---|
| 1 | Check the proxy requirements | The proxy cluster must use architecture version 2.0, serve only one access endpoint of one tenant, and have no Pending Switch tag. |
| 2 | Create an endpoint service | Enter your Alibaba Cloud primary account ID in the OceanBase Cloud console, create the endpoint service, and obtain its service name. |
| 3 | Create an endpoint | In the Alibaba Cloud console, select the same region, your application VPC, and zones and vSwitches supported by the endpoint service. |
| 4 | Enter endpoint information | Enter the endpoint ID, domain name, and VPC ID in the OceanBase Cloud console to complete the connection. |
| 5 | Configure the security group | Add inbound rules to the endpoint security group to allow application clients to access the database connection port. |
| 6 | Obtain the connection string and verify the connection | Test the connection from the endpoint's VPC or an application environment with private network connectivity to that VPC. |
Notice
- While a database proxy cluster has both an original private connection address and a Private Link endpoint, you cannot change the proxy configuration or switch the database cluster deployment mode.
- You cannot change a tenant's primary zone while the tenant has both an original private connection address and a Private Link endpoint. Delete the original private connection address promptly after verification and application migration.
- For more information about creating a Private Link endpoint and migrating existing connections, see Connect using Alibaba Cloud Private Link.
AWS Private Link
First, create an endpoint service in OceanBase Cloud. Then, create an endpoint in the AWS console and enter the endpoint information in OceanBase Cloud. Finally, enable Private DNS and obtain the connection string. For detailed operations, see the corresponding subdocument.
Procedure |
Action |
Description |
|---|---|---|
| 1 | Create an endpoint service | Enter the AWS account ID in the OceanBase Cloud console to create an endpoint service. |
| 2 | Create an endpoint | Create an endpoint in the AWS console, associate it with the OceanBase Cloud service ID, and select a VPC and subnet. |
| 3 | Enter endpoint information | Enter the VPC endpoint ID in the OceanBase Cloud console. |
| 4 | Enable Private DNS | Enable Private DNS for the endpoint in the AWS console and confirm it in the OceanBase Cloud console. |
| 5 | Configure access control | Configure the endpoint security group to allow application clients to access the database port. If you use a one-part connection string, also add the client IP address to the tenant allowlist. |
| 6 | Configure security group outbound rules | The application's EC2 security group allows TCP outbound traffic to the endpoint port. |
| 7 | Obtain the connection string and test the connection | After the endpoint is available, obtain the connection string in the console and test the connection. |
Perform the following checks to confirm that the AWS private network connection is successful.
Check item |
Requirements |
|---|---|
| Endpoint service | Created in the OceanBase Cloud console and in the Available state. |
| Endpoint | Created in the AWS console and in the Available state. |
| Endpoint information | The VPC endpoint ID has been entered in OceanBase Cloud. |
| Private DNS | Enabled in the AWS console and confirmed in the OceanBase Cloud console. |
| Tenant allowlist (one-part connection strings only) | The client IP address is on the tenant allowlist. |
| Network location | The application EC2 instance is in the same region and VPC as the endpoint. |
| EC2 security group | Allows outbound TCP traffic to the endpoint port. |
| Database connection | The connection test is successful. |
Huawei Cloud VPC Endpoint
First, create an endpoint service in OceanBase Cloud. Then, create an endpoint in the Huawei Cloud console and enter the endpoint information in OceanBase Cloud. Finally, obtain the connection string. For detailed operations, see the corresponding subdocument.
Procedure |
Action |
Description |
|---|---|---|
| 1 | Create an endpoint service | Create an endpoint service on the network configuration page of the OB Cloud console. |
| 2 | Create an endpoint | Create an endpoint in the Huawei Cloud console and associate it with the OceanBase Cloud service ID. |
| 3 | Enter endpoint information | Enter the endpoint ID, IP address, and VPC ID in the OceanBase Cloud console. |
| 4 | Configure security group rules | The application ECS/VM security group must allow outbound TCP traffic to the endpoint IP address. The endpoint security group must also allow inbound traffic. |
| 5 | Obtain the connection string and test the connection | After the endpoint is available, obtain the connection string in the console and test the connection. |
Perform the following check to confirm that the private network connection is successful.
Check item |
Requirements |
|---|---|
| Endpoint service | Created in the OceanBase Cloud console and in the Available state. |
| Endpoint | Created in the Huawei Cloud console and in the Available state. |
| Endpoint information | The endpoint ID, IP address, and VPC ID have been entered in OceanBase Cloud. |
| Network location | The client ECS/VM and the endpoint are in the same region and VPC. |
| ECS/VM security group | Allows outbound TCP traffic to the endpoint IP address and port. |
| Endpoint security group | Allows inbound traffic from the IP address or IP range of the client ECS/VM. |
| Database connection | The connection test is successful. |
Related links:
Peering connections provided by the cloud vendor enable communication between VPCs within that cloud. Configure the peering connection in the OceanBase Cloud console rather than initiating it directly in the cloud vendor console. For detailed operations, see the corresponding subdocument.
Procedure |
Action |
Description |
|---|---|---|
| 1 | Create a peering connection in OceanBase Cloud | Fill in the customer VPC information on the network configuration page and create a peering connection. |
| 2 | Accept and configure routing on the cloud vendor side | Accept the peering connection request and add a route to the OceanBase Cloud IP range to the route table. |
| 3 | Configure tenant allowlist | Add the ECS/VM IP range of the customer's VPC to the tenant's allowlist. |
| 4 | Configure security group rules | Allow outbound and inbound TCP traffic to and from the peer VPC IP range and database ports. |
| 5 | Obtain the connection string and test the connection | After the peering connection is activated, obtain the connection string and test it. |
Perform the following check to confirm that the peering connection is successful.
Check item |
Requirements |
|---|---|
| Peering connection | Created in the OceanBase Cloud console, accepted by the cloud provider, and in the Connected state. |
| Route table | Configured with a destination in the OceanBase Cloud IP range. |
| Tenant allowlist | The ECS/VM IP range in the peer VPC has been added. |
| Security group | Allows TCP traffic to the peer VPC subnet and database port. |
| Database connection | The connection test is successful. |
Related links:
Connectivity verification and FAQ
After completing the network configuration, you can verify it as follows:
Port probing (optional): Execute
nc -zv <address> <port>ortelnet <address> <port>on the client to confirm that the TCP port is reachable. If the command is unavailable, skip this step and directly test with the database client.Database connection test: Use the connection string, account, and password generated by the console to connect. This is the most reliable verification method.
Symptom |
Possible causes |
Troubleshooting direction |
|---|---|---|
| Connection timeout | The allowlist is not configured, or the IP address is incorrect. | Confirm that the client egress IP has been added to the tenant's allowlist. |
| Connection timeout | The security group or firewall blocks the connection. | Check the ECS/VM security group outbound rules and the endpoint security group inbound rules. |
| Connection timeout | The private endpoint is not ready. | Confirm that the private endpoint is in the Available state in the OceanBase Cloud console. |
| Connection refused | The port or endpoint is incorrect. | Use the endpoint and port in the connection string generated by the console. |
| Access denied | Incorrect account format or password | Use the connection string generated by the console to confirm that the username format and password are correct. |
| SSL-related errors | No CA certificate is configured. | For public network connections, download and configure the CA certificate. For more information, see SSL encryption. |