Best Practices
Using NLB to Mount Service Nodes of Cross-Region VPC
NLB(Network Load Balancer) supports cross-region mounting. This document guides you on how to use NLB and UGN (Universal Gateway Network) together, enabling NLB to forward requests to servers in other regions.
Prerequisites
- You have created a private network VPC1 in the Guangzhou region and VPC2 in Shanghai II.
- You have created an NLB instance in VPC1.
- You have created a Uhost instance in VPC2 and deployed services.
Configuration Process
-
Create UGN Instance
- Log into the Universal Gateway Network console.
- Click on creating UGN Instance.
- Enter the UGN instance name, and add the already created VPC1 and VPC2 to the current instance.
- Enter the newly created UGN instance page, select the Bandwidth Package tab;
- Purchase a bandwidth package from Guangzhou to Shanghai II.
-
Add Listener
- In the top navigation bar, select the region where the NLB instance was created.
- Choose one of the following methods to open the listener configuration.
- On the Instance List page, click Listener Management in the Operation column of the target instance.
- On the Instance List page, click on the target instance ID or details. In the Listener Management tab, click Add Listener.
- On the Create Listener page, complete the following configuration, then click Confirm.
Configuration | Explanation |
---|---|
Protocol | Select the protocol type for the listener, for this example, TCP is selected |
Port | Enter the listener port that is used to receive requests and forward them to the backend server, the port range is from 1 to 65535. In the same NLB instance, port numbers can’t be repeated, for this example, port 80 is chosen. |
Load Balancing Algorithm | Select a load balancing scheduling algorithm, for this example, the round-robin algorithm is chosen which distributes user requests evenly to backend servers. |
Session Persistence | Choose whether to enable or disable session persistence. By default, NLB will distribute each client request to a different backend server. when you enable session persistence, it allows requests from the same client to be forwarded to the same backend server, which allows backend servers to maintain state information and provide a consistent experience for the client. |
Node Health Check | Select the way of node health check, for this example, port check is selected, using the port of the backend server to perform the health check. |
Listener Name | Enter the listener name. |
Comments | Enter the comment information of the listener. |
-
Add Service Node
-
Enter the Listener Management tab, click Add Node.
-
Complete the following configuration.
-
Configuration | Explanation |
---|---|
Resource Type | Select the type of internal IP resources |
Region | Select the Shanghai region |
VPC | Select VPC2 created in Shanghai region |
Listening Port | 80 |
Resources | Enter the internal IP address of the Uhost instance created in VPC2 |
-
Test Connectivity
- Access the external IP address of the NLB;
- Check if the service deployed in Uhost in Shanghai can be accessed;
Notes
- The backend servers of cross-regional NLB mounting only support IP types.
- VPC1 and VPC2 need to join the same Universal Gateway Network.
- Scenarios with circular forwarding paths are not supported. If a loop is detected, to avoid exhausting network resources, NLB will migrate such instances, while no longer guaranteeing the availability of loop instances.