默认情况下,Redis Enterprise Software 部署使用 DNS 在节点之间进行通信。您还可以使用 Discovery Service,该服务使用 IP 地址进行连接,并符合 Redis 社区版支持的 Redis Sentinel API

Redis Enterprise 集群中的每个节点都包含一个小型 DNS 服务器,用于管理内部功能,例如高可用性、自动故障转移、自动迁移等。 节点应仅运行软件附带的 DNS 服务器。运行其他 DNS 服务器可能会导致意外行为。

集群名称和连接管理

无论您是管理 Redis Enterprise Software 还是访问数据库,都有两种连接方式:

基于 URL 的连接

完全限定域名 (FQDN) 是唯一的集群标识符,使客户端能够连接到 Redis Enterprise Software 的不同组件。 FQDN 是高可用性机制的关键组件,因为它在内部用于启用和实施节点、数据库分片和终端节点的自动和透明故障转移。

注意:
设置集群的 FQDN 是一次性作,设置后无法更改。

FQDN 必须始终符合 IETF 的 RFC 952 标准 以及 RFC 1123 标准的第 2.1 节。

标识群集

要识别集群,请使用 DNS 定义完全限定域名或使用每个节点的 IP 地址。

使用 DNS 定义域

如果您满足以下条件,请使用 DNS:

  1. 确保集群和集群中至少有一个节点(最好是所有节点) 在 DNS 中使用适当的 NS 条目正确配置。

    例如:

    • 您的域是:mydomain.com
    • 您想要命名 Redis Enterprise Software 集群mycluster
    • 集群中有三个节点:
      • node1(IP 地址 1.1.1.1)
      • 节点 2 (2.2.2.2)
      • 节点 3 (3.3.3.3)
  2. 在 FQDN 字段中,输入值mycluster.mydomain.com,然后在 DNS 表中添加以下记录mydomain.com:

    mycluster.mydomain.com        NS  node1.mycluster.mydomain.com
                                      node2.mycluster.mydomain.com
                                      node3.mycluster.mydomain.com 
    
    node1.mycluster.mydomain.com  A   1.1.1.1
    
    node2.mycluster.mydomain.com  A   2.2.2.2
    
    node3.mycluster.mydomain.com  A   3.3.3.3
    

Zero-configuration using mDNS

Development and test environments can use Multicast DNS (mDNS), a zero-configuration service designed for small networks. Production environments should not use mDNS.

mDNS is a standard protocol that provides DNS-like name resolution and service discovery capabilities to machines on local networks with minimal to no configuration.

Before adopting mDNS, verify that it's supported by each client you wish to use to connect to your Redis databases. Also make sure that your network infrastructure permits mDNS/multi-casting between clients and cluster nodes.

Configuring the cluster to support mDNS requires you to assign the cluster a .local name.

For example, if you want to name the Redis Enterprise Software cluster rediscluster, specify the FQDN name as rediscluster.local.

When using the DNS or mDNS option, failover can be done transparently and the DNS is updated automatically to point to the IP address of the new primary node.

IP-based connections

When you use the IP-based connection option, the FQDN does not need to have any special format because clients use IP addresses instead of hostnames to access the databases so you are free to choose whatever name you want. Using the IP-based connection option does not require any DNS configuration either.

To administer the cluster you do need to know the IP address of at least one of the nodes in the cluster. Once you have the IP address, you can simply connect to port number 8443 (for example: https://10.0.0.12:8443). However, as the topology of the cluster changes and node with the given IP address is removed, you need to remember the IP address of another node participating in this cluster to connect to the admin console and manage the cluster.

Applications connecting to Redis Software databases have the same constraints. When using the IP-based connection method, you can use the Discovery Service to discover the database endpoint for a given database name as long as you have an IP address for at least one of the nodes in the cluster. The API used for discovery service is compliant with the Redis Sentinel API.

To test your connection, try pinging the service. For help, see Connect to your database.