[SCM] CTDB repository - branch master updated - ctdb-1.0.82-19-ge57c47b

Ronnie Sahlberg sahlberg at samba.org
Mon May 25 02:04:26 GMT 2009


The branch, master has been updated
       via  e57c47b75fa501223c57040eac73392b42ae549d (commit)
       via  bfc6ac07f8b7b326e75d8c9bf73051a440ee0011 (commit)
       via  bb4ef6c4d2bc3578bdf4432517e98f85ec94e3b6 (commit)
       via  5fc14f98902ae98abed35eaab3b3495226dcac38 (commit)
       via  39539a2d1784f04245ed7abc84c4f39e1601afa4 (commit)
       via  ba44aae7307b4fa56f7b2da2cd9d4a7ccd0a135e (commit)
      from  2c4c20d7803f4449f8d463314c40d4734ec80e2f (commit)

http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit e57c47b75fa501223c57040eac73392b42ae549d
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Mon May 25 12:02:36 2009 +1000

    install the 31.clamd script as 644 by default

commit bfc6ac07f8b7b326e75d8c9bf73051a440ee0011
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Mon May 25 11:46:47 2009 +1000

    add 31.clamd to the install and the rpm

commit bb4ef6c4d2bc3578bdf4432517e98f85ec94e3b6
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Mon May 25 12:10:29 2009 +1000

    From Flavio Carmo Junior <carmo.flavio at gmail.com>
    
    Add an eventscript to manage ClamAV

commit 5fc14f98902ae98abed35eaab3b3495226dcac38
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Mon May 25 12:08:50 2009 +1000

    From Flavio Carmo Junior <carmo.flavio at gmail.com>
    (with modifications)
    
    Add a webpage about CLAMAV support in CTDB

commit 39539a2d1784f04245ed7abc84c4f39e1601afa4
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Mon May 25 11:44:27 2009 +1000

    document the new support for ClamAV

commit ba44aae7307b4fa56f7b2da2cd9d4a7ccd0a135e
Author: Sumit Bose <sbose at redhat.com>
Date:   Thu May 21 13:43:41 2009 +0200

    fix re pattern to accept the new recovery lock times in the statistics output

-----------------------------------------------------------------------

Summary of changes:
 Makefile.in                        |    1 +
 config/events.d/31.clamd           |   53 ++++++++++++++++++++++++
 doc/ctdbd.1                        |   45 ++++++++++++++++++++-
 doc/ctdbd.1.html                   |   37 ++++++++++++++++-
 doc/ctdbd.1.xml                    |   56 ++++++++++++++++++++++++++
 packaging/RPM/ctdb.spec            |    1 +
 tests/simple/14_ctdb_statistics.sh |    6 +-
 web/clamd.html                     |   78 ++++++++++++++++++++++++++++++++++++
 web/documentation.html             |    1 +
 9 files changed, 271 insertions(+), 7 deletions(-)
 create mode 100644 config/events.d/31.clamd
 create mode 100644 web/clamd.html


Changeset truncated at 500 lines:

diff --git a/Makefile.in b/Makefile.in
index 7297db6..2fcf6cc 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -216,6 +216,7 @@ install: all
 	${INSTALLCMD} -m 755 config/events.d/10.interface $(DESTDIR)$(etcdir)/ctdb/events.d
 	${INSTALLCMD} -m 755 config/events.d/11.natgw $(DESTDIR)$(etcdir)/ctdb/events.d
 	${INSTALLCMD} -m 755 config/events.d/20.multipathd $(DESTDIR)$(etcdir)/ctdb/events.d
+	${INSTALLCMD} -m 644 config/events.d/31.clamd $(DESTDIR)$(etcdir)/ctdb/events.d
 	${INSTALLCMD} -m 755 config/events.d/40.vsftpd $(DESTDIR)$(etcdir)/ctdb/events.d
 	${INSTALLCMD} -m 755 config/events.d/41.httpd $(DESTDIR)$(etcdir)/ctdb/events.d
 	${INSTALLCMD} -m 755 config/events.d/50.samba $(DESTDIR)$(etcdir)/ctdb/events.d
diff --git a/config/events.d/31.clamd b/config/events.d/31.clamd
new file mode 100644
index 0000000..11238b7
--- /dev/null
+++ b/config/events.d/31.clamd
@@ -0,0 +1,53 @@
+#!/bin/sh
+# event script to manage clamd in a cluster environment
+
+. $CTDB_BASE/functions
+loadconfig ctdb
+
+detect_init_style
+
+case $CTDB_INIT_STYLE in
+	redhat)
+		CTDB_SERVICE_CLAMD="clamd"
+		CTDB_CONFIG_CLAMD="clamd"
+		;;
+	suse)
+		CTDB_SERVICE_CLAMD="clamav"
+		CTDB_CONFIG_CLAMD="clamav"
+		;;
+	ubuntu)
+		CTDB_SERVICE_CLAMD="clamav"
+		CTDB_CONFIG_CLAMD="clamav"
+		;;
+	*)
+		# should not happen.
+		# for now use red hat style as default
+		CTDB_SERVICE_CLAMD="clamd"
+		CTDB_CONFIG_CLAMD="clamd"
+		;;
+esac
+
+loadconfig "${CTDB_CONFIG_CLAMD}"
+
+[ "$CTDB_MANAGES_CLAMD" = "yes" ] || exit 0
+
+cmd="$1"
+shift
+
+case $cmd in 
+     startup)
+        service "${CTDB_SERVICE_CLAMD}" stop > /dev/null 2>&1
+        service "${CTDB_SERVICE_CLAMD}" start
+        ;;
+
+     shutdown)
+        service "${CTDB_SERVICE_CLAMD}" stop
+        ;;
+
+     monitor)
+        ctdb_check_unix_socket "clamd" ${CTDB_CLAMD_SOCKET}
+        ;;
+esac
+
+exit 0
+
diff --git a/doc/ctdbd.1 b/doc/ctdbd.1
index d6ac7ba..3342447 100644
--- a/doc/ctdbd.1
+++ b/doc/ctdbd.1
@@ -1,11 +1,11 @@
 .\"     Title: ctdbd
 .\"    Author: 
 .\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 05/14/2009
+.\"      Date: 05/25/2009
 .\"    Manual: 
 .\"    Source: 
 .\"
-.TH "CTDBD" "1" "05/14/2009" "" ""
+.TH "CTDBD" "1" "05/25/2009" "" ""
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
@@ -508,6 +508,47 @@ The NAT\-GW node is assigned the CTDB_NATGW_PUBLIC_IP to the designated interfac
 All other nodes in the group are configured with a default route of metric 10 pointing to the designated NAT GW node\.
 .PP
 This is implemented in the 11\.natgw eventscript\. Please see the eventscript for further information\.
+.SH "CLAMAV DAEMON"
+.PP
+CTDB has support to manage the popular anti\-virus daemon ClamAV\. This support is implemented through the eventscript : /etc/ctdb/events\.d/31\.clamd\.
+.SS "Configuration"
+.PP
+Start by configuring CLAMAV normally and test that it works\. Once this is done, copy the configuration files over to all the nodes so that all nodes share identical CLAMAV configurations\. Once this is done you can proceed with the intructions below to activate CTDB support for CLAMAV\.
+.PP
+First, to activate CLAMAV support in CTDB, edit /etc/sysconfig/ctdb and add the two lines :
+.sp
+.RS 4
+.nf
+CTDB_MANAGES_CLAMD=yes
+CTDB_CLAMD_SOCKET="/path/to/clamd\.socket"
+.fi
+.RE
+.PP
+Second, activate the eventscript by making it executable:
+.sp
+.RS 4
+.nf
+chmod +x /etc/ctdb/events\.d/31\.clamd
+.fi
+.RE
+.PP
+Third, CTDB will now be starting and stopping this service accordingly, so make sure that the system is not configured to start/stop this service automatically\. On RedHat systems you can disable the system starting/stopping CLAMAV automatically by running :
+.sp
+.RS 4
+.nf
+chkconfig clamd off
+.fi
+.RE
+.PP
+Once you have restarted CTDBD, use
+.sp
+.RS 4
+.nf
+ctdb scriptstatus
+.fi
+.RE
+.sp
+and verify that the 31\.clamd eventscript is listed and that it was executed successfully\.
 .SH "SEE ALSO"
 .PP
 ctdb(1), onnode(1)
diff --git a/doc/ctdbd.1.html b/doc/ctdbd.1.html
index 7ac33c7..e63c36f 100644
--- a/doc/ctdbd.1.html
+++ b/doc/ctdbd.1.html
@@ -531,10 +531,43 @@ CTDB_CAPABILITY_RECMASTER=no
     </p><p>
       This is implemented in the 11.natgw eventscript. Please see the
       eventscript for further information.
-    </p></div></div><div class="refsect1" lang="en"><a name="id2476230"></a><h2>SEE ALSO</h2><p>
+    </p></div></div><div class="refsect1" lang="en"><a name="id2476230"></a><h2>ClamAV Daemon</h2><p>
+CTDB has support to manage the popular anti-virus daemon ClamAV.
+This support is implemented through the
+eventscript : /etc/ctdb/events.d/31.clamd.
+</p><div class="refsect2" lang="en"><a name="id2476241"></a><h3>Configuration</h3><p>
+Start by configuring CLAMAV normally and test that it works. Once this is
+done, copy the configuration files over to all the nodes so that all nodes
+share identical CLAMAV configurations.
+Once this is done you can proceed with the intructions below to activate
+CTDB support for CLAMAV.
+</p><p>
+First, to activate CLAMAV support in CTDB, edit /etc/sysconfig/ctdb and add the two lines :
+</p><pre class="screen">
+CTDB_MANAGES_CLAMD=yes
+CTDB_CLAMD_SOCKET="/path/to/clamd.socket"
+</pre><p>
+Second, activate the eventscript by making it executable:
+</p><pre class="screen">
+chmod +x /etc/ctdb/events.d/31.clamd
+</pre><p>
+Third, CTDB will now be starting and stopping this service accordingly,
+so make sure that the system is not configured to start/stop this service
+automatically.
+On RedHat systems you can disable the system starting/stopping CLAMAV automatically by running :
+</p><pre class="screen">
+chkconfig clamd off
+</pre><p>
+</p><p>
+Once you have restarted CTDBD, use
+</p><pre class="screen">
+ctdb scriptstatus
+</pre><p>
+and verify that the 31.clamd eventscript is listed and that it was executed successfully.
+</p></div></div><div class="refsect1" lang="en"><a name="id2476302"></a><h2>SEE ALSO</h2><p>
       ctdb(1), onnode(1)
       <a class="ulink" href="http://ctdb.samba.org/" target="_top">http://ctdb.samba.org/</a>
-    </p></div><div class="refsect1" lang="en"><a name="id2476243"></a><h2>COPYRIGHT/LICENSE</h2><div class="literallayout"><p><br>
+    </p></div><div class="refsect1" lang="en"><a name="id2476315"></a><h2>COPYRIGHT/LICENSE</h2><div class="literallayout"><p><br>
 Copyright (C) Andrew Tridgell 2007<br>
 Copyright (C) Ronnie sahlberg 2007<br>
 <br>
diff --git a/doc/ctdbd.1.xml b/doc/ctdbd.1.xml
index 555ca06..7d94e87 100644
--- a/doc/ctdbd.1.xml
+++ b/doc/ctdbd.1.xml
@@ -948,6 +948,62 @@ CTDB_CAPABILITY_RECMASTER=no
 
 
 
+<refsect1><title>ClamAV Daemon</title>
+<para>
+CTDB has support to manage the popular anti-virus daemon ClamAV.
+This support is implemented through the
+eventscript : /etc/ctdb/events.d/31.clamd.
+</para>
+      
+<refsect2><title>Configuration</title>
+<para>
+Start by configuring CLAMAV normally and test that it works. Once this is
+done, copy the configuration files over to all the nodes so that all nodes
+share identical CLAMAV configurations.
+Once this is done you can proceed with the intructions below to activate
+CTDB support for CLAMAV.
+</para>
+
+<para>
+First, to activate CLAMAV support in CTDB, edit /etc/sysconfig/ctdb and add the two lines :
+</para>
+<screen format="linespecific">
+CTDB_MANAGES_CLAMD=yes
+CTDB_CLAMD_SOCKET="/path/to/clamd.socket"
+</screen>
+
+<para>
+Second, activate the eventscript by making it executable:
+</para>
+<screen format="linespecific">
+chmod +x /etc/ctdb/events.d/31.clamd
+</screen>
+
+<para>
+Third, CTDB will now be starting and stopping this service accordingly,
+so make sure that the system is not configured to start/stop this service
+automatically.
+On RedHat systems you can disable the system starting/stopping CLAMAV automatically by running :
+<screen format="linespecific">
+chkconfig clamd off
+</screen>
+</para>
+
+
+<para>
+Once you have restarted CTDBD, use
+<screen format="linespecific">
+ctdb scriptstatus
+</screen>
+and verify that the 31.clamd eventscript is listed and that it was executed successfully.
+</para>
+
+</refsect2>
+</refsect1>
+
+
+
+
   <refsect1><title>SEE ALSO</title>
     <para>
       ctdb(1), onnode(1)
diff --git a/packaging/RPM/ctdb.spec b/packaging/RPM/ctdb.spec
index ef2f71e..5b0bc8b 100644
--- a/packaging/RPM/ctdb.spec
+++ b/packaging/RPM/ctdb.spec
@@ -107,6 +107,7 @@ fi
 %{_sysconfdir}/ctdb/events.d/10.interface
 %{_sysconfdir}/ctdb/events.d/11.natgw
 %{_sysconfdir}/ctdb/events.d/20.multipathd
+%{_sysconfdir}/ctdb/events.d/31.clamd
 %{_sysconfdir}/ctdb/events.d/40.vsftpd
 %{_sysconfdir}/ctdb/events.d/41.httpd
 %{_sysconfdir}/ctdb/events.d/50.samba
diff --git a/tests/simple/14_ctdb_statistics.sh b/tests/simple/14_ctdb_statistics.sh
index 202e0a0..d92cb41 100755
--- a/tests/simple/14_ctdb_statistics.sh
+++ b/tests/simple/14_ctdb_statistics.sh
@@ -33,14 +33,14 @@ set -e
 
 onnode 0 $CTDB_TEST_WRAPPER cluster_is_healthy
 
-pattern='^(CTDB version 1|Gathered statistics for [[:digit:]]+ nodes|[[:space:]]+[[:alpha:]_]+[[:space:]]+[[:digit:]]+|[[:space:]]+(node|client|timeouts)|[[:space:]]+[[:alpha:]_]+_latency[[:space:]]+[[:digit:]]+\.[[:digit:]]+[[:space:]]sec)$'
+pattern='^(CTDB version 1|Gathered statistics for [[:digit:]]+ nodes|[[:space:]]+[[:alpha:]_]+[[:space:]]+[[:digit:]]+|[[:space:]]+(node|client|timeouts)|[[:space:]]+([[:alpha:]_]+_latency|max_reclock_[[:alpha:]]+)[[:space:]]+[[:digit:]-]+\.[[:digit:]]+[[:space:]]sec)$'
 
 try_command_on_node -v 1 "$CTDB statistics"
 
-sanity_check_output 38 "$pattern" "$out"
+sanity_check_output 40 "$pattern" "$out"
 
 try_command_on_node -v 1 "$CTDB statistics -n all"
 
-sanity_check_output 38 "$pattern" "$out"
+sanity_check_output 40 "$pattern" "$out"
 
 ctdb_test_exit
diff --git a/web/clamd.html b/web/clamd.html
new file mode 100644
index 0000000..4edb4cf
--- /dev/null
+++ b/web/clamd.html
@@ -0,0 +1,78 @@
+<!--#set var="TITLE" value="CTDB and ClamAV Daemon" -->
+<!--#include virtual="header.html" -->
+
+<h1>Setting up ClamAV with CTDB</h1>
+
+<h2>Prereqs</h2>
+Configure CTDB as above and set it up to use public ipaddresses.<br>
+Verify that the CTDB cluster works.
+
+<h2>Configuration</h2>
+
+Configure clamd on each node on the cluster.<br><br>
+For details how to configure clamd check its documentation.
+
+<h2>/etc/sysconfig/ctdb</h2>
+
+Add the following lines to the /etc/sysconfig/ctdb configuration file.
+<pre>
+  CTDB_MANAGES_CLAMD=yes
+  CTDB_CLAMD_SOCKET="/path/to/clamd.sock"
+</pre>
+
+Disable clamd in chkconfig so that it does not start by default. Instead CTDB will start/stop clamd as required.
+<pre>
+  chkconfig clamd off
+</pre>
+
+<h2>Events script</h2>
+
+The CTDB distribution already comes with an events script for clamd in the file /etc/ctdb/events.d/31.clamd<br><br>
+There should not be any need to edit this file.
+What you need is to set it as executable, with command like this:
+<pre>
+  chmod +x /etc/ctdb/events.d/31.clamd
+</pre>
+To check if ctdb monitoring and handling with clamd, you can check outpout of command:
+<pre>
+  ctdb scriptstatus
+</pre>
+
+<h2>Restart your cluster</h2>
+Next time your cluster restarts, CTDB will start managing the clamd service.<br><br>
+If the cluster is already in production you may not want to restart the entire cluster since this would disrupt services.<br>
+
+Insted you can just disable/enable the nodes one by one. Once a node becomes enabled again it will start the clamd service.<br><br>
+
+Follow the procedure below for each node, one node at a time :
+
+<h3>1 Disable the node</h3>
+Use the ctdb command to disable the node :
+<pre>
+  ctdb -n NODE disable
+</pre>
+
+<h3>2 Wait until the cluster has recovered</h3>
+
+Use the ctdb tool to monitor until the cluster has recovered, i.e. Recovery mode is NORMAL. This should happen within seconds of when you disabled the node.
+<pre>
+  ctdb status
+</pre>
+
+<h3>3 Enable the node again</h3>
+
+Re-enable the node again which will start the newly configured vsftp service.
+<pre>
+  ctdb -n NODE enable
+</pre>
+
+<h2>See also</h2>
+
+The CLAMAV section in the ctdbd manpage.
+
+<pre>
+  man ctdbd
+</pre>
+
+<!--#include virtual="footer.html" -->
+
diff --git a/web/documentation.html b/web/documentation.html
index d78a1f0..57daf71 100644
--- a/web/documentation.html
+++ b/web/documentation.html
@@ -17,6 +17,7 @@ The following documentation should get you started with CTDB.
 <li><a href="ftp.html">Setting up FTP with CTDB</a>
 <li><a href="nfs.html">Setting up NFS with CTDB</a>
 <li><a href="iscsi.html">Setting up iSCSI with CTDB</a>
+<li><a href="clamd.html">Setting up CLAMD with CTDB</a>
 <li><a href="http://wiki.samba.org/index.php/CTDB_Setup">CTDB Wiki</a>
 </ul>
 


-- 
CTDB repository


More information about the samba-cvs mailing list