Help Center/ Distributed Cache Service/ User Guide/ Accessing a DCS Redis Instance/ Configuring Redis Network Connections/ Enabling Public Access to Redis 4.0/5.0/6.0 and Obtaining the Access Addresses
Updated on 2024-10-17 GMT+08:00

Enabling Public Access to Redis 4.0/5.0/6.0 and Obtaining the Access Addresses

Public access to Redis 4.0/5.0/6.0 instances can be enabled using Elastic Load Balance (ELB). This section describes how to enable the public access, obtain the access addresses and ports, and add the instances or load balancers to IP whitelists. To enable public access to Redis 3.0 instances, see Public Access to a DCS Redis 3.0 Instance (Discontinued).

  • Public access to Redis 4.0/5.0/6.0 instances may not be available in some cases. Contact the administrators to enable public access whitelists.
  • Public access can be enabled for single-node, master/standby, read/write splitting, and Proxy Cluster instances.
  • Public access to Redis on a client has higher network latency than access to Redis on a client within a VPC.
  • SLA does not include client access exceptions caused by public network performance issues.

Prerequisites

  • A load balancer has been prepared. Learn how to create one by referring to Creating a Dedicated Load Balancer. The load balancer must meet the following requirements.
    • The type is Dedicated and IP as a Backend is enabled.
    • Network load balancing(TCP/UDP) is enabled in the specifications.
    • The VPC is the same as the Redis instance.
    • An Elastic IP (EIP) is bound.
    • A port is available.
    • Binding a load balancer to multiple DCS instances will limit the Redis performance to balancer specifications.
  • For network security purposes, the Redis instance must be password-protected. Password-free instances do not support public access. To change the instance to be password-protected, see Resetting an Instance Password.

Procedure

  1. Log in to the DCS console.
  2. Click in the upper left corner of the management console and select the region where your instance is located.
  3. In the navigation pane, choose Cache Manager.
  4. Click an instance name to go to the instance basic information page.
  5. Click On after Public Access.
  6. Select desired balancers and click OK.

    If there is no available load balancer, click Create one to go to the ELB console. If the load balancer exists, but is not in the list, check whether the load balancer can be bound by referring to Prerequisites.

    • When a load balancer is bound to a Redis instance, do not delete the load balancer and listener. Ensure that the load balancer is available or public access to Redis may be affected.
    • To delete a load balancer, unbind it (disable public access) on the Redis instance details page. Then, delete it on the ELB console.
    Figure 1 Binding a load balancer

  7. When the task for enabling public access is in the Successful state, the public access is enabled.
  8. Choose Basic Information in the navigation pane and check public access. To disable public access, click Off.

    Figure 2 Public access address
    The EIP is the public access address of the Redis instance and the port of the Listener is the public access port.
    • Enabling public access for a master/standby instance generates two listeners. The listener (starting with listener-master) listens to the master node. The listener (starting with listener-slave) listens to the standby node. For public access to a master/standby instance, use the master listener port to connect to the master node of the instance. To configure read/write splitting for a master/standby instance, use the master and standby listener ports to connect to the master and standby nodes.
      Figure 3 Public access addresses for a master/standby instance
    • Connection Address and IP Address are the "domain name:port" and "IP address:port" for accessing Redis on a client within a VPC.

(Optional) Configuring the Private ELB IP Whitelist for a Redis Instance

When the IP whitelist is enabled for Redis, add the private ELB IP addresses to the whitelist of the Redis instance to ensure that ELB can access the Redis instance.

  1. Click the ELB address in Public Access.

  2. Copy ID of ELB.

  3. Click Private IPv4 address.
  4. On the IP Addresses tab page, in the second search box, filter private ELB IP addresses by resource ID (copied ELB ID).

  5. Add all the private IP addresses of ELB to the IP whitelist of Redis. For details, see Configuring DCS Redis Access Whitelist.

(Optional) Configuring an ELB IP Group

To configure an IP address group (IP whitelist) for ELB, add the public IP addresses (EIPs) of the Redis instance to the IP address group of ELB. For details about how to enable the ELB IP address group, see IP Address Group.