Using ELB for Public Access to DCS
Overview
Currently, Huawei Cloud DCS Redis 4.0 and later cannot be bound with elastic IP addresses (EIPs) and cannot be accessed over public networks directly. This section describes how to access a single-node, master/standby, read/write splitting, or Proxy Cluster instance or a single node in a Redis Cluster instance over a public network by enabling IP as a Backend on a load balancer.
- Due to cluster node address translation, you cannot access a Redis Cluster as a whole. You can only access individual nodes in the cluster.
- Do not use public network access in the production environment. Client access exceptions caused by poor public network performance will not be included in the SLA.
The following figure shows the process for accessing DCS through ELB.
Interconnecting ELB with a DCS Instance
- Create a VPC or use an existing one.
- Buy a DCS Redis instance. Record the IP address and port number of the instance.
- Create a dedicated load balancer.
- A shared load balancer does not support cross-VPC backend servers. Therefore, it cannot be bound to a DCS instance.
- Select Network (TCP/UDP/TLS) for Load Balancing Type.
- To access the DCS instance over public networks, enable IP as a Backend when creating a dedicated load balancer.

- Add a TCP listener to the dedicated load balancer.
- On the Add Backend Server tab page, choose IP as Backend Servers > Add IP as Backend Server.
- Enter the IP address, port, and other parameters of your DCS instance.
- A Redis Cluster DCS instance contains multiple master/replica pairs. When configuring IP as a Backend, you can add the IP address and port of any master or replica node.
- If you enable Health Check, you do not need to manually configure the port. By default, the service port of the backend server will be used.
- Create a VPC peering connection. For the local VPC, select the VPC where your load balancer is located. For the peer VPC, select the VPC where your DCS instance is located.
Even if your load balancer and DCS instance are in the same VPC, a VPC peering connection is required. Use this VPC as the local VPC. For the peer VPC, select any other available VPC.
- Click the name of the VPC peering connection to go to its details page. Obtain Local VPC CIDR Block and Peer VPC CIDR Block.

- Click Add Route and configure local and peer routes for the VPC peering connection.
- Local route: Configure the peer VPC CIDR block in Destination on the Add Route dialog box.
- Peer route: Select Add a route for the other VPC and configure the local VPC CIDR block in Destination, and click OK.
- Perform a health check on the IP address of the DCS instance. If the health check result is Healthy, the added cross-VPC backend IP address can be used.
Accessing a DCS Instance on a Client
- Accessing a single node of a Redis Cluster instance on a client through ELB
- View the basic information of the load balancer created in 3.

- Buy an ECS, log in to it, and install the Redis client by referring to redis-cli.
- On the Redis client, connect to the instance using the EIP and port configured in 4. If you use the EIP and port of the load balancer, an error will be reported.

- View the basic information of the load balancer created in 3.
- Accessing a single-node, master/standby, read/write splitting, or Proxy Cluster instance on a client through ELB
- View the EIP of the load balancer created in 3 and the port of the listener.


- Buy an ECS, log in to it, and install the Redis client by referring to redis-cli.
- Use redis-cli to access the load balancer using its EIP and port number (which is 80).
- Write a key through ELB.
- Log in to the DCS console. On the Cache Manager page, choose More > Connect to Redis in the row that contains the DCS instance created in 2. Check whether the key written in 4 exists.

- View the EIP of the load balancer created in 3 and the port of the listener.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.



