The branch, master has been updated via db4b52b73e8 WHATSNEW: Document CTDB NAT gateway and LVS changes via f37b3cf2a64 ctdb: Change LVS to use leader/follower via 16b848553da ctdb: Change NAT gateway to use leader/follower from 5ce6133a751 ctdb-recoverd: Simplify calculation of new flags
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit db4b52b73e80d0408a6e064ca6623eba0648c8de Author: Martin Schwenke <mar...@meltin.net> Date: Fri Jul 17 20:38:12 2020 +1000 WHATSNEW: Document CTDB NAT gateway and LVS changes Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> Autobuild-User(master): Amitay Isaacs <ami...@samba.org> Autobuild-Date(master): Fri Jul 24 09:58:53 UTC 2020 on sn-devel-184 commit f37b3cf2a64e066d4f261d453233dc9a0988aed7 Author: Martin Schwenke <mar...@meltin.net> Date: Fri Jul 17 20:46:07 2020 +1000 ctdb: Change LVS to use leader/follower Instead of master/slave. Nearly all of these are simple textual substitutions, which preserve the case of the original. A couple of minor cleanups were made in the documentation (such as "LVSMASTER" -> "LVS leader"). Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> commit 16b848553da47f0716d74c13bbbfba50ef5d2cd1 Author: Martin Schwenke <mar...@meltin.net> Date: Wed Jun 24 11:20:24 2020 +1000 ctdb: Change NAT gateway to use leader/follower Instead of master/slave. Nearly all of these are simple textual substitutions, which preserve the case of the original. Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> ----------------------------------------------------------------------- Summary of changes: WHATSNEW.txt | 12 ++++++ ctdb/config/events/legacy/11.natgw.script | 44 ++++++++++---------- ctdb/config/events/legacy/91.lvs.script | 12 +++--- ctdb/doc/ctdb-script.options.5.xml | 32 +++++++-------- ctdb/doc/ctdb.1.xml | 16 ++++---- ctdb/doc/ctdb.7.xml | 48 +++++++++++----------- ctdb/tests/UNIT/eventscripts/11.natgw.002.sh | 2 +- ctdb/tests/UNIT/eventscripts/11.natgw.003.sh | 4 +- ctdb/tests/UNIT/eventscripts/11.natgw.004.sh | 4 +- ctdb/tests/UNIT/eventscripts/11.natgw.011.sh | 6 +-- ctdb/tests/UNIT/eventscripts/11.natgw.012.sh | 8 ++-- ctdb/tests/UNIT/eventscripts/11.natgw.013.sh | 6 +-- ctdb/tests/UNIT/eventscripts/11.natgw.014.sh | 8 ++-- ctdb/tests/UNIT/eventscripts/11.natgw.015.sh | 20 ++++----- ctdb/tests/UNIT/eventscripts/11.natgw.021.sh | 8 ++-- ctdb/tests/UNIT/eventscripts/11.natgw.022.sh | 8 ++-- ctdb/tests/UNIT/eventscripts/11.natgw.023.sh | 8 ++-- ctdb/tests/UNIT/eventscripts/11.natgw.024.sh | 8 ++-- ctdb/tests/UNIT/eventscripts/11.natgw.025.sh | 24 +++++------ ctdb/tests/UNIT/eventscripts/11.natgw.031.sh | 14 +++---- ctdb/tests/UNIT/eventscripts/11.natgw.041.sh | 8 ++-- ctdb/tests/UNIT/eventscripts/11.natgw.042.sh | 8 ++-- ctdb/tests/UNIT/eventscripts/11.natgw.051.sh | 4 +- ctdb/tests/UNIT/eventscripts/11.natgw.052.sh | 4 +- ctdb/tests/UNIT/eventscripts/11.natgw.053.sh | 4 +- ctdb/tests/UNIT/eventscripts/11.natgw.054.sh | 4 +- .../UNIT/eventscripts/91.lvs.ipreallocated.012.sh | 2 +- .../UNIT/eventscripts/91.lvs.ipreallocated.013.sh | 4 +- .../UNIT/eventscripts/91.lvs.ipreallocated.014.sh | 4 +- ctdb/tests/UNIT/eventscripts/scripts/11.natgw.sh | 18 ++++---- ctdb/tests/UNIT/eventscripts/scripts/91.lvs.sh | 10 ++--- ctdb/tests/UNIT/eventscripts/stubs/ctdb_lvs | 10 ++--- ctdb/tests/UNIT/eventscripts/stubs/ctdb_natgw | 14 +++---- ctdb/tests/UNIT/tool/ctdb.lvs.001.sh | 2 +- ctdb/tests/UNIT/tool/ctdb.lvs.002.sh | 2 +- ctdb/tests/UNIT/tool/ctdb.lvs.003.sh | 2 +- ctdb/tests/UNIT/tool/ctdb.lvs.004.sh | 2 +- ctdb/tests/UNIT/tool/ctdb.lvs.005.sh | 2 +- ctdb/tests/UNIT/tool/ctdb.lvs.006.sh | 2 +- ctdb/tests/UNIT/tool/ctdb.lvs.007.sh | 2 +- ctdb/tests/UNIT/tool/ctdb.lvs.008.sh | 2 +- ctdb/tests/UNIT/tool/ctdb.natgw.001.sh | 4 +- ctdb/tests/UNIT/tool/ctdb.natgw.002.sh | 4 +- ctdb/tests/UNIT/tool/ctdb.natgw.003.sh | 4 +- ctdb/tests/UNIT/tool/ctdb.natgw.004.sh | 4 +- ctdb/tests/UNIT/tool/ctdb.natgw.005.sh | 4 +- ctdb/tests/UNIT/tool/ctdb.natgw.006.sh | 10 ++--- ctdb/tests/UNIT/tool/ctdb.natgw.007.sh | 16 ++++---- ctdb/tests/UNIT/tool/ctdb.natgw.008.sh | 4 +- ctdb/tools/ctdb.c | 4 +- ctdb/tools/ctdb_lvs | 16 ++++---- ctdb/tools/ctdb_natgw | 30 +++++++------- 52 files changed, 257 insertions(+), 245 deletions(-) Changeset truncated at 500 lines: diff --git a/WHATSNEW.txt b/WHATSNEW.txt index e7b46a7b159..b278192e41d 100644 --- a/WHATSNEW.txt +++ b/WHATSNEW.txt @@ -28,6 +28,18 @@ This is now done implicitly when over TLS, so "client ldap sasl wrapping" does not need to be set to "plain" in order for it to work. +CTDB CHANGES +============ + +* The NAT gateway and LVS features now uses the term "leader" to refer + to the main node in a group through which traffic is routed and + "follower" for other members of a group. The command for + determining the leader has changed to "ctdb natgw master" from + "ctdb natgw leader". The "slave-only" configuration element has + changed to "follower-only" from "slave-only". Identical changes + were made for LVS. + + REMOVED FEATURES ================ diff --git a/ctdb/config/events/legacy/11.natgw.script b/ctdb/config/events/legacy/11.natgw.script index 18b064a1efb..b02ff7a6bf4 100755 --- a/ctdb/config/events/legacy/11.natgw.script +++ b/ctdb/config/events/legacy/11.natgw.script @@ -23,14 +23,14 @@ ctdb_setup_state_dir "failover" "$service_name" # shellcheck disable=SC2154 natgw_cfg_new="${script_state_dir}/cfg_new" natgw_cfg_old="${script_state_dir}/cfg_old" -natgw_master_old="${script_state_dir}/master_old" +natgw_leader_old="${script_state_dir}/leader_old" -ctdb_natgw_slave_only () +ctdb_natgw_follower_only () { _ip_address=$(ctdb_get_ip_address) awk -v my_ip="$_ip_address" \ - '$1 == my_ip { if ($2 ~ "slave-only") { exit 0 } else { exit 1 } }' \ + '$1 == my_ip { if ($2 ~ "follower-only") { exit 0 } else { exit 1 } }' \ "$CTDB_NATGW_NODES" } @@ -38,7 +38,7 @@ natgw_check_config () { [ -r "$CTDB_NATGW_NODES" ] || \ die "error: CTDB_NATGW_NODES=${CTDB_NATGW_NODES} unreadable" - if ! ctdb_natgw_slave_only ; then + if ! ctdb_natgw_follower_only ; then [ -n "$CTDB_NATGW_PUBLIC_IP" ] || \ die "Invalid configuration: CTDB_NATGW_PUBLIC_IP not set" [ -n "$CTDB_NATGW_PUBLIC_IFACE" ] || \ @@ -113,7 +113,7 @@ natgw_clear () fi } -natgw_set_master () +natgw_set_leader () { set_proc sys/net/ipv4/ip_forward 1 iptables -A POSTROUTING -t nat \ @@ -141,7 +141,7 @@ natgw_set_master () done } -natgw_set_slave () +natgw_set_follower () { _natgwip="$1" @@ -151,33 +151,33 @@ natgw_set_slave () done } -natgw_ensure_master () +natgw_ensure_leader () { # Intentional word splitting here # shellcheck disable=SC2046 - set -- $("${CTDB_HELPER_BINDIR}/ctdb_natgw" master) - natgwmaster="${1:--1}" # Default is -1, for failure above + set -- $("${CTDB_HELPER_BINDIR}/ctdb_natgw" leader) + natgwleader="${1:--1}" # Default is -1, for failure above natgwip="$2" - if [ "$natgwmaster" = "-1" ]; then + if [ "$natgwleader" = "-1" ]; then # Fail... - die "There is no NATGW master node" + die "There is no NATGW leader node" fi } -natgw_master_has_changed () +natgw_leader_has_changed () { - if [ -r "$natgw_master_old" ] ; then - read _old_natgwmaster <"$natgw_master_old" + if [ -r "$natgw_leader_old" ] ; then + read _old_natgwleader <"$natgw_leader_old" else - _old_natgwmaster="" + _old_natgwleader="" fi - [ "$_old_natgwmaster" != "$natgwmaster" ] + [ "$_old_natgwleader" != "$natgwleader" ] } natgw_save_state () { - echo "$natgwmaster" >"$natgw_master_old" + echo "$natgwleader" >"$natgw_leader_old" # Created by natgw_config_has_changed() mv "$natgw_cfg_new" "$natgw_cfg_old" } @@ -205,17 +205,17 @@ startup) updatenatgw|ipreallocated) natgw_check_config - natgw_ensure_master + natgw_ensure_leader - natgw_config_has_changed || natgw_master_has_changed || exit 0 + natgw_config_has_changed || natgw_leader_has_changed || exit 0 natgw_clear pnn=$(ctdb_get_pnn) - if [ "$pnn" = "$natgwmaster" ]; then - natgw_set_master + if [ "$pnn" = "$natgwleader" ]; then + natgw_set_leader else - natgw_set_slave "$natgwip" + natgw_set_follower "$natgwip" fi # flush our route cache diff --git a/ctdb/config/events/legacy/91.lvs.script b/ctdb/config/events/legacy/91.lvs.script index b3d65f44607..05f0431b661 100755 --- a/ctdb/config/events/legacy/91.lvs.script +++ b/ctdb/config/events/legacy/91.lvs.script @@ -19,11 +19,11 @@ if ! type ipvsadm >/dev/null 2>&1 ; then fi -lvs_slave_only () +lvs_follower_only () { _ip_address=$(ctdb_get_ip_address) awk -v my_ip="$_ip_address" \ - '$1 == my_ip { if ($2 ~ "slave-only") { exit 0 } else { exit 1 } }' \ + '$1 == my_ip { if ($2 ~ "follower-only") { exit 0 } else { exit 1 } }' \ "$CTDB_LVS_NODES" } @@ -33,7 +33,7 @@ lvs_check_config () die "error: CTDB_LVS_NODES=${CTDB_LVS_NODES} unreadable" [ -n "$CTDB_LVS_PUBLIC_IP" ] || \ die "Invalid configuration: CTDB_LVS_PUBLIC_IP not set" - if ! lvs_slave_only ; then + if ! lvs_follower_only ; then [ -n "$CTDB_LVS_PUBLIC_IFACE" ] || \ die "Invalid configuration: CTDB_LVS_PUBLIC_IFACE not set" fi @@ -78,9 +78,9 @@ ipreallocated) "$CTDB_LVS_PUBLIC_IFACE" "$CTDB_LVS_PUBLIC_IP" pnn=$(ctdb_get_pnn) - lvsmaster=$("${CTDB_HELPER_BINDIR}/ctdb_lvs" master) - if [ "$pnn" != "$lvsmaster" ] ; then - # This node is not the LVS master so change the IP address + lvsleader=$("${CTDB_HELPER_BINDIR}/ctdb_lvs" leader) + if [ "$pnn" != "$lvsleader" ] ; then + # This node is not the LVS leader so change the IP address # to have scope "host" so this node won't respond to ARPs ip addr del "${CTDB_LVS_PUBLIC_IP}/32" dev lo >/dev/null 2>&1 ip addr add "${CTDB_LVS_PUBLIC_IP}/32" dev lo scope host diff --git a/ctdb/doc/ctdb-script.options.5.xml b/ctdb/doc/ctdb-script.options.5.xml index fe0517fe071..700d1f7bd35 100644 --- a/ctdb/doc/ctdb-script.options.5.xml +++ b/ctdb/doc/ctdb-script.options.5.xml @@ -125,9 +125,9 @@ when they do not host any public IP addresses. For example, it allows unhealthy nodes to reliably communicate with external infrastructure. One node in a NAT gateway group will - be designated as the NAT gateway master node and other (slave) + be designated as the NAT gateway leader node and other (follower) nodes will be configured with fallback routes via the NAT - gateway master node. For more information, see the + gateway leader node. For more information, see the <citetitle>NAT GATEWAY</citetitle> section in <citerefentry><refentrytitle>ctdb</refentrytitle> <manvolnum>7</manvolnum></citerefentry>. @@ -140,12 +140,12 @@ <listitem> <para> IPADDR is an alternate network gateway to use on the NAT - gateway master node. If set, a fallback default route + gateway leader node. If set, a fallback default route is added via this network gateway. </para> <para> No default. Setting this variable is optional - if not - set that no route is created on the NAT gateway master + set that no route is created on the NAT gateway leader node. </para> </listitem> @@ -161,7 +161,7 @@ <para> File format: <screen> -<parameter>IPADDR</parameter> <optional>slave-only</optional> +<parameter>IPADDR</parameter> <optional>follower-only</optional> </screen> </para> <para> @@ -169,8 +169,8 @@ gateway group. </para> <para> - If "slave-only" is specified then the corresponding node - can not be the NAT gateway master node. In this case + If "follower-only" is specified then the corresponding node + can not be the NAT gateway leader node. In this case <varname>CTDB_NATGW_PUBLIC_IFACE</varname> and <varname>CTDB_NATGW_PUBLIC_IP</varname> are optional and unused. @@ -187,7 +187,7 @@ <listitem> <para> IPADDR/MASK is the private sub-network that is - internally routed via the NAT gateway master node. This + internally routed via the NAT gateway leader node. This is usually the private network that is used for node addresses. </para> @@ -216,7 +216,7 @@ <para> IPADDR/MASK indicates the IP address that is used for outgoing traffic (originating from - CTDB_NATGW_PRIVATE_NETWORK) on the NAT gateway master + CTDB_NATGW_PRIVATE_NETWORK) on the NAT gateway leader node. This <emphasis>must not</emphasis> be a configured public IP address. </para> @@ -239,19 +239,19 @@ </para> <para> If GATEWAY is specified then the corresponding route on - the NATGW master node will be via GATEWAY. Such routes + the NATGW leader node will be via GATEWAY. Such routes are created even if <varname>CTDB_NATGW_DEFAULT_GATEWAY</varname> is not specified. If GATEWAY is not specified for some networks then routes are only created on the NATGW - master node for those networks if + leader node for those networks if <varname>CTDB_NATGW_DEFAULT_GATEWAY</varname> is specified. </para> <para> This should be used with care to avoid causing traffic to unnecessarily double-hop through the NAT gateway - master, even when a node is hosting public IP addresses. + leader, even when a node is hosting public IP addresses. Each specified network or host should probably have a corresponding automatically created link route or static route to avoid this. @@ -451,7 +451,7 @@ CTDB_PER_IP_ROUTING_TABLE_ID_HIGH=9000 <para> File format: <screen> -<parameter>IPADDR</parameter> <optional>slave-only</optional> +<parameter>IPADDR</parameter> <optional>follower-only</optional> </screen> </para> <para> @@ -459,8 +459,8 @@ CTDB_PER_IP_ROUTING_TABLE_ID_HIGH=9000 group. </para> <para> - If "slave-only" is specified then the corresponding node - can not be the LVS master node. In this case + If "follower-only" is specified then the corresponding node + can not be the LVS leader node. In this case <varname>CTDB_LVS_PUBLIC_IFACE</varname> and <varname>CTDB_LVS_PUBLIC_IP</varname> are optional and unused. @@ -480,7 +480,7 @@ CTDB_PER_IP_ROUTING_TABLE_ID_HIGH=9000 <para> INTERFACE is the network interface that clients will use to connection to <varname>CTDB_LVS_PUBLIC_IP</varname>. - This is optional for slave-only nodes. + This is optional for follower-only nodes. No default. </para> </listitem> diff --git a/ctdb/doc/ctdb.1.xml b/ctdb/doc/ctdb.1.xml index fe2b675ff2c..217a6d3e41a 100644 --- a/ctdb/doc/ctdb.1.xml +++ b/ctdb/doc/ctdb.1.xml @@ -445,7 +445,7 @@ Duration of last recovery/failover: 2.248552 seconds </refsect2> <refsect2> - <title>natgw {master|list|status}</title> + <title>natgw {leader|list|status}</title> <para> This command shows different aspects of NAT gateway status. For an overview of CTDB's NAT gateway functionality please see @@ -456,11 +456,11 @@ Duration of last recovery/failover: 2.248552 seconds <variablelist> <varlistentry> - <term>master</term> + <term>leader</term> <listitem> <para> Show the PNN and private IP address of the current NAT - gateway master node. + gateway leader node. </para> <para> Example output: @@ -475,14 +475,14 @@ Duration of last recovery/failover: 2.248552 seconds <listitem> <para> List the private IP addresses of nodes in the current - NAT gateway group, annotating the master node. + NAT gateway group, annotating the leader node. </para> <para> Example output: </para> <screen> 192.168.2.200 -192.168.2.201 MASTER +192.168.2.201 LEADER 192.168.2.202 192.168.2.203 </screen> @@ -864,7 +864,7 @@ MonitorInterval = 15 </refsect2> <refsect2> - <title>lvs {master|list|status}</title> + <title>lvs {leader|list|status}</title> <para> This command shows different aspects of LVS status. For an overview of CTDB's LVS functionality please see the @@ -875,10 +875,10 @@ MonitorInterval = 15 <variablelist> <varlistentry> - <term>master</term> + <term>leader</term> <listitem> <para> - Shows the PNN of the current LVS master node. + Shows the PNN of the current LVS leader node. </para> <para> Example output: diff --git a/ctdb/doc/ctdb.7.xml b/ctdb/doc/ctdb.7.xml index 2079ed713e3..7fd61af0964 100644 --- a/ctdb/doc/ctdb.7.xml +++ b/ctdb/doc/ctdb.7.xml @@ -528,13 +528,13 @@ Node 3:/usr/local/etc/ctdb/public_addresses <para> In each LVS group, one of the nodes is selected by CTDB to be - the LVS master. This node receives all traffic from clients + the LVS leader. This node receives all traffic from clients coming in to the LVS public address and multiplexes it across the internal network to one of the nodes that LVS is using. When responding to the client, that node will send the data back - directly to the client, bypassing the LVS master node. The - command <command>ctdb lvs master</command> will show which node - is the current LVS master. + directly to the client, bypassing the LVS leader node. The + command <command>ctdb lvs leader</command> will show which node + is the current LVS leader. </para> <para> @@ -542,12 +542,12 @@ Node 3:/usr/local/etc/ctdb/public_addresses <orderedlist> <listitem> <para> - Client sends request packet to LVSMASTER. + Client sends request packet to LVS leader. </para> </listitem> <listitem> <para> - LVSMASTER passes the request on to one node across the + LVS leader passes the request on to one node across the internal network. </para> </listitem> @@ -572,7 +572,7 @@ Node 3:/usr/local/etc/ctdb/public_addresses pattern is write-intensive since you will be limited in the available network bandwidth that node can handle. LVS does work very well for read-intensive workloads where only smallish READ - requests are going through the LVSMASTER bottleneck and the + requests are going through the LVS leader bottleneck and the majority of the traffic volume (the data in the read replies) goes straight from the processing node back to the clients. For read-intensive i/o patterns you can achieve very high throughput @@ -631,21 +631,21 @@ CTDB_LVS_NODES=/usr/local/etc/ctdb/lvs_nodes </screen> <para> - Normally any node in an LVS group can act as the LVS master. + Normally any node in an LVS group can act as the LVS leader. Nodes that are highly loaded due to other demands maybe - flagged with the "slave-only" option in the + flagged with the "follower-only" option in the <varname>CTDB_LVS_NODES</varname> file to limit the LVS functionality of those nodes. </para> <para> LVS nodes file that excludes 192.168.1.4 from being - the LVS master node: + the LVS leader node: </para> <screen format="linespecific"> 192.168.1.2 192.168.1.3 -192.168.1.4 slave-only +192.168.1.4 follower-only </screen> </refsect2> @@ -715,13 +715,13 @@ CTDB_LVS_NODES=/usr/local/etc/ctdb/lvs_nodes </para> <para> In each NATGW group, one of the nodes is selected by CTDB to - be the NATGW master and the other nodes are consider to be - NATGW slaves. NATGW slaves establish a fallback default route - to the NATGW master via the private network. When a NATGW - slave hosts no public IP addresses then it will use this route - for outbound connections. The NATGW master hosts the NATGW + be the NATGW leader and the other nodes are consider to be + NATGW followers. NATGW followers establish a fallback default route + to the NATGW leader via the private network. When a NATGW + follower hosts no public IP addresses then it will use this route + for outbound connections. The NATGW leader hosts the NATGW public IP address and routes outgoing connections from - slave nodes via this IP address. It also establishes a + follower nodes via this IP address. It also establishes a fallback default route. </para> </refsect2> @@ -742,9 +742,9 @@ CTDB_NATGW_DEFAULT_GATEWAY=10.0.0.1 <para> Normally any node in a NATGW group can act as the NATGW - master. Some configurations may have special nodes that lack + leader. Some configurations may have special nodes that lack connectivity to a public network. In such cases, those nodes - can be flagged with the "slave-only" option in the + can be flagged with the "follower-only" option in the <varname>CTDB_NATGW_NODES</varname> file to limit the NATGW functionality of those nodes. </para> @@ -765,15 +765,15 @@ CTDB_NATGW_DEFAULT_GATEWAY=10.0.0.1 When the NATGW functionality is used, one of the nodes is selected to act as a NAT gateway for all the other nodes in the group when they need to communicate with the external - services. The NATGW master is selected to be a node that is + services. The NATGW leader is selected to be a node that is most likely to have usable networks. </para> <para> - The NATGW master hosts the NATGW public IP address + The NATGW leader hosts the NATGW public IP address <varname>CTDB_NATGW_PUBLIC_IP</varname> on the configured public interfaces <varname>CTDB_NATGW_PUBLIC_IFACE</varname> and acts as - a router, masquerading outgoing connections from slave nodes + a router, masquerading outgoing connections from follower nodes via this IP address. If <varname>CTDB_NATGW_DEFAULT_GATEWAY</varname> is set then it also establishes a fallback default route to the configured @@ -783,8 +783,8 @@ CTDB_NATGW_DEFAULT_GATEWAY=10.0.0.1 </para> <para> - A NATGW slave establishes its fallback default route to the - NATGW master via the private network + A NATGW follower establishes its fallback default route to the + NATGW leader via the private network <varname>CTDB_NATGW_PRIVATE_NETWORK</varname>with a metric of 10. This route is used for outbound connections when no other -- Samba Shared Repository