1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

Merge commit 'ronnie/master'

(This used to be ctdb commit 5403ed6dcfdfc101b05b43f83002e720d81b4e38)
This commit is contained in:
Andrew Tridgell 2008-10-16 12:58:25 +11:00
commit 371e6aa155
15 changed files with 880 additions and 204 deletions

View File

@ -197,6 +197,7 @@ install: all
${INSTALLCMD} -m 755 config/events.d/70.iscsi $(DESTDIR)$(etcdir)/ctdb/events.d
${INSTALLCMD} -m 755 config/events.d/90.ipmux $(DESTDIR)$(etcdir)/ctdb/events.d
${INSTALLCMD} -m 755 config/events.d/91.lvs $(DESTDIR)$(etcdir)/ctdb/events.d
${INSTALLCMD} -m 755 config/events.d/99.routing $(DESTDIR)$(etcdir)/ctdb/events.d
${INSTALLCMD} -m 755 tools/ctdb_diagnostics $(DESTDIR)$(bindir)
${INSTALLCMD} -m 755 tools/onnode $(DESTDIR)$(bindir)
if [ -f doc/ctdb.1 ];then ${INSTALLCMD} -d $(DESTDIR)$(mandir)/man1; fi

View File

@ -1221,7 +1221,7 @@ int ctdb_ctrl_getdbmap(struct ctdb_context *ctdb, struct timeval timeout, uint32
CTDB_CONTROL_GET_DBMAP, 0, tdb_null,
mem_ctx, &outdata, &res, &timeout, NULL);
if (ret != 0 || res != 0) {
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getdbmap failed\n"));
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getdbmap failed ret:%d res:%d\n", ret, res));
return -1;
}
@ -1245,8 +1245,12 @@ int ctdb_ctrl_getnodemap(struct ctdb_context *ctdb,
ret = ctdb_control(ctdb, destnode, 0,
CTDB_CONTROL_GET_NODEMAP, 0, tdb_null,
mem_ctx, &outdata, &res, &timeout, NULL);
if (ret == 0 && res == -1 && outdata.dsize == 0) {
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getnodes failed, falling back to ipv4-only control\n"));
return ctdb_ctrl_getnodemapv4(ctdb, timeout, destnode, mem_ctx, nodemap);
}
if (ret != 0 || res != 0 || outdata.dsize == 0) {
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getnodes failed\n"));
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getnodes failed ret:%d res:%d\n", ret, res));
return -1;
}
@ -1256,6 +1260,45 @@ int ctdb_ctrl_getnodemap(struct ctdb_context *ctdb,
return 0;
}
/*
old style ipv4-only get a list of nodes (vnn and flags ) from a remote node
*/
int ctdb_ctrl_getnodemapv4(struct ctdb_context *ctdb,
struct timeval timeout, uint32_t destnode,
TALLOC_CTX *mem_ctx, struct ctdb_node_map **nodemap)
{
int ret, i, len;
TDB_DATA outdata;
struct ctdb_node_mapv4 *nodemapv4;
int32_t res;
ret = ctdb_control(ctdb, destnode, 0,
CTDB_CONTROL_GET_NODEMAPv4, 0, tdb_null,
mem_ctx, &outdata, &res, &timeout, NULL);
if (ret != 0 || res != 0 || outdata.dsize == 0) {
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getnodesv4 failed ret:%d res:%d\n", ret, res));
return -1;
}
nodemapv4 = (struct ctdb_node_mapv4 *)outdata.dptr;
len = offsetof(struct ctdb_node_map, nodes) + nodemapv4->num*sizeof(struct ctdb_node_and_flags);
(*nodemap) = talloc_zero_size(mem_ctx, len);
CTDB_NO_MEMORY(ctdb, (*nodemap));
(*nodemap)->num = nodemapv4->num;
for (i=0; i<nodemapv4->num; i++) {
(*nodemap)->nodes[i].pnn = nodemapv4->nodes[i].pnn;
(*nodemap)->nodes[i].flags = nodemapv4->nodes[i].flags;
(*nodemap)->nodes[i].addr.ip = nodemapv4->nodes[i].sin;
(*nodemap)->nodes[i].addr.sa.sa_family = AF_INET;
}
talloc_free(outdata.dptr);
return 0;
}
/*
drop the transport, reload the nodes file and restart the transport
*/
@ -2050,14 +2093,26 @@ int ctdb_ctrl_takeover_ip(struct ctdb_context *ctdb, struct timeval timeout,
uint32_t destnode, struct ctdb_public_ip *ip)
{
TDB_DATA data;
struct ctdb_public_ipv4 ipv4;
int ret;
int32_t res;
data.dsize = sizeof(*ip);
data.dptr = (uint8_t *)ip;
if (ip->addr.sa.sa_family == AF_INET) {
ipv4.pnn = ip->pnn;
ipv4.sin = ip->addr.ip;
ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_TAKEOVER_IP, 0, data, NULL,
data.dsize = sizeof(ipv4);
data.dptr = (uint8_t *)&ipv4;
ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_TAKEOVER_IPv4, 0, data, NULL,
NULL, &res, &timeout, NULL);
} else {
data.dsize = sizeof(*ip);
data.dptr = (uint8_t *)ip;
ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_TAKEOVER_IP, 0, data, NULL,
NULL, &res, &timeout, NULL);
}
if (ret != 0 || res != 0) {
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for takeover_ip failed\n"));
@ -2075,14 +2130,26 @@ int ctdb_ctrl_release_ip(struct ctdb_context *ctdb, struct timeval timeout,
uint32_t destnode, struct ctdb_public_ip *ip)
{
TDB_DATA data;
struct ctdb_public_ipv4 ipv4;
int ret;
int32_t res;
data.dsize = sizeof(*ip);
data.dptr = (uint8_t *)ip;
if (ip->addr.sa.sa_family == AF_INET) {
ipv4.pnn = ip->pnn;
ipv4.sin = ip->addr.ip;
ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_RELEASE_IP, 0, data, NULL,
NULL, &res, &timeout, NULL);
data.dsize = sizeof(ipv4);
data.dptr = (uint8_t *)&ipv4;
ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_RELEASE_IPv4, 0, data, NULL,
NULL, &res, &timeout, NULL);
} else {
data.dsize = sizeof(*ip);
data.dptr = (uint8_t *)ip;
ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_RELEASE_IP, 0, data, NULL,
NULL, &res, &timeout, NULL);
}
if (ret != 0 || res != 0) {
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for release_ip failed\n"));
@ -2230,12 +2297,48 @@ int ctdb_ctrl_get_public_ips(struct ctdb_context *ctdb,
ret = ctdb_control(ctdb, destnode, 0,
CTDB_CONTROL_GET_PUBLIC_IPS, 0, tdb_null,
mem_ctx, &outdata, &res, &timeout, NULL);
if (ret == 0 && res == -1) {
DEBUG(DEBUG_ERR,(__location__ " ctdb_control to get public ips failed, falling back to ipv4-only version\n"));
return ctdb_ctrl_get_public_ipsv4(ctdb, timeout, destnode, mem_ctx, ips);
}
if (ret != 0 || res != 0) {
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getpublicips failed ret:%d res:%d\n", ret, res));
return -1;
}
*ips = (struct ctdb_all_public_ips *)talloc_memdup(mem_ctx, outdata.dptr, outdata.dsize);
talloc_free(outdata.dptr);
return 0;
}
int ctdb_ctrl_get_public_ipsv4(struct ctdb_context *ctdb,
struct timeval timeout, uint32_t destnode,
TALLOC_CTX *mem_ctx, struct ctdb_all_public_ips **ips)
{
int ret, i, len;
TDB_DATA outdata;
int32_t res;
struct ctdb_all_public_ipsv4 *ipsv4;
ret = ctdb_control(ctdb, destnode, 0,
CTDB_CONTROL_GET_PUBLIC_IPSv4, 0, tdb_null,
mem_ctx, &outdata, &res, &timeout, NULL);
if (ret != 0 || res != 0) {
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getpublicips failed\n"));
return -1;
}
*ips = (struct ctdb_all_public_ips *)talloc_memdup(mem_ctx, outdata.dptr, outdata.dsize);
ipsv4 = (struct ctdb_all_public_ipsv4 *)outdata.dptr;
len = offsetof(struct ctdb_all_public_ips, ips) +
ipsv4->num*sizeof(struct ctdb_public_ip);
*ips = talloc_zero_size(mem_ctx, len);
(*ips)->num = ipsv4->num;
for (i=0; i<ipsv4->num; i++) {
(*ips)->ips[i].pnn = ipsv4->ips[i].pnn;
(*ips)->ips[i].addr.ip = ipsv4->ips[i].sin;
}
talloc_free(outdata.dptr);
return 0;
@ -2435,7 +2538,7 @@ int ctdb_ctrl_get_tcp_tickles(struct ctdb_context *ctdb,
ret = ctdb_control(ctdb, destnode, 0,
CTDB_CONTROL_GET_TCP_TICKLE_LIST, 0, data,
mem_ctx, &outdata, &status, NULL, NULL);
if (ret != 0) {
if (ret != 0 || status != 0) {
DEBUG(DEBUG_ERR,(__location__ " ctdb_control for get tcp tickles failed\n"));
return -1;
}

View File

@ -362,12 +362,12 @@ void set_close_on_exec(int fd)
}
static bool parse_ipv4(const char *s, unsigned port, ctdb_sock_addr *saddr)
bool parse_ipv4(const char *s, unsigned port, struct sockaddr_in *sin)
{
saddr->ip.sin_family = AF_INET;
saddr->ip.sin_port = htons(port);
sin->sin_family = AF_INET;
sin->sin_port = htons(port);
if (inet_pton(AF_INET, s, &saddr->ip.sin_addr) != 1) {
if (inet_pton(AF_INET, s, &sin->sin_addr) != 1) {
DEBUG(DEBUG_ERR, (__location__ " Failed to translate %s into sin_addr\n", s));
return false;
}
@ -427,7 +427,7 @@ bool parse_ip_port(const char *addr, ctdb_sock_addr *saddr)
/* now is this a ipv4 or ipv6 address ?*/
p = index(s, ':');
if (p == NULL) {
ret = parse_ipv4(s, port, saddr);
ret = parse_ipv4(s, port, &saddr->ip);
} else {
ret = parse_ipv6(s, port, saddr);
}
@ -447,7 +447,7 @@ bool parse_ip(const char *addr, ctdb_sock_addr *saddr)
/* now is this a ipv4 or ipv6 address ?*/
p = index(addr, ':');
if (p == NULL) {
ret = parse_ipv4(addr, 0, saddr);
ret = parse_ipv4(addr, 0, &saddr->ip);
} else {
ret = parse_ipv6(addr, 0, saddr);
}
@ -493,7 +493,7 @@ bool parse_ip_mask(const char *str, ctdb_sock_addr *addr, unsigned *mask)
/* now is this a ipv4 or ipv6 address ?*/
p = index(s, ':');
if (p == NULL) {
ret = parse_ipv4(s, 0, addr);
ret = parse_ipv4(s, 0, &addr->ip);
} else {
ret = parse_ipv6(s, 0, addr);
}

37
ctdb/config/events.d/99.routing Executable file
View File

@ -0,0 +1,37 @@
#!/bin/sh
# script to add entries to the routing table after we have performed a
# take ip event
# (when we do a "releaseip" event and remove an ip address from an interface
# the kernel might automatically remove associated entries from
# the routing table. This is where we add them back)
#
# Routes to add are defined in /etc/ctdb/static-routes.
# Syntax is :
# IFACE NET/MASK GATEWAY
#
# Example
# bond1 10.3.3.0/24 10.0.0.1
. $CTDB_BASE/functions
loadconfig ctdb
[ -f $CTDB_BASE/static-routes ] || {
exit 0
}
cmd="$1"
shift
PATH=/usr/bin:/bin:/usr/sbin:/sbin:$PATH
case $cmd in
takeip)
iface=$1
cat $CTDB_BASE/static-routes | egrep "^$iface " | while read IFACE DEST GW; do
route add -net $DEST gw $GW
done
;;
esac
exit 0

View File

@ -1,443 +1,729 @@
.\" Title: ctdbd
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
.\" Date: 09/15/2008
.\" Manual:
.\" Source:
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
.\" Date: 10/14/2008
.\" Manual: [FIXME: manual]
.\" Source: [FIXME: source]
.\" Language: English
.\"
.TH "CTDBD" "1" "09/15/2008" "" ""
.TH "CTDBD" "1" "10/14/2008" "[FIXME: source]" "[FIXME: manual]"
.\" -----------------------------------------------------------------
.\" * (re)Define some macros
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" toupper - uppercase a string (locale-aware)
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.de toupper
.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
\\$*
.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
..
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" SH-xref - format a cross-reference to an SH section
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.de SH-xref
.ie n \{\
.\}
.toupper \\$*
.el \{\
\\$*
.\}
..
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" SH - level-one heading that works better for non-TTY output
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.de1 SH
.\" put an extra blank line of space above the head in non-TTY output
.if t \{\
.sp 1
.\}
.sp \\n[PD]u
.nr an-level 1
.set-an-margin
.nr an-prevailing-indent \\n[IN]
.fi
.in \\n[an-margin]u
.ti 0
.HTML-TAG ".NH \\n[an-level]"
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
\." make the size of the head bigger
.ps +3
.ft B
.ne (2v + 1u)
.ie n \{\
.\" if n (TTY output), use uppercase
.toupper \\$*
.\}
.el \{\
.nr an-break-flag 0
.\" if not n (not TTY), use normal case (not uppercase)
\\$1
.in \\n[an-margin]u
.ti 0
.\" if not n (not TTY), put a border/line under subheading
.sp -.6
\l'\n(.lu'
.\}
..
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" SS - level-two heading that works better for non-TTY output
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.de1 SS
.sp \\n[PD]u
.nr an-level 1
.set-an-margin
.nr an-prevailing-indent \\n[IN]
.fi
.in \\n[IN]u
.ti \\n[SN]u
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.ps \\n[PS-SS]u
\." make the size of the head bigger
.ps +2
.ft B
.ne (2v + 1u)
.if \\n[.$] \&\\$*
..
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" BB/BE - put background/screen (filled box) around block of text
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.de BB
.if t \{\
.sp -.5
.br
.in +2n
.ll -2n
.gcolor red
.di BX
.\}
..
.de EB
.if t \{\
.if "\\$2"adjust-for-leading-newline" \{\
.sp -1
.\}
.br
.di
.in
.ll
.gcolor
.nr BW \\n(.lu-\\n(.i
.nr BH \\n(dn+.5v
.ne \\n(BHu+.5v
.ie "\\$2"adjust-for-leading-newline" \{\
\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
.\}
.el \{\
\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
.\}
.in 0
.sp -.5v
.nf
.BX
.in
.sp .5v
.fi
.\}
..
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" BM/EM - put colored marker in margin next to block of text
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.de BM
.if t \{\
.br
.ll -2n
.gcolor red
.di BX
.\}
..
.de EM
.if t \{\
.br
.di
.ll
.gcolor
.nr BH \\n(dn
.ne \\n(BHu
\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
.in 0
.nf
.BX
.in
.fi
.\}
..
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.SH "NAME"
ctdbd - The CTDB cluster daemon
.SH "SYNOPSIS"
.HP 6
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "Name"
ctdbd \- The CTDB cluster daemon
.SH "Synopsis"
.fam C
.HP \w'\fBctdbd\fR\ 'u
\fBctdbd\fR
.HP 6
.fam
.fam C
.HP \w'\fBctdbd\fR\ 'u
\fBctdbd\fR [\-?\ \-\-help] [\-d\ \-\-debug=<INTEGER>] {\-\-dbdir=<directory>} {\-\-dbdir\-persistent=<directory>} [\-\-event\-script\-dir=<directory>] [\-i\ \-\-interactive] [\-\-listen=<address>] [\-\-logfile=<filename>] [\-\-lvs] {\-\-nlist=<filename>} [\-\-no\-lmaster] [\-\-no\-recmaster] [\-\-nosetsched] [\-\-public\-addresses=<filename>] [\-\-public\-interface=<interface>] {\-\-reclock=<filename>} [\-\-single\-public\-ip=<address>] [\-\-socket=<filename>] [\-\-start\-as\-disabled] [\-\-syslog] [\-\-torture] [\-\-transport=<STRING>] [\-\-usage]
.fam
.SH "DESCRIPTION"
.PP
ctdbd is the main ctdb daemon\.
ctdbd is the main ctdb daemon\&.
.PP
ctdbd provides a clustered version of the TDB database with automatic rebuild/recovery of the databases upon nodefailures\.
ctdbd provides a clustered version of the TDB database with automatic rebuild/recovery of the databases upon nodefailures\&.
.PP
Combined with a cluster filesystem ctdbd provides a full HA environment for services such as clustered Samba and NFS as well as other services\.
Combined with a cluster filesystem ctdbd provides a full HA environment for services such as clustered Samba and NFS as well as other services\&.
.PP
ctdbd provides monitoring of all nodes in the cluster and automatically reconfigures the cluster and recovers upon node failures\.
ctdbd provides monitoring of all nodes in the cluster and automatically reconfigures the cluster and recovers upon node failures\&.
.PP
ctdbd is the main component in clustered Samba that provides a high\-availability load\-sharing CIFS server cluster\.
ctdbd is the main component in clustered Samba that provides a high\-availability load\-sharing CIFS server cluster\&.
.SH "OPTIONS"
.PP
\-? \-\-help
.RS 4
Print some help text to the screen\.
Print some help text to the screen\&.
.RE
.PP
\-d \-\-debug=<DEBUGLEVEL>
.RS 4
This option sets the debuglevel on the ctdbd daemon which controls what will be written to the logfile\. The default is 0 which will only log important events and errors\. A larger number will provide additional logging\.
This option sets the debuglevel on the ctdbd daemon which controls what will be written to the logfile\&. The default is 0 which will only log important events and errors\&. A larger number will provide additional logging\&.
.RE
.PP
\-\-dbdir=<directory>
.RS 4
This is the directory on local storage where ctdbd keeps the local copy of the TDB databases\. This directory is local for each node and should not be stored on the shared cluster filesystem\.
This is the directory on local storage where ctdbd keeps the local copy of the TDB databases\&. This directory is local for each node and should not be stored on the shared cluster filesystem\&.
.sp
This directory would usually be /var/ctdb \.
This directory would usually be /var/ctdb \&.
.RE
.PP
\-\-dbdir\-persistent=<directory>
.RS 4
This is the directory on local storage where ctdbd keeps the local copy of the persistent TDB databases\. This directory is local for each node and should not be stored on the shared cluster filesystem\.
This is the directory on local storage where ctdbd keeps the local copy of the persistent TDB databases\&. This directory is local for each node and should not be stored on the shared cluster filesystem\&.
.sp
This directory would usually be /etc/ctdb/persistent \.
This directory would usually be /etc/ctdb/persistent \&.
.RE
.PP
\-\-event\-script\-dir=<directory>
.RS 4
This option is used to specify the directory where the CTDB event scripts are stored\.
This option is used to specify the directory where the CTDB event scripts are stored\&.
.sp
This will normally be /etc/ctdb/events\.d which is part of the ctdb distribution\.
This will normally be /etc/ctdb/events\&.d which is part of the ctdb distribution\&.
.RE
.PP
\-i \-\-interactive
.RS 4
By default ctdbd will detach itself from the shell and run in the background as a daemon\. This option makes ctdbd to start in interactive mode\.
By default ctdbd will detach itself from the shell and run in the background as a daemon\&. This option makes ctdbd to start in interactive mode\&.
.RE
.PP
\-\-listen=<address>
.RS 4
This specifies which ip address ctdb will bind to\. By default ctdbd will bind to the first address it finds in the /etc/ctdb/nodes file and which is also present on the local system in which case you do not need to provide this option\.
This specifies which ip address ctdb will bind to\&. By default ctdbd will bind to the first address it finds in the /etc/ctdb/nodes file and which is also present on the local system in which case you do not need to provide this option\&.
.sp
This option is only required when you want to run multiple ctdbd daemons/nodes on the same physical host in which case there would be multiple entries in /etc/ctdb/nodes what would match a local interface\.
This option is only required when you want to run multiple ctdbd daemons/nodes on the same physical host in which case there would be multiple entries in /etc/ctdb/nodes what would match a local interface\&.
.RE
.PP
\-\-logfile=<filename>
.RS 4
This is the file where ctdbd will write its log\. This is usually /var/log/log\.ctdb \.
This is the file where ctdbd will write its log\&. This is usually /var/log/log\&.ctdb \&.
.RE
.PP
\-\-lvs
.RS 4
This option is used to activate the LVS capability on a CTDB node\. Please see the LVS section\.
This option is used to activate the LVS capability on a CTDB node\&. Please see the LVS section\&.
.RE
.PP
\-\-nlist=<filename>
.RS 4
This file contains a list of the private ip addresses of every node in the cluster\. There is one line/ip address for each node\. This file must be the same for all nodes in the cluster\.
This file contains a list of the private ip addresses of every node in the cluster\&. There is one line/ip address for each node\&. This file must be the same for all nodes in the cluster\&.
.sp
This file is usually /etc/ctdb/nodes \.
This file is usually /etc/ctdb/nodes \&.
.RE
.PP
\-\-no\-lmaster
.RS 4
This argument specifies that this node can NOT become an lmaster for records in the database\. This means that it will never show up in the vnnmap\. This feature is primarily used for making a cluster span across a WAN link and use CTDB as a WAN\-accelerator\.
This argument specifies that this node can NOT become an lmaster for records in the database\&. This means that it will never show up in the vnnmap\&. This feature is primarily used for making a cluster span across a WAN link and use CTDB as a WAN\-accelerator\&.
.sp
Please see the "remote cluster nodes" section for more information\.
Please see the "remote cluster nodes" section for more information\&.
.RE
.PP
\-\-no\-recmaster
.RS 4
This argument specifies that this node can NOT become a recmaster for the database\. This feature is primarily used for making a cluster span across a WAN link and use CTDB as a WAN\-accelerator\.
This argument specifies that this node can NOT become a recmaster for the database\&. This feature is primarily used for making a cluster span across a WAN link and use CTDB as a WAN\-accelerator\&.
.sp
Please see the "remote cluster nodes" section for more information\.
Please see the "remote cluster nodes" section for more information\&.
.RE
.PP
\-\-nosetsched
.RS 4
This is a ctdbd debugging option\. this option is only used when debugging ctdbd\.
This is a ctdbd debugging option\&. this option is only used when debugging ctdbd\&.
.sp
Normally ctdb will change its scheduler to run as a real\-time process\. This is the default mode for a normal ctdbd operation to gurarantee that ctdbd always gets the cpu cycles that it needs\.
Normally ctdb will change its scheduler to run as a real\-time process\&. This is the default mode for a normal ctdbd operation to gurarantee that ctdbd always gets the cpu cycles that it needs\&.
.sp
This option is used to tell ctdbd to NOT run as a real\-time process and instead run ctdbd as a normal userspace process\. This is useful for debugging and when you want to run ctdbd under valgrind or gdb\. (You dont want to attach valgrind or gdb to a real\-time process\.)
This option is used to tell ctdbd to NOT run as a real\-time process and instead run ctdbd as a normal userspace process\&. This is useful for debugging and when you want to run ctdbd under valgrind or gdb\&. (You dont want to attach valgrind or gdb to a real\-time process\&.)
.RE
.PP
\-\-public_addresses=<filename>
.RS 4
When used with IP takeover this specifies a file containing the public ip addresses to use on the cluster\. This file contains a list of ip addresses netmasks and interfaces\. When ctdb is operational it will distribute these public ip addresses evenly across the available nodes\.
When used with IP takeover this specifies a file containing the public ip addresses to use on the cluster\&. This file contains a list of ip addresses netmasks and interfaces\&. When ctdb is operational it will distribute these public ip addresses evenly across the available nodes\&.
.sp
This is usually the file /etc/ctdb/public_addresses
.RE
.PP
\-\-public\-interface=<interface>
.RS 4
This option tells ctdb which interface to attach public\-addresses to and also where to attach the single\-public\-ip when used\.
This option tells ctdb which interface to attach public\-addresses to and also where to attach the single\-public\-ip when used\&.
.sp
This is only required when using public ip addresses and only when you dont specify the interface explicitly in /etc/ctdb/public_addresses or when you are using \-\-single\-public\-ip\.
This is only required when using public ip addresses and only when you dont specify the interface explicitly in /etc/ctdb/public_addresses or when you are using \-\-single\-public\-ip\&.
.sp
If you omit this argument when using public addresses or single public ip, ctdb will not be able to send out Gratious ARPs correctly or be able to kill tcp connections correctly which will lead to application failures\.
If you omit this argument when using public addresses or single public ip, ctdb will not be able to send out Gratious ARPs correctly or be able to kill tcp connections correctly which will lead to application failures\&.
.RE
.PP
\-\-reclock=<filename>
.RS 4
This is the name of the lock file stored of the shared cluster filesystem that ctdbd uses to arbitrate which node has the role of recovery\-master\. This file must be stored on shared storage\.
This is the name of the lock file stored of the shared cluster filesystem that ctdbd uses to arbitrate which node has the role of recovery\-master\&. This file must be stored on shared storage\&.
.RE
.PP
\-\-single\-public\-ip=<address>
.RS 4
This option is used to activate the "ipmux" or the "lvs" functionality of ctdb where the cluster provides a single public ip address for the entire cluster\. When using this option you must also use the \-\-public\-interface option\.
This option is used to activate the "ipmux" or the "lvs" functionality of ctdb where the cluster provides a single public ip address for the entire cluster\&. When using this option you must also use the \-\-public\-interface option\&.
.sp
In this mode, all nodes of the cluster will expose a single ip address from all nodes with all incoming traffic to the cluster being passed through the current recmaster\. This functionality is similar to using a load\-balancing switch\.
In this mode, all nodes of the cluster will expose a single ip address from all nodes with all incoming traffic to the cluster being passed through the current recmaster\&. This functionality is similar to using a load\-balancing switch\&.
.sp
All incoming packets are sent to the recmaster which will multiplex the clients across all available nodes and pass the packets on to a different node in the cluster to manage the connection based on the clients ip address\. Outgoing packets however are sent directly from the node that was choosen back to the client\. Since all incoming packets are sent through the recmaster this will have a throughput and performance impact when used\. This impact in performance primarily affects write\-performance while read\-performance should be mainly unaffected\. Only use this feature if your environment is mostly\-read (i\.e\. most traffic is from the nodes back to the clients) or if it is not important to get maximum write\-performance to the cluster\.
All incoming packets are sent to the recmaster which will multiplex the clients across all available nodes and pass the packets on to a different node in the cluster to manage the connection based on the clients ip address\&. Outgoing packets however are sent directly from the node that was choosen back to the client\&. Since all incoming packets are sent through the recmaster this will have a throughput and performance impact when used\&. This impact in performance primarily affects write\-performance while read\-performance should be mainly unaffected\&. Only use this feature if your environment is mostly\-read (i\&.e\&. most traffic is from the nodes back to the clients) or if it is not important to get maximum write\-performance to the cluster\&.
.sp
This feature is completely controlled from the eventscripts and does not require any CTDBD involvement\. However, the CTDBD daemon does need to know that the "single public ip" exists so that the CTDBD daemon will allow clients to set up killtcp to work on this ip address\.
This feature is completely controlled from the eventscripts and does not require any CTDBD involvement\&. However, the CTDBD daemon does need to know that the "single public ip" exists so that the CTDBD daemon will allow clients to set up killtcp to work on this ip address\&.
.sp
CTDBD only allows clients to use killtcp to kill off (RST) tcp connections to/from an ip address that is either a normal public address or to/from the ip address specified by \-\-single\-public\-ip\. No other tcp connections are allowed to be specified with killtcp\.
CTDBD only allows clients to use killtcp to kill off (RST) tcp connections to/from an ip address that is either a normal public address or to/from the ip address specified by \-\-single\-public\-ip\&. No other tcp connections are allowed to be specified with killtcp\&.
.sp
Please note that ipmux is obsolete\. Use LVS, not ipmux\. Please see the LVS section in this manpage for instructions on how to configure and use CTDB with LVS\.
Please note that ipmux is obsolete\&. Use LVS, not ipmux\&. Please see the LVS section in this manpage for instructions on how to configure and use CTDB with LVS\&.
.RE
.PP
\-\-socket=<filename>
.RS 4
This specifies the name of the domain socket that ctdbd will create\. This socket is used for local clients to attach to and communicate with the ctdbd daemon\.
This specifies the name of the domain socket that ctdbd will create\&. This socket is used for local clients to attach to and communicate with the ctdbd daemon\&.
.sp
The default is /tmp/ctdb\.socket \. You only need to use this option if you plan to run multiple ctdbd daemons on the same physical host\.
The default is /tmp/ctdb\&.socket \&. You only need to use this option if you plan to run multiple ctdbd daemons on the same physical host\&.
.RE
.PP
\-\-start\-as\-disabled
.RS 4
This makes the ctdb daemon to be DISABLED when it starts up\.
This makes the ctdb daemon to be DISABLED when it starts up\&.
.sp
As it is DISABLED it will not get any of the public ip addresses allocated to it, and thus this allow you to start ctdb on a node without causing any ip address to failover from other nodes onto the new node\.
As it is DISABLED it will not get any of the public ip addresses allocated to it, and thus this allow you to start ctdb on a node without causing any ip address to failover from other nodes onto the new node\&.
.sp
When used, the administrator must keep track of when nodes start and manually enable them again using the "ctdb enable" command, or else the node will not host any services\.
When used, the administrator must keep track of when nodes start and manually enable them again using the "ctdb enable" command, or else the node will not host any services\&.
.sp
A node that is DISABLED will not host any services and will not be reachable/used by any clients\.
A node that is DISABLED will not host any services and will not be reachable/used by any clients\&.
.RE
.PP
\-\-syslog
.RS 4
Send all log messages to syslog instead of to the ctdb logfile\.
Send all log messages to syslog instead of to the ctdb logfile\&.
.RE
.PP
\-\-torture
.RS 4
This option is only used for development and testing of ctdbd\. It adds artificial errors and failures to the common codepaths in ctdbd to verify that ctdbd can recover correctly for failures\.
This option is only used for development and testing of ctdbd\&. It adds artificial errors and failures to the common codepaths in ctdbd to verify that ctdbd can recover correctly for failures\&.
.sp
You do NOT want to use this option unless you are developing and testing new functionality in ctdbd\.
You do NOT want to use this option unless you are developing and testing new functionality in ctdbd\&.
.RE
.PP
\-\-transport=<STRING>
.RS 4
This option specifies which transport to use for ctdbd internode communications\. The default is "tcp"\.
This option specifies which transport to use for ctdbd internode communications\&. The default is "tcp"\&.
.sp
Currently only "tcp" is supported but "infiniband" might be implemented in the future\.
Currently only "tcp" is supported but "infiniband" might be implemented in the future\&.
.RE
.PP
\-\-usage
.RS 4
Print useage information to the screen\.
Print useage information to the screen\&.
.RE
.SH "PRIVATE VS PUBLIC ADDRESSES"
.SH "Private vs Public addresses"
.PP
When used for ip takeover in a HA environment, each node in a ctdb cluster has multiple ip addresses assigned to it\. One private and one or more public\.
When used for ip takeover in a HA environment, each node in a ctdb cluster has multiple ip addresses assigned to it\&. One private and one or more public\&.
.SS "Private address"
.PP
This is the physical ip address of the node which is configured in linux and attached to a physical interface\. This address uniquely identifies a physical node in the cluster and is the ip addresses that ctdbd will use to communicate with the ctdbd daemons on the other nodes in the cluster\.
This is the physical ip address of the node which is configured in linux and attached to a physical interface\&. This address uniquely identifies a physical node in the cluster and is the ip addresses that ctdbd will use to communicate with the ctdbd daemons on the other nodes in the cluster\&.
.PP
The private addresses are configured in /etc/ctdb/nodes (unless the \-\-nlist option is used) and contain one line for each node in the cluster\. Each line contains the private ip address for one node in the cluster\. This file must be the same on all nodes in the cluster\.
The private addresses are configured in /etc/ctdb/nodes (unless the \-\-nlist option is used) and contain one line for each node in the cluster\&. Each line contains the private ip address for one node in the cluster\&. This file must be the same on all nodes in the cluster\&.
.PP
Since the private addresses are only available to the network when the corresponding node is up and running you should not use these addresses for clients to connect to services provided by the cluster\. Instead client applications should only attach to the public addresses since these are guaranteed to always be available\.
Since the private addresses are only available to the network when the corresponding node is up and running you should not use these addresses for clients to connect to services provided by the cluster\&. Instead client applications should only attach to the public addresses since these are guaranteed to always be available\&.
.PP
When using ip takeover, it is strongly recommended that the private addresses are configured on a private network physically separated from the rest of the network and that this private network is dedicated to CTDB traffic\.
When using ip takeover, it is strongly recommended that the private addresses are configured on a private network physically separated from the rest of the network and that this private network is dedicated to CTDB traffic\&.
Example /etc/ctdb/nodes for a four node cluster:
.sp
.if n \{\
.RS 4
.\}
.fam C
.ps -1
.nf
10\.1\.1\.1
10\.1\.1\.2
10\.1\.1\.3
10\.1\.1\.4
.if t \{\
.sp -1
.\}
.BB lightgray adjust-for-leading-newline
.sp -1
10\&.1\&.1\&.1
10\&.1\&.1\&.2
10\&.1\&.1\&.3
10\&.1\&.1\&.4
.EB lightgray adjust-for-leading-newline
.if t \{\
.sp 1
.\}
.fi
.fam
.ps +1
.if n \{\
.RE
.\}
.SS "Public address"
.PP
A public address on the other hand is not attached to an interface\. This address is managed by ctdbd itself and is attached/detached to a physical node at runtime\.
A public address on the other hand is not attached to an interface\&. This address is managed by ctdbd itself and is attached/detached to a physical node at runtime\&.
.PP
The ctdb cluster will assign/reassign these public addresses across the available healthy nodes in the cluster\. When one node fails, its public address will be migrated to and taken over by a different node in the cluster to ensure that all public addresses are always available to clients as long as there are still nodes available capable of hosting this address\.
The ctdb cluster will assign/reassign these public addresses across the available healthy nodes in the cluster\&. When one node fails, its public address will be migrated to and taken over by a different node in the cluster to ensure that all public addresses are always available to clients as long as there are still nodes available capable of hosting this address\&.
.PP
These addresses are not physically attached to a specific node\. The \'ctdb ip\' command can be used to view the current assignment of public addresses and which physical node is currently serving it\.
These addresses are not physically attached to a specific node\&. The \'ctdb ip\' command can be used to view the current assignment of public addresses and which physical node is currently serving it\&.
.PP
On each node this file contains a list of the public addresses that this node is capable of hosting\. The list also contain the netmask and the interface where this address should be attached for the case where you may want to serve data out through multiple different interfaces\.
On each node this file contains a list of the public addresses that this node is capable of hosting\&. The list also contain the netmask and the interface where this address should be attached for the case where you may want to serve data out through multiple different interfaces\&.
Example /etc/ctdb/public_addresses for a node that can host 4 public addresses:
.sp
.if n \{\
.RS 4
.\}
.fam C
.ps -1
.nf
11\.1\.1\.1/24 eth0
11\.1\.1\.2/24 eth0
11\.1\.2\.1/24 eth1
11\.1\.2\.2/24 eth1
.if t \{\
.sp -1
.\}
.BB lightgray adjust-for-leading-newline
.sp -1
11\&.1\&.1\&.1/24 eth0
11\&.1\&.1\&.2/24 eth0
11\&.1\&.2\&.1/24 eth1
11\&.1\&.2\&.2/24 eth1
.EB lightgray adjust-for-leading-newline
.if t \{\
.sp 1
.\}
.fi
.fam
.ps +1
.if n \{\
.RE
.\}
.PP
In most cases this file would be the same on all nodes in a cluster but there are exceptions when one may want to use different files on different nodes\.
In most cases this file would be the same on all nodes in a cluster but there are exceptions when one may want to use different files on different nodes\&.
Example: 4 nodes partitioned into two subgroups :
.sp
.if n \{\
.RS 4
.\}
.fam C
.ps -1
.nf
.if t \{\
.sp -1
.\}
.BB lightgray adjust-for-leading-newline
.sp -1
Node 0:/etc/ctdb/public_addresses
10\.1\.1\.1/24 eth0
10\.1\.1\.2/24 eth0
10\&.1\&.1\&.1/24 eth0
10\&.1\&.1\&.2/24 eth0
Node 1:/etc/ctdb/public_addresses
10\.1\.1\.1/24 eth0
10\.1\.1\.2/24 eth0
10\&.1\&.1\&.1/24 eth0
10\&.1\&.1\&.2/24 eth0
Node 2:/etc/ctdb/public_addresses
10\.2\.1\.1/24 eth0
10\.2\.1\.2/24 eth0
10\&.2\&.1\&.1/24 eth0
10\&.2\&.1\&.2/24 eth0
Node 3:/etc/ctdb/public_addresses
10\.2\.1\.1/24 eth0
10\.2\.1\.2/24 eth0
10\&.2\&.1\&.1/24 eth0
10\&.2\&.1\&.2/24 eth0
.EB lightgray adjust-for-leading-newline
.if t \{\
.sp 1
.\}
.fi
.fam
.ps +1
.if n \{\
.RE
.\}
.PP
In this example nodes 0 and 1 host two public addresses on the 10\.1\.1\.x network while nodes 2 and 3 host two public addresses for the 10\.2\.1\.x network\.
In this example nodes 0 and 1 host two public addresses on the 10\&.1\&.1\&.x network while nodes 2 and 3 host two public addresses for the 10\&.2\&.1\&.x network\&.
.PP
Ip address 10\.1\.1\.1 can be hosted by either of nodes 0 or 1 and will be available to clients as long as at least one of these two nodes are available\. If both nodes 0 and node 1 become unavailable 10\.1\.1\.1 also becomes unavailable\. 10\.1\.1\.1 can not be failed over to node 2 or node 3 since these nodes do not have this ip address listed in their public addresses file\.
.SH "NODE STATUS"
Ip address 10\&.1\&.1\&.1 can be hosted by either of nodes 0 or 1 and will be available to clients as long as at least one of these two nodes are available\&. If both nodes 0 and node 1 become unavailable 10\&.1\&.1\&.1 also becomes unavailable\&. 10\&.1\&.1\&.1 can not be failed over to node 2 or node 3 since these nodes do not have this ip address listed in their public addresses file\&.
.SH "Node status"
.PP
The current status of each node in the cluster can be viewed by the \'ctdb status\' command\.
The current status of each node in the cluster can be viewed by the \'ctdb status\' command\&.
.PP
There are five possible states for a node\.
There are five possible states for a node\&.
.PP
OK \- This node is fully functional\.
OK \- This node is fully functional\&.
.PP
DISCONNECTED \- This node could not be connected through the network and is currently not particpating in the cluster\. If there is a public IP address associated with this node it should have been taken over by a different node\. No services are running on this node\.
DISCONNECTED \- This node could not be connected through the network and is currently not particpating in the cluster\&. If there is a public IP address associated with this node it should have been taken over by a different node\&. No services are running on this node\&.
.PP
DISABLED \- This node has been administratively disabled\. This node is still functional and participates in the CTDB cluster but its IP addresses have been taken over by a different node and no services are currently being hosted\.
DISABLED \- This node has been administratively disabled\&. This node is still functional and participates in the CTDB cluster but its IP addresses have been taken over by a different node and no services are currently being hosted\&.
.PP
UNHEALTHY \- A service provided by this node is malfunctioning and should be investigated\. The CTDB daemon itself is operational and participates in the cluster\. Its public IP address has been taken over by a different node and no services are currently being hosted\. All unhealthy nodes should be investigated and require an administrative action to rectify\.
UNHEALTHY \- A service provided by this node is malfunctioning and should be investigated\&. The CTDB daemon itself is operational and participates in the cluster\&. Its public IP address has been taken over by a different node and no services are currently being hosted\&. All unhealthy nodes should be investigated and require an administrative action to rectify\&.
.PP
BANNED \- This node failed too many recovery attempts and has been banned from participating in the cluster for a period of RecoveryBanPeriod seconds\. Any public IP address has been taken over by other nodes\. This node does not provide any services\. All banned nodes should be investigated and require an administrative action to rectify\. This node does not perticipate in the CTDB cluster but can still be communicated with\. I\.e\. ctdb commands can be sent to it\.
BANNED \- This node failed too many recovery attempts and has been banned from participating in the cluster for a period of RecoveryBanPeriod seconds\&. Any public IP address has been taken over by other nodes\&. This node does not provide any services\&. All banned nodes should be investigated and require an administrative action to rectify\&. This node does not perticipate in the CTDB cluster but can still be communicated with\&. I\&.e\&. ctdb commands can be sent to it\&.
.SH "PUBLIC TUNABLES"
.PP
These are the public tuneables that can be used to control how ctdb behaves\.
These are the public tuneables that can be used to control how ctdb behaves\&.
.SS "KeepaliveInterval"
.PP
Default: 1
.PP
How often should the nodes send keepalives to eachother\.
How often should the nodes send keepalives to eachother\&.
.SS "KeepaliveLimit"
.PP
Default: 5
.PP
After how many keepalive intervals without any traffic should a node wait until marking the peer as DISCONNECTED\.
After how many keepalive intervals without any traffic should a node wait until marking the peer as DISCONNECTED\&.
.SS "MonitorInterval"
.PP
Default: 15
.PP
How often should ctdb run the event scripts to check for a nodes health\.
How often should ctdb run the event scripts to check for a nodes health\&.
.SS "TickleUpdateInterval"
.PP
Default: 20
.PP
How often will ctdb record and store the "tickle" information used to kickstart stalled tcp connections after a recovery\.
How often will ctdb record and store the "tickle" information used to kickstart stalled tcp connections after a recovery\&.
.SS "EventScriptTimeout"
.PP
Default: 20
.PP
How long should ctdb let an event script run before aborting it and marking the node unhealthy\.
How long should ctdb let an event script run before aborting it and marking the node unhealthy\&.
.SS "RecoveryBanPeriod"
.PP
Default: 300
.PP
If a node becomes banned causing repetitive recovery failures\. The node will eventually become banned from the cluster\. This controls how long the culprit node will be banned from the cluster before it is allowed to try to join the cluster again\. Dont set to small\. A node gets banned for a reason and it is usually due to real problems with the node\.
If a node becomes banned causing repetitive recovery failures\&. The node will eventually become banned from the cluster\&. This controls how long the culprit node will be banned from the cluster before it is allowed to try to join the cluster again\&. Dont set to small\&. A node gets banned for a reason and it is usually due to real problems with the node\&.
.SS "DatabaseHashSize"
.PP
Default: 100000
.PP
Size of the hash chains for the local store of the tdbs that ctdb manages\.
Size of the hash chains for the local store of the tdbs that ctdb manages\&.
.SS "RerecoveryTimeout"
.PP
Default: 10
.PP
Once a recovery has completed, no additional recoveries are permitted until this timeout has expired\.
Once a recovery has completed, no additional recoveries are permitted until this timeout has expired\&.
.SS "EnableBans"
.PP
Default: 1
.PP
When set to 0, this disables BANNING completely in the cluster and thus nodes can not get banned, even it they break\. Dont set to 0\.
When set to 0, this disables BANNING completely in the cluster and thus nodes can not get banned, even it they break\&. Dont set to 0\&.
.SS "DeterministicIPs"
.PP
Default: 1
.PP
When enabled, this tunable makes ctdb try to keep public IP addresses locked to specific nodes as far as possible\. This makes it easier for debugging since you can know that as long as all nodes are healthy public IP X will always be hosted by node Y\.
When enabled, this tunable makes ctdb try to keep public IP addresses locked to specific nodes as far as possible\&. This makes it easier for debugging since you can know that as long as all nodes are healthy public IP X will always be hosted by node Y\&.
.PP
The cost of using deterministic IP address assignment is that it disables part of the logic where ctdb tries to reduce the number of public IP assignment changes in the cluster\. This tunable may increase the number of IP failover/failbacks that are performed on the cluster by a small margin\.
The cost of using deterministic IP address assignment is that it disables part of the logic where ctdb tries to reduce the number of public IP assignment changes in the cluster\&. This tunable may increase the number of IP failover/failbacks that are performed on the cluster by a small margin\&.
.SS "DisableWhenUnhealthy"
.PP
Default: 0
.PP
When set, As soon as a node becomes unhealthy, that node will also automatically become permanently DISABLED\. Once a node is DISABLED, the only way to make it participate in the cluster again and host services is by manually enabling the node again using \'ctdb enable\'\.
When set, As soon as a node becomes unhealthy, that node will also automatically become permanently DISABLED\&. Once a node is DISABLED, the only way to make it participate in the cluster again and host services is by manually enabling the node again using \'ctdb enable\'\&.
.PP
This disables parts of the resilience and robustness of the cluster and should ONLY be used when the system administrator is actively monitoring the cluster, so that nodes can be enabled again\.
This disables parts of the resilience and robustness of the cluster and should ONLY be used when the system administrator is actively monitoring the cluster, so that nodes can be enabled again\&.
.SS "NoIPFailback"
.PP
Default: 0
.PP
When set to 1, ctdb will not perform failback of IP addresses when a node becomes healthy\. Ctdb WILL perform failover of public IP addresses when a node becomes UNHEALTHY, but when the node becomes HEALTHY again, ctdb will not fail the addresses back\.
When set to 1, ctdb will not perform failback of IP addresses when a node becomes healthy\&. Ctdb WILL perform failover of public IP addresses when a node becomes UNHEALTHY, but when the node becomes HEALTHY again, ctdb will not fail the addresses back\&.
.PP
Use with caution! Normally when a node becomes available to the cluster ctdb will try to reassign public IP addresses onto the new node as a way to distribute the workload evenly across the clusternode\. Ctdb tries to make sure that all running nodes have approximately the same number of public addresses it hosts\.
Use with caution! Normally when a node becomes available to the cluster ctdb will try to reassign public IP addresses onto the new node as a way to distribute the workload evenly across the clusternode\&. Ctdb tries to make sure that all running nodes have approximately the same number of public addresses it hosts\&.
.PP
When you enable this tunable, CTDB will no longer attempt to rebalance the cluster by failing IP addresses back to the new nodes\. An unbalanced cluster will therefore remain unbalanced until there is manual intervention from the administrator\. When this parameter is set, you can manually fail public IP addresses over to the new node(s) using the \'ctdb moveip\' command\.
When you enable this tunable, CTDB will no longer attempt to rebalance the cluster by failing IP addresses back to the new nodes\&. An unbalanced cluster will therefore remain unbalanced until there is manual intervention from the administrator\&. When this parameter is set, you can manually fail public IP addresses over to the new node(s) using the \'ctdb moveip\' command\&.
.SH "LVS"
.PP
LVS is a mode where CTDB presents one single IP address for the entire cluster\. This is an alternative to using public IP addresses and round\-robin DNS to loadbalance clients across the cluster\.
LVS is a mode where CTDB presents one single IP address for the entire cluster\&. This is an alternative to using public IP addresses and round\-robin DNS to loadbalance clients across the cluster\&.
.PP
This is similar to using a layer\-4 loadbalancing switch but with some restrictions\.
This is similar to using a layer\-4 loadbalancing switch but with some restrictions\&.
.PP
In this mode the cluster select a set of nodes in the cluster and loadbalance all client access to the LVS address across this set of nodes\. This set of nodes are all LVS capable nodes that are HEALTHY, or if no HEALTHY nodes exists all LVS capable nodes regardless of health status\. LVS will however never loadbalance traffic to nodes that are BANNED, DISABLED or DISCONNECTED\. The "ctdb lvs" command is used to show which nodes are currently load\-balanced across\.
In this mode the cluster select a set of nodes in the cluster and loadbalance all client access to the LVS address across this set of nodes\&. This set of nodes are all LVS capable nodes that are HEALTHY, or if no HEALTHY nodes exists all LVS capable nodes regardless of health status\&. LVS will however never loadbalance traffic to nodes that are BANNED, DISABLED or DISCONNECTED\&. The "ctdb lvs" command is used to show which nodes are currently load\-balanced across\&.
.PP
One of the these nodes are elected as the LVSMASTER\. This node receives all traffic from clients coming in to the LVS 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 LVSMASTER node\. The command "ctdb lvsmaster" will show which node is the current LVSMASTER\.
One of the these nodes are elected as the LVSMASTER\&. This node receives all traffic from clients coming in to the LVS 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 LVSMASTER node\&. The command "ctdb lvsmaster" will show which node is the current LVSMASTER\&.
.PP
The path used for a client i/o is thus :
.sp
.if n \{\
.RS 4
.\}
.fam C
.ps -1
.nf
.if t \{\
.sp -1
.\}
.BB lightgray adjust-for-leading-newline
.sp -1
(1) Client sends request packet to LVSMASTER
(2) LVSMASTER passes the request on to one node across the internal network\.
(3) Selected node processes the request\.
(4) Node responds back to client\.
(2) LVSMASTER passes the request on to one node across the internal network\&.
(3) Selected node processes the request\&.
(4) Node responds back to client\&.
.EB lightgray adjust-for-leading-newline
.if t \{\
.sp 1
.\}
.fi
.fam
.ps +1
.if n \{\
.RE
.\}
.PP
This means that all incoming traffic to the cluster will pass through one physical node, which limits scalability\. You can send more data to the LVS address that one physical node can multiplex\. This means that you should not use LVS if your I/O pattern is write\-intensive since you will be limited in the available network bandwidth that node can handle\. LVS does work wery well for read\-intensive workloads where only smallish READ requests are going through the LVSMASTER 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 acheive very high throughput rates in this mode\.
This means that all incoming traffic to the cluster will pass through one physical node, which limits scalability\&. You can send more data to the LVS address that one physical node can multiplex\&. This means that you should not use LVS if your I/O pattern is write\-intensive since you will be limited in the available network bandwidth that node can handle\&. LVS does work wery well for read\-intensive workloads where only smallish READ requests are going through the LVSMASTER 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 acheive very high throughput rates in this mode\&.
.PP
Note: you can use LVS and public addresses at the same time\.
Note: you can use LVS and public addresses at the same time\&.
.SS "Configuration"
.PP
To activate LVS on a CTDB node you must specify CTDB_PUBLIC_INTERFACE and CTDB_LVS_PUBLIC_ADDRESS in /etc/sysconfig/ctdb\.
To activate LVS on a CTDB node you must specify CTDB_PUBLIC_INTERFACE and CTDB_LVS_PUBLIC_ADDRESS in /etc/sysconfig/ctdb\&.
.PP
You must also specify the "\-\-lvs" command line argument to ctdbd to activete LVS as a capability of the node\. This should be done automatically for you by the /etc/init\.d/ctdb script\.
You must also specify the "\-\-lvs" command line argument to ctdbd to activete LVS as a capability of the node\&. This should be done automatically for you by the /etc/init\&.d/ctdb script\&.
.PP
Example:
.sp
.if n \{\
.RS 4
.\}
.fam C
.ps -1
.nf
.if t \{\
.sp -1
.\}
.BB lightgray adjust-for-leading-newline
.sp -1
CTDB_PUBLIC_INTERFACE=eth0
CTDB_LVS_PUBLIC_IP=10\.0\.0\.237
CTDB_LVS_PUBLIC_IP=10\&.0\&.0\&.237
.EB lightgray adjust-for-leading-newline
.if t \{\
.sp 1
.\}
.fi
.fam
.ps +1
.if n \{\
.RE
.\}
.PP
If you use LVS, you must still have a real/permanent address configured for the public interface on each node\. This address must be routable and the cluster nodes must be configured so that all traffic back to client hosts are routed through this interface\. This is also required in order to allow samba/winbind on the node to talk to the domain controller\. (we can not use the lvs IP address to initiate outgoing traffic)
If you use LVS, you must still have a real/permanent address configured for the public interface on each node\&. This address must be routable and the cluster nodes must be configured so that all traffic back to client hosts are routed through this interface\&. This is also required in order to allow samba/winbind on the node to talk to the domain controller\&. (we can not use the lvs IP address to initiate outgoing traffic)
.PP
I\.e\. make sure that you can "ping" both the domain controller and also all of the clients from the node BEFORE you enable LVS\. Also make sure that when you ping these hosts that the traffic is routed out through the eth0 interface\.
I\&.e\&. make sure that you can "ping" both the domain controller and also all of the clients from the node BEFORE you enable LVS\&. Also make sure that when you ping these hosts that the traffic is routed out through the eth0 interface\&.
.SH "REMOTE CLUSTER NODES"
.PP
It is possible to have a CTDB cluster that spans across a WAN link\. For example where you have a CTDB cluster in your datacentre but you also want to have one additional CTDB node located at a remote branch site\. This is similar to how a WAN accelerator works but with the difference that while a WAN\-accelerator often acts as a Proxy or a MitM, in the ctdb remote cluster node configuration the Samba instance at the remote site IS the genuine server, not a proxy and not a MitM, and thus provides 100% correct CIFS semantics to clients\.
It is possible to have a CTDB cluster that spans across a WAN link\&. For example where you have a CTDB cluster in your datacentre but you also want to have one additional CTDB node located at a remote branch site\&. This is similar to how a WAN accelerator works but with the difference that while a WAN\-accelerator often acts as a Proxy or a MitM, in the ctdb remote cluster node configuration the Samba instance at the remote site IS the genuine server, not a proxy and not a MitM, and thus provides 100% correct CIFS semantics to clients\&.
.PP
See the cluster as one single multihomed samba server where one of the NICs (the remote node) is very far away\.
See the cluster as one single multihomed samba server where one of the NICs (the remote node) is very far away\&.
.PP
NOTE: This does require that the cluster filesystem you use can cope with WAN\-link latencies\. Not all cluster filesystems can handle WAN\-link latencies! Whether this will provide very good WAN\-accelerator performance or it will perform very poorly depends entirely on how optimized your cluster filesystem is in handling high latency for data and metadata operations\.
NOTE: This does require that the cluster filesystem you use can cope with WAN\-link latencies\&. Not all cluster filesystems can handle WAN\-link latencies! Whether this will provide very good WAN\-accelerator performance or it will perform very poorly depends entirely on how optimized your cluster filesystem is in handling high latency for data and metadata operations\&.
.PP
To activate a node as being a remote cluster node you need to set the following two parameters in /etc/sysconfig/ctdb for the remote node:
.sp
.if n \{\
.RS 4
.\}
.fam C
.ps -1
.nf
.if t \{\
.sp -1
.\}
.BB lightgray adjust-for-leading-newline
.sp -1
CTDB_CAPABILITY_LMASTER=no
CTDB_CAPABILITY_RECMASTER=no
.EB lightgray adjust-for-leading-newline
.if t \{\
.sp 1
.\}
.fi
.fam
.ps +1
.if n \{\
.RE
.\}
.PP
Verify with the command "ctdb getcapabilities" that that node no longer has the recmaster or the lmaster capabilities\.
Verify with the command "ctdb getcapabilities" that that node no longer has the recmaster or the lmaster capabilities\&.
.SH "SEE ALSO"
.PP
ctdb(1), onnode(1)
\fI\%http://ctdb.samba.org/\fR
\m[blue]\fB\%http://ctdb.samba.org/\fR\m[]
.SH "COPYRIGHT/LICENSE"
.sp
.if n \{\
.RS 4
.\}
.fam C
.ps -1
.nf
.if t \{\
.sp -1
.\}
.BB lightgray adjust-for-leading-newline
.sp -1
Copyright (C) Andrew Tridgell 2007
Copyright (C) Ronnie sahlberg 2007
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or (at
your option) any later version\.
your option) any later version\&.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE\. See the GNU
General Public License for more details\.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE\&. See the GNU
General Public License for more details\&.
You should have received a copy of the GNU General Public License
along with this program; if not, see http://www\.gnu\.org/licenses/\.
along with this program; if not, see http://www\&.gnu\&.org/licenses/\&.
.EB lightgray adjust-for-leading-newline
.if t \{\
.sp 1
.\}
.fi
.fam
.ps +1
.if n \{\
.RE
.\}

View File

@ -303,6 +303,10 @@ int ctdb_ctrl_getnodemap(struct ctdb_context *ctdb,
struct timeval timeout, uint32_t destnode,
TALLOC_CTX *mem_ctx, struct ctdb_node_map **nodemap);
int ctdb_ctrl_getnodemapv4(struct ctdb_context *ctdb,
struct timeval timeout, uint32_t destnode,
TALLOC_CTX *mem_ctx, struct ctdb_node_map **nodemap);
int ctdb_ctrl_reload_nodes_file(struct ctdb_context *ctdb,
struct timeval timeout, uint32_t destnode);

View File

@ -476,7 +476,7 @@ enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS = 0,
CTDB_CONTROL_GET_DEBUG = 7,
CTDB_CONTROL_SET_DEBUG = 8,
CTDB_CONTROL_GET_DBMAP = 9,
CTDB_CONTROL_GET_NODEMAP = 10,
CTDB_CONTROL_GET_NODEMAPv4 = 10, /* obsolete */
CTDB_CONTROL_SET_DMASTER = 11,
/* #12 removed */
CTDB_CONTROL_PULL_DB = 13,
@ -508,8 +508,8 @@ enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS = 0,
/* #39 removed */
/* #40 removed */
/* #41 removed */
CTDB_CONTROL_TAKEOVER_IP = 42,
CTDB_CONTROL_RELEASE_IP = 43,
CTDB_CONTROL_TAKEOVER_IPv4 = 42, /* obsolete */
CTDB_CONTROL_RELEASE_IPv4 = 43, /* obsolete */
CTDB_CONTROL_TCP_CLIENT = 44,
CTDB_CONTROL_TCP_ADD = 45,
CTDB_CONTROL_TCP_REMOVE = 46,
@ -517,7 +517,7 @@ enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS = 0,
CTDB_CONTROL_SET_TUNABLE = 48,
CTDB_CONTROL_GET_TUNABLE = 49,
CTDB_CONTROL_LIST_TUNABLES = 50,
CTDB_CONTROL_GET_PUBLIC_IPS = 51,
CTDB_CONTROL_GET_PUBLIC_IPSv4 = 51, /* obsolete */
CTDB_CONTROL_MODIFY_FLAGS = 52,
CTDB_CONTROL_GET_ALL_TUNABLES = 53,
CTDB_CONTROL_KILL_TCP = 54,
@ -554,6 +554,10 @@ enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS = 0,
CTDB_CONTROL_TRANS2_ERROR = 85,
CTDB_CONTROL_TRANS2_COMMIT_RETRY = 86,
CTDB_CONTROL_RECD_PING = 87,
CTDB_CONTROL_RELEASE_IP = 88,
CTDB_CONTROL_TAKEOVER_IP = 89,
CTDB_CONTROL_GET_PUBLIC_IPS = 90,
CTDB_CONTROL_GET_NODEMAP = 91,
};
/*
@ -1014,6 +1018,7 @@ ctdb_control_send(struct ctdb_context *ctdb,
int ctdb_control_getvnnmap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA indata, TDB_DATA *outdata);
int ctdb_control_setvnnmap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA indata, TDB_DATA *outdata);
int ctdb_control_getdbmap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA indata, TDB_DATA *outdata);
int ctdb_control_getnodemapv4(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA indata, TDB_DATA *outdata);
int ctdb_control_getnodemap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA indata, TDB_DATA *outdata);
int ctdb_control_writerecord(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA indata, TDB_DATA *outdata);
@ -1096,6 +1101,17 @@ struct ctdb_node_map {
struct ctdb_node_and_flags nodes[1];
};
struct ctdb_node_and_flagsv4 {
uint32_t pnn;
uint32_t flags;
struct sockaddr_in sin;
};
struct ctdb_node_mapv4 {
uint32_t num;
struct ctdb_node_and_flagsv4 nodes[1];
};
struct ctdb_control_wipe_database {
uint32_t db_id;
uint32_t transaction_id;
@ -1180,10 +1196,18 @@ int32_t ctdb_control_takeover_ip(struct ctdb_context *ctdb,
struct ctdb_req_control *c,
TDB_DATA indata,
bool *async_reply);
int32_t ctdb_control_takeover_ipv4(struct ctdb_context *ctdb,
struct ctdb_req_control *c,
TDB_DATA indata,
bool *async_reply);
int32_t ctdb_control_release_ip(struct ctdb_context *ctdb,
struct ctdb_req_control *c,
TDB_DATA indata,
bool *async_reply);
int32_t ctdb_control_release_ipv4(struct ctdb_context *ctdb,
struct ctdb_req_control *c,
TDB_DATA indata,
bool *async_reply);
int32_t ctdb_control_start_recovery(struct ctdb_context *ctdb,
struct ctdb_req_control *c,
bool *async_reply);
@ -1191,6 +1215,11 @@ int32_t ctdb_control_end_recovery(struct ctdb_context *ctdb,
struct ctdb_req_control *c,
bool *async_reply);
struct ctdb_public_ipv4 {
uint32_t pnn;
struct sockaddr_in sin;
};
struct ctdb_public_ip {
uint32_t pnn;
ctdb_sock_addr addr;
@ -1200,14 +1229,23 @@ int ctdb_ctrl_takeover_ip(struct ctdb_context *ctdb, struct timeval timeout,
int ctdb_ctrl_release_ip(struct ctdb_context *ctdb, struct timeval timeout,
uint32_t destnode, struct ctdb_public_ip *ip);
struct ctdb_all_public_ipsv4 {
uint32_t num;
struct ctdb_public_ipv4 ips[1];
};
struct ctdb_all_public_ips {
uint32_t num;
struct ctdb_public_ip ips[1];
};
int32_t ctdb_control_get_public_ipsv4(struct ctdb_context *ctdb, struct ctdb_req_control *c, TDB_DATA *outdata);
int32_t ctdb_control_get_public_ips(struct ctdb_context *ctdb, struct ctdb_req_control *c, TDB_DATA *outdata);
int ctdb_ctrl_get_public_ips(struct ctdb_context *ctdb,
struct timeval timeout, uint32_t destnode,
TALLOC_CTX *mem_ctx, struct ctdb_all_public_ips **ips);
int ctdb_ctrl_get_public_ipsv4(struct ctdb_context *ctdb,
struct timeval timeout, uint32_t destnode,
TALLOC_CTX *mem_ctx, struct ctdb_all_public_ips **ips);
/* from takeover/system.c */
@ -1271,6 +1309,7 @@ void ctdb_start_freeze(struct ctdb_context *ctdb);
bool parse_ip_mask(const char *s, ctdb_sock_addr *addr, unsigned *mask);
bool parse_ip_port(const char *s, ctdb_sock_addr *addr);
bool parse_ip(const char *s, ctdb_sock_addr *addr);
bool parse_ipv4(const char *s, unsigned port, struct sockaddr_in *sin);
int ctdb_sys_open_capture_socket(const char *iface, void **private_data);

View File

@ -5,7 +5,7 @@ Vendor: Samba Team
Packager: Samba Team <samba@samba.org>
Name: ctdb
Version: 1.0
Release: 58
Release: 60
Epoch: 0
License: GNU GPL version 3
Group: System Environment/Daemons
@ -104,6 +104,7 @@ fi
%{_sysconfdir}/ctdb/events.d/70.iscsi
%{_sysconfdir}/ctdb/events.d/90.ipmux
%{_sysconfdir}/ctdb/events.d/91.lvs
%{_sysconfdir}/ctdb/events.d/99.routing
%{_sysconfdir}/ctdb/statd-callout
%{_sbindir}/ctdbd
%{_bindir}/ctdb
@ -118,6 +119,26 @@ fi
%{_includedir}/ctdb_private.h
%changelog
* Wed Oct 15 2008 : Version 1.0.60
- Verify that nodes we try to ban/unban are reachable and print an error othervise.
- Update the client and server sides of TAKEIP/RELEASEIP/GETPUBLICIPS and GETNODEMAP to fall back to the old style ipv4-only controls if the new ipv4/ipv6 controls fail. This allows an ipv4/v6 enabled ctdb daemon to interoperate with earlier ipv4-only versions of the daemons.
- From Mathieu Parent : log debian systems log the package versions in ctdb diagnostics
- From Mathieu Parent : specify logdir location for debian (this patch was later reversed)
- From Michael Adams : allow # comments in nodes/public_addresses files
* Tue Oct 7 2008 : Version 1.0.59
- Updated "reloadnodes" logic. Instead of bouncing the entire tcp layer it is sufficient to just close and reopen all outgoing tcp connections.
- New eventscript 99.routing which can be used to re-attach routes to public interfaces after a takeip event. (routes may be deleted by the kernel when we release an ip)
- IDR tree fix from Jim Houston
- Better handling of critical events if the local clock is suddenly changed forward by a lot.
- Fix three slow memory leaks in the recovery daemon
- New ctdb command : ctdb recmaster which prints the pnn of the recmaster
- Onnode enhancements from Martin S : "healthy" and "connected" are now possible nodespecifiers
- From Martin S : doc fixes
- lowering some debug levels for some nonvital informational messages
- Make the daemon daemon monitoring stronger and allow ctdbd to detect a hung
recovery daemon.
- From C Cowan : patches to compile ipv6 under AIX
- zero out some structs to keep valgrind happy
* Wed Aug 27 2008 : Version 1.0.58
- revert the name change tcp_tcp_client back to tcp_control_tcp so
samba can build.

View File

@ -131,6 +131,9 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
case CTDB_CONTROL_GET_DBMAP:
return ctdb_control_getdbmap(ctdb, opcode, indata, outdata);
case CTDB_CONTROL_GET_NODEMAPv4:
return ctdb_control_getnodemapv4(ctdb, opcode, indata, outdata);
case CTDB_CONTROL_GET_NODEMAP:
return ctdb_control_getnodemap(ctdb, opcode, indata, outdata);
@ -283,14 +286,26 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
DEBUG(DEBUG_NOTICE,("Received SHUTDOWN command. Stopping CTDB daemon.\n"));
exit(0);
case CTDB_CONTROL_TAKEOVER_IPv4:
CHECK_CONTROL_DATA_SIZE(sizeof(struct ctdb_public_ipv4));
return ctdb_control_takeover_ipv4(ctdb, c, indata, async_reply);
case CTDB_CONTROL_TAKEOVER_IP:
CHECK_CONTROL_DATA_SIZE(sizeof(struct ctdb_public_ip));
return ctdb_control_takeover_ip(ctdb, c, indata, async_reply);
case CTDB_CONTROL_RELEASE_IPv4:
CHECK_CONTROL_DATA_SIZE(sizeof(struct ctdb_public_ipv4));
return ctdb_control_release_ipv4(ctdb, c, indata, async_reply);
case CTDB_CONTROL_RELEASE_IP:
CHECK_CONTROL_DATA_SIZE(sizeof(struct ctdb_public_ip));
return ctdb_control_release_ip(ctdb, c, indata, async_reply);
case CTDB_CONTROL_GET_PUBLIC_IPSv4:
CHECK_CONTROL_DATA_SIZE(0);
return ctdb_control_get_public_ipsv4(ctdb, c, outdata);
case CTDB_CONTROL_GET_PUBLIC_IPS:
CHECK_CONTROL_DATA_SIZE(0);
return ctdb_control_get_public_ips(ctdb, c, outdata);

View File

@ -174,32 +174,57 @@ ctdb_control_getnodemap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA ind
return 0;
}
/*
get an old style ipv4-only nodemap
*/
int
ctdb_control_getnodemapv4(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA indata, TDB_DATA *outdata)
{
uint32_t i, num_nodes;
struct ctdb_node_mapv4 *node_map;
CHECK_CONTROL_DATA_SIZE(0);
num_nodes = ctdb->num_nodes;
outdata->dsize = offsetof(struct ctdb_node_mapv4, nodes) + num_nodes*sizeof(struct ctdb_node_and_flagsv4);
outdata->dptr = (unsigned char *)talloc_zero_size(outdata, outdata->dsize);
if (!outdata->dptr) {
DEBUG(DEBUG_ALERT, (__location__ " Failed to allocate nodemap array\n"));
exit(1);
}
node_map = (struct ctdb_node_mapv4 *)outdata->dptr;
node_map->num = num_nodes;
for (i=0; i<num_nodes; i++) {
if (parse_ipv4(ctdb->nodes[i]->address.address, 0, &node_map->nodes[i].sin) == 0) {
DEBUG(DEBUG_ERR, (__location__ " Failed to parse %s into a sockaddr\n", ctdb->nodes[i]->address.address));
return -1;
}
node_map->nodes[i].pnn = ctdb->nodes[i]->pnn;
node_map->nodes[i].flags = ctdb->nodes[i]->flags;
}
return 0;
}
static void
ctdb_reload_nodes_event(struct event_context *ev, struct timed_event *te,
struct timeval t, void *private_data)
{
int ret;
int i;
struct ctdb_context *ctdb = talloc_get_type(private_data, struct ctdb_context);
int ctdb_tcp_init(struct ctdb_context *);
/* shut down the transport */
if (ctdb->methods != NULL) {
ctdb->methods->shutdown(ctdb);
}
/* start the transport again */
ctdb_load_nodes_file(ctdb);
ret = ctdb_tcp_init(ctdb);
if (ret != 0) {
DEBUG(DEBUG_CRIT, (__location__ " Failed to init TCP\n"));
exit(1);
}
if (ctdb->methods == NULL) {
DEBUG(DEBUG_ALERT,(__location__ " Can not restart transport. ctdb->methods==NULL\n"));
ctdb_fatal(ctdb, "can not reinitialize transport.");
for (i=0; i<ctdb->num_nodes; i++) {
if (ctdb->methods->add_node(ctdb->nodes[i]) != 0) {
DEBUG(DEBUG_CRIT, (__location__ " methods->add_node failed at %d\n", i));
ctdb_fatal(ctdb, "failed to add node. shutting down\n");
}
}
ctdb->methods->initialise(ctdb);
ctdb->methods->start(ctdb);
return;

View File

@ -158,7 +158,20 @@ int ctdb_set_nlist(struct ctdb_context *ctdb, const char *nlist)
}
for (i=0;i<nlines;i++) {
if (ctdb_add_node(ctdb, lines[i]) != 0) {
char *node;
node = lines[i];
/* strip leading spaces */
while((*node == ' ') || (*node == '\t')) {
node++;
}
if (*node == '#') {
continue;
}
if (strcmp(node, "") == 0) {
continue;
}
if (ctdb_add_node(ctdb, node) != 0) {
talloc_free(lines);
return -1;
}

View File

@ -256,6 +256,24 @@ int32_t ctdb_control_takeover_ip(struct ctdb_context *ctdb,
return 0;
}
/*
takeover an ip address old v4 style
*/
int32_t ctdb_control_takeover_ipv4(struct ctdb_context *ctdb,
struct ctdb_req_control *c,
TDB_DATA indata,
bool *async_reply)
{
TDB_DATA data;
data.dsize = sizeof(struct ctdb_public_ip);
data.dptr = (uint8_t *)talloc_zero(c, struct ctdb_public_ip);
CTDB_NO_MEMORY(ctdb, data.dptr);
memcpy(data.dptr, indata.dptr, indata.dsize);
return ctdb_control_takeover_ip(ctdb, c, data, async_reply);
}
/*
kill any clients that are registered with a IP that is being released
*/
@ -390,6 +408,23 @@ int32_t ctdb_control_release_ip(struct ctdb_context *ctdb,
return 0;
}
/*
release an ip address old v4 style
*/
int32_t ctdb_control_release_ipv4(struct ctdb_context *ctdb,
struct ctdb_req_control *c,
TDB_DATA indata,
bool *async_reply)
{
TDB_DATA data;
data.dsize = sizeof(struct ctdb_public_ip);
data.dptr = (uint8_t *)talloc_zero(c, struct ctdb_public_ip);
CTDB_NO_MEMORY(ctdb, data.dptr);
memcpy(data.dptr, indata.dptr, indata.dsize);
return ctdb_control_release_ip(ctdb, c, data, async_reply);
}
static int ctdb_add_public_address(struct ctdb_context *ctdb, ctdb_sock_addr *addr, unsigned mask, const char *iface)
@ -451,9 +486,19 @@ int ctdb_set_public_addresses(struct ctdb_context *ctdb, const char *alist)
unsigned mask;
ctdb_sock_addr addr;
const char *iface;
char *tok;
char *tok, *line;
tok = strtok(lines[i], " \t");
line = lines[i];
while ((*line == ' ') || (*line == '\t')) {
line++;
}
if (*line == '#') {
continue;
}
if (strcmp(line, "") == 0) {
continue;
}
tok = strtok(line, " \t");
if (!tok || !parse_ip_mask(tok, &addr, &mask)) {
DEBUG(DEBUG_CRIT,("Badly formed line %u in public address list\n", i+1));
talloc_free(lines);
@ -645,6 +690,7 @@ int ctdb_takeover_run(struct ctdb_context *ctdb, struct ctdb_node_map *nodemap)
{
int i, num_healthy, retries;
struct ctdb_public_ip ip;
struct ctdb_public_ipv4 ipv4;
uint32_t mask;
struct ctdb_public_ip_list *all_ips, *tmp_ip;
int maxnode, maxnum=0, minnode, minnum=0, num;
@ -867,16 +913,30 @@ finished:
*/
continue;
}
ip.pnn = tmp_ip->pnn;
ip.addr = tmp_ip->addr;
if (tmp_ip->addr.sa.sa_family == AF_INET) {
ipv4.pnn = tmp_ip->pnn;
ipv4.sin = tmp_ip->addr.ip;
timeout = TAKEOVER_TIMEOUT();
data.dsize = sizeof(ipv4);
data.dptr = (uint8_t *)&ipv4;
state = ctdb_control_send(ctdb, nodemap->nodes[i].pnn,
0, CTDB_CONTROL_RELEASE_IPv4, 0,
data, async_data,
&timeout, NULL);
} else {
ip.pnn = tmp_ip->pnn;
ip.addr = tmp_ip->addr;
timeout = TAKEOVER_TIMEOUT();
data.dsize = sizeof(ip);
data.dptr = (uint8_t *)&ip;
state = ctdb_control_send(ctdb, nodemap->nodes[i].pnn,
0, CTDB_CONTROL_RELEASE_IP, 0,
data, async_data,
&timeout, NULL);
}
timeout = TAKEOVER_TIMEOUT();
data.dsize = sizeof(ip);
data.dptr = (uint8_t *)&ip;
state = ctdb_control_send(ctdb, nodemap->nodes[i].pnn,
0, CTDB_CONTROL_RELEASE_IP, 0,
data, async_data,
&timeout, NULL);
if (state == NULL) {
DEBUG(DEBUG_ERR,(__location__ " Failed to call async control CTDB_CONTROL_RELEASE_IP to node %u\n", nodemap->nodes[i].pnn));
talloc_free(tmp_ctx);
@ -902,16 +962,30 @@ finished:
/* this IP won't be taken over */
continue;
}
ip.pnn = tmp_ip->pnn;
ip.addr = tmp_ip->addr;
timeout = TAKEOVER_TIMEOUT();
data.dsize = sizeof(ip);
data.dptr = (uint8_t *)&ip;
state = ctdb_control_send(ctdb, tmp_ip->pnn,
0, CTDB_CONTROL_TAKEOVER_IP, 0,
data, async_data,
&timeout, NULL);
if (tmp_ip->addr.sa.sa_family == AF_INET) {
ipv4.pnn = tmp_ip->pnn;
ipv4.sin = tmp_ip->addr.ip;
timeout = TAKEOVER_TIMEOUT();
data.dsize = sizeof(ipv4);
data.dptr = (uint8_t *)&ipv4;
state = ctdb_control_send(ctdb, tmp_ip->pnn,
0, CTDB_CONTROL_TAKEOVER_IPv4, 0,
data, async_data,
&timeout, NULL);
} else {
ip.pnn = tmp_ip->pnn;
ip.addr = tmp_ip->addr;
timeout = TAKEOVER_TIMEOUT();
data.dsize = sizeof(ip);
data.dptr = (uint8_t *)&ip;
state = ctdb_control_send(ctdb, tmp_ip->pnn,
0, CTDB_CONTROL_TAKEOVER_IP, 0,
data, async_data,
&timeout, NULL);
}
if (state == NULL) {
DEBUG(DEBUG_ERR,(__location__ " Failed to call async control CTDB_CONTROL_TAKEOVER_IP to node %u\n", tmp_ip->pnn));
talloc_free(tmp_ctx);
@ -1059,7 +1133,7 @@ int32_t ctdb_control_tcp_add(struct ctdb_context *ctdb, TDB_DATA indata)
vnn = find_public_ip_vnn(ctdb, &p->dest);
if (vnn == NULL) {
DEBUG(DEBUG_ERR,(__location__ " got TCP_ADD control for an address which is not a public address '%s'\n",
DEBUG(DEBUG_INFO,(__location__ " got TCP_ADD control for an address which is not a public address '%s'\n",
ctdb_addr_to_str(&p->dest)));
return -1;
@ -1262,6 +1336,47 @@ int32_t ctdb_control_get_public_ips(struct ctdb_context *ctdb,
}
/*
get list of public IPs, old ipv4 style. only returns ipv4 addresses
*/
int32_t ctdb_control_get_public_ipsv4(struct ctdb_context *ctdb,
struct ctdb_req_control *c, TDB_DATA *outdata)
{
int i, num, len;
struct ctdb_all_public_ipsv4 *ips;
struct ctdb_vnn *vnn;
/* count how many public ip structures we have */
num = 0;
for (vnn=ctdb->vnn;vnn;vnn=vnn->next) {
if (vnn->public_address.sa.sa_family != AF_INET) {
continue;
}
num++;
}
len = offsetof(struct ctdb_all_public_ipsv4, ips) +
num*sizeof(struct ctdb_public_ipv4);
ips = talloc_zero_size(outdata, len);
CTDB_NO_MEMORY(ctdb, ips);
outdata->dsize = len;
outdata->dptr = (uint8_t *)ips;
ips->num = num;
i = 0;
for (vnn=ctdb->vnn;vnn;vnn=vnn->next) {
if (vnn->public_address.sa.sa_family != AF_INET) {
continue;
}
ips->ips[i].pnn = vnn->pnn;
ips->ips[i].sin = vnn->public_address.ip;
i++;
}
return 0;
}
/*
structure containing the listening socket and the list of tcp connections

View File

@ -31,16 +31,14 @@
*/
static int ctdb_tcp_add_node(struct ctdb_node *node)
{
struct ctdb_tcp *ctcp = talloc_get_type(node->ctdb->private_data,
struct ctdb_tcp);
struct ctdb_tcp_node *tnode;
tnode = talloc_zero(ctcp, struct ctdb_tcp_node);
tnode = talloc_zero(node, struct ctdb_tcp_node);
CTDB_NO_MEMORY(node->ctdb, tnode);
tnode->fd = -1;
node->private_data = tnode;
tnode->out_queue = ctdb_queue_setup(node->ctdb, ctcp, tnode->fd, CTDB_TCP_ALIGNMENT,
tnode->out_queue = ctdb_queue_setup(node->ctdb, node, tnode->fd, CTDB_TCP_ALIGNMENT,
ctdb_tcp_tnode_cb, node);
return 0;

View File

@ -1196,6 +1196,13 @@ static int control_ban(struct ctdb_context *ctdb, int argc, const char **argv)
usage();
}
/* verify we can access the node */
ret = ctdb_ctrl_getpnn(ctdb, TIMELIMIT(), options.pnn);
if (ret == -1) {
DEBUG(DEBUG_ERR,("Can not ban node. Node is not operational.\n"));
return -1;
}
ban_time = strtoul(argv[0], NULL, 0);
b.pnn = options.pnn;
@ -1222,6 +1229,13 @@ static int control_unban(struct ctdb_context *ctdb, int argc, const char **argv)
int ret;
TDB_DATA data;
/* verify we can access the node */
ret = ctdb_ctrl_getpnn(ctdb, TIMELIMIT(), options.pnn);
if (ret == -1) {
DEBUG(DEBUG_ERR,("Can not unban node. Node is not operational.\n"));
return -1;
}
data.dptr = (uint8_t *)&options.pnn;
data.dsize = sizeof(uint32_t);

View File

@ -93,6 +93,11 @@ show_all "uname -a"
[ -x /bin/rpm ] && {
show_all "rpm -qa | egrep 'samba|ctdb|gpfs'"
}
[ -x /usr/bin/dpkg-query ] && {
show_all "/usr/bin/dpkg-query --show 'ctdb'"
show_all "/usr/bin/dpkg-query --show 'samba'"
#show_all "/usr/bin/dpkg-query --show 'gpfs'"
}
cat <<EOF