summaryrefslogtreecommitdiffstats
path: root/ctdb
diff options
context:
space:
mode:
Diffstat (limited to 'ctdb')
-rwxr-xr-xctdb/config/ctdb.init6
-rw-r--r--ctdb/config/ctdb.sysconfig17
-rw-r--r--ctdb/server/ctdbd.c13
3 files changed, 34 insertions, 2 deletions
diff --git a/ctdb/config/ctdb.init b/ctdb/config/ctdb.init
index bae52c2c8b..c83c091a73 100755
--- a/ctdb/config/ctdb.init
+++ b/ctdb/config/ctdb.init
@@ -66,6 +66,12 @@ CTDB_OPTIONS="$CTDB_OPTIONS --reclock=$CTDB_RECOVERY_LOCK"
[ -z "$CTDB_START_AS_DISABLED" ] || [ "$CTDB_START_AS_DISABLED" != "yes" ] || {
CTDB_OPTIONS="$CTDB_OPTIONS --start-as-disabled"
}
+[ -z "$CTDB_CAPABILITY_RECMASTER" ] || [ "$CTDB_CAPABILITY_RECMASTER" != "yes" ] || {
+ CTDB_OPTIONS="$CTDB_OPTIONS --no-recmaster"
+}
+[ -z "$CTDB_CAPABILITY_LMASTER" ] || [ "$CTDB_CAPABILITY_LMASTER" != "yes" ] || {
+ CTDB_OPTIONS="$CTDB_OPTIONS --no-lmaster"
+}
if [ -x /sbin/startproc ]; then
init_style="suse"
diff --git a/ctdb/config/ctdb.sysconfig b/ctdb/config/ctdb.sysconfig
index 9d1e4341e0..58edbff9d9 100644
--- a/ctdb/config/ctdb.sysconfig
+++ b/ctdb/config/ctdb.sysconfig
@@ -91,6 +91,23 @@
# the node with "ctdb enable"
# CTDB_START_AS_DISABLED="yes"
+# LMASTER and RECMASTER capabilities.
+# By default all nodes are capable of both being LMASTER for records and
+# also for taking the RECMASTER role and perform recovery.
+# These parameters can be used to disable these two roles on a node.
+# Note: If there are NO available nodes left in a cluster that can perform
+# the RECMASTER role, the cluster will not be able to recover from a failure
+# and will remain in RECOVERY mode until an RECMASTER capable node becomes
+# available. Same for LMASTER.
+# These parametersd are useful for scenarios where you have one "remote" node
+# in a cluster and you do not want the remote node to be fully participating
+# in the cluster and slow things down.
+# For that case, set both roles to "no" for the remote node on the remote site
+# but leave the roles default to "yes" on the primary nodes in the central
+# datacentre.
+# CTDB_CAPABILITY_RECMASTER=yes
+# CTDB_CAPABILITY_LMASTER=yes
+
# where to log messages
# the default is /var/log/log.ctdb
# CTDB_LOGFILE=/var/log/log.ctdb
diff --git a/ctdb/server/ctdbd.c b/ctdb/server/ctdbd.c
index bf441abb19..c21d4349e9 100644
--- a/ctdb/server/ctdbd.c
+++ b/ctdb/server/ctdbd.c
@@ -43,6 +43,8 @@ static struct {
int no_setsched;
int use_syslog;
int start_as_disabled;
+ int no_lmaster;
+ int no_recmaster;
} options = {
.nlist = ETCDIR "/ctdb/nodes",
.transport = "tcp",
@@ -120,6 +122,8 @@ int main(int argc, const char *argv[])
{ "nosetsched", 0, POPT_ARG_NONE, &options.no_setsched, 0, "disable setscheduler SCHED_FIFO call", NULL },
{ "syslog", 0, POPT_ARG_NONE, &options.use_syslog, 0, "log messages to syslog", NULL },
{ "start-as-disabled", 0, POPT_ARG_NONE, &options.start_as_disabled, 0, "Node starts in disabled state", NULL },
+ { "no-lmaster", 0, POPT_ARG_NONE, &options.no_lmaster, 0, "disable lmaster role on this node", NULL },
+ { "no-recmaster", 0, POPT_ARG_NONE, &options.no_recmaster, 0, "disable recmaster role on this node", NULL },
POPT_TABLEEND
};
int opt, ret;
@@ -201,8 +205,13 @@ int main(int argc, const char *argv[])
}
/* set ctdbd capabilities */
- /* We can be an lmaster, we can also be a recmaster */
- ctdb->capabilities = CTDB_CAP_LMASTER | CTDB_CAP_RECMASTER;
+ ctdb->capabilities = 0;
+ if (options.no_lmaster == 0) {
+ ctdb->capabilities |= CTDB_CAP_LMASTER;
+ }
+ if (options.no_recmaster == 0) {
+ ctdb->capabilities |= CTDB_CAP_RECMASTER;
+ }
/* tell ctdb what nodes are available */
ctdb_load_nodes_file(ctdb);