Adding public IP addresses: Difference between revisions

From SambaWiki
(Add Testing section describing "ctdb ip")
m (→‎CTDB configuration file: Link to ctdbd.conf(5))
Line 19: Line 19:
CTDB_PUBLIC_ADDRESSES=/etc/ctdb/public_addresses
CTDB_PUBLIC_ADDRESSES=/etc/ctdb/public_addresses


Please see ctdbd.conf(5) for more details.
Please see [http://ctdb.samba.org/manpages/ctdbd.conf.5.html ctdbd.conf(5)] for more details.


= Public addresses file =
= Public addresses file =

Revision as of 04:42, 29 January 2017

Introduction

CTDB can manage a pool of public IP addresses that are distributed across nodes of a cluster. This allows CTDB to perform failover of connections and load balance between nodes. Public IP addresses allow a cluster of nodes that to function as a single multi-homed node, in nearly all respects. This allows the cluster to offer coherent services (e.g. SMB, NFS) across all nodes.

The clustering model utilises IP takeover techniques to ensure that the full set of public IP addresses assigned to services on the cluster will always be available to the clients even when some nodes have failed and become unavailable.

Alternatively, CTDB can be configured to use LVS for failover and load balancing. However, this is not as well tested as the approach described here.

Prerequisites

CTDB configuration file

The CTDB_PUBLIC_ADDRESSES configuration variable must be set in the ctdbd configuration fileto point to a public addresses file containing the public IP address configuration. This file is usually called public_addresses and should reside in the CTDB configuration directory.

For example:

 CTDB_PUBLIC_ADDRESSES=/etc/ctdb/public_addresses

Please see ctdbd.conf(5) for more details.

Public addresses file

The file contains a list of public IP addresses, one per line, each with an optional (comma-separated) list of network interfaces that can have that address assigned. These are the addresses that clients should be configured to connect to.

For example:

 192.168.1.1/24 eth1
 192.168.1.2/24 eth1
 192.168.2.1/24 eth2
 192.168.2.2/24 eth2

If network interfaces are not specified on all lines in the public addresses file then the CTDB_PUBLIC_INTERFACE configuration variable must be used to specify a default interface.

  • The CTDB cluster utilises IP takeover techniques to ensure that all the public IP addresses will always be available to clients, as long as at least one node in the cluster is available,
  • Do not manually assign the public IP addresses to interfaces on any node. CTDB will add and remove these addresses automatically at runtime.
  • There is no built-in restriction on the number of IP addresses or network interfaces that can be used. However, performance limitations (e.g. time taken to calculate IP address distribution, time taken to break TCP connections and delete IPs from interfaces, ...) introduce practical limits.
  • It is sensible to plan the public IP addresses so that they can be evenly redistributed across subsets of nodes. For example, a 4 node cluster will always be able to evenly distribute 12 public IP addresses (across 4, 3, 2, 1 nodes). Having IP addresses evenly balanced is not a hard requirement but evenly balancing IP addresses is the only method of load balancing used by CTDB.
  • The public addresses file can differ between nodes, allowing subsets of nodes to host particular public IP addresses. Note that pathological configurations can result in undesirable IP address distribution.

Testing

ctdb ip shows the lists public IP addresses and that node that is hosting them.

For example:

 # ctdb ip
 Public IPs on node 0
 192.168.1.1 0
 192.168.1.2 1
 192.168.2.1 2
 192.168.2.2 3
  • A value of -1 for a node number indicates that an address is not currently hosted.
  • This command only shows public IP addresses defined on the current node. If different groups of public IP addresses are defined on different nodes then use ctdb ip all to show addresses defined on all nodes.

DNS

You can configure the public IP addresses to correspond to a DNS name. This can allow some clients to be configured to connect to the DNS name. Clients should then connect to different public IP addresses in a round-robin manner.