[mod_cluster] Initial import, 1.1.1-2.

Marek Goldmann goldmann at fedoraproject.org
Sat Mar 12 08:37:48 UTC 2011


commit 5eedfbbdd736780ebf3f8d5bea9f2769a2a2c4d0
Author: Marek Goldmann <marek.goldmann at gmail.com>
Date:   Sat Mar 12 09:37:39 2011 +0100

    Initial import, 1.1.1-2.

 .gitignore                           |    1 +
 README.fedora                        |   35 ++++++
 mod_cluster-1.1.1-lesswarnings.patch |  210 ++++++++++++++++++++++++++++++++++
 mod_cluster.conf                     |   12 ++
 mod_cluster.spec                     |  103 +++++++++++++++++
 sources                              |    1 +
 6 files changed, 362 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..cb7534d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/mod_cluster-1.1.1.Final-src-ssl.tar.gz
diff --git a/README.fedora b/README.fedora
new file mode 100644
index 0000000..10398aa
--- /dev/null
+++ b/README.fedora
@@ -0,0 +1,35 @@
+= Enabling mod_cluster =
+
+Detailed information about configuring mod_cluster can be found here:
+
+    http://docs.jboss.org/mod_cluster/1.1.0/html/native.config.html
+
+== Disable proxy_balancer_module (required) ==
+
+To enable mod_cluster you need to make sure you have proxy_balancer_module disabled. Please comment out the loading of
+proxy_balancer_module in /etc/httpd/conf/httpd.conf:
+
+# LoadModule proxy_balancer_module
+
+== Enable mod_cluster modules (required) ==
+
+Next step is to load all required mod_cluster modules. Uncomment all LoadModule directives from
+/etc/httpd/conf.d/mod_cluster.conf file:
+
+LoadModule slotmem_module modules/mod_slotmem.so
+LoadModule proxy_cluster_module modules/mod_proxy_cluster.so
+LoadModule advertise_module modules/mod_advertise.so
+LoadModule manager_module modules/mod_manager.so
+
+== Enabling mod_cluster manager (optional) ==
+
+Mod_cluster manager is a simple tool that displays useful information about the cluster. To enable it you need to
+load the mod_manager module and call SetHandler for the selected context:
+
+<Location /mod_cluster_manager>
+    SetHandler mod_cluster-manager
+</Location>
+
+== Restart ==
+
+Make sure you restart the htttpd server after you apply these changes.
diff --git a/mod_cluster-1.1.1-lesswarnings.patch b/mod_cluster-1.1.1-lesswarnings.patch
new file mode 100644
index 0000000..5bd3193
--- /dev/null
+++ b/mod_cluster-1.1.1-lesswarnings.patch
@@ -0,0 +1,210 @@
+diff -Naur mod_cluster-1.1.1.Final-src-ssl.orig/srclib/mod_cluster/native/advertise/mod_advertise.c mod_cluster-1.1.1.Final-src-ssl.new/srclib/mod_cluster/native/advertise/mod_advertise.c
+--- mod_cluster-1.1.1.Final-src-ssl.orig/srclib/mod_cluster/native/advertise/mod_advertise.c	2010-07-29 17:04:18.000000000 +0200
++++ mod_cluster-1.1.1.Final-src-ssl.new/srclib/mod_cluster/native/advertise/mod_advertise.c	2011-03-11 14:02:42.290960551 +0100
+@@ -81,7 +81,6 @@
+ 
+ /* Advertise sockets */
+ static apr_socket_t     *ma_mgroup_socket = NULL;
+-static apr_socket_t     *ma_listen_socket = NULL;
+ static apr_sockaddr_t   *ma_mgroup_sa     = NULL;
+ static apr_sockaddr_t   *ma_listen_sa     = NULL;
+ static apr_sockaddr_t   *ma_niface_sa     = NULL;
+@@ -170,7 +169,7 @@
+ {
+     mod_advertise_config *mconf = ap_get_module_config(cmd->server->module_config, &advertise_module);
+     if (mconf->ma_advertise_port != MA_DEFAULT_ADVPORT &&
+-        mconf->ma_advertise_adrs != MA_DEFAULT_GROUP)
++        strcmp(mconf->ma_advertise_adrs, MA_DEFAULT_GROUP))
+         return "Duplicate AdvertiseGroup directives are not allowed";
+ 
+     if (apr_parse_addr_port(&mconf->ma_advertise_adrs,
+@@ -626,7 +625,7 @@
+          * if the code below doesn't work
+          */
+         char *ptr = NULL;
+-        int port = DEFAULT_HTTP_PORT;
++        unsigned int port = DEFAULT_HTTP_PORT;
+         if (ma_server_rec->addrs && ma_server_rec->addrs->host_addr &&
+             ma_server_rec->addrs->host_addr->next == NULL) {
+             ptr = apr_psprintf(pproc, "%pI", ma_server_rec->addrs->host_addr);
+@@ -639,7 +638,7 @@
+             } else {
+                 port = ma_server_rec->port;
+              }
+-            ptr = apr_psprintf(pproc, "%s:%lu", ma_server_rec->server_hostname, port);
++            ptr = apr_psprintf(pproc, "%s:%u", ma_server_rec->server_hostname, port);
+         }
+         rv = apr_parse_addr_port(&mconf->ma_advertise_srvs,
+                                  &mconf->ma_advertise_srvi,
+@@ -712,10 +711,10 @@
+         }
+         if (mconf->ma_advertise_server != NULL) {
+             ap_rprintf(r, " Advertising on Group %s Port %d ", mconf->ma_advertise_adrs, mconf->ma_advertise_port);
+-            ap_rprintf(r, "for %s://%s:%d every %d seconds<br/>",
++            ap_rprintf(r, "for %s://%s:%d every %ld seconds<br/>",
+                        mconf->ma_advertise_srvm, mconf->ma_advertise_srvs,
+                        mconf-> ma_advertise_srvp,
+-                       apr_time_sec(mconf->ma_advertise_freq)
++                       (long) apr_time_sec(mconf->ma_advertise_freq)
+                        );
+         } else {
+             ap_rputs("<br/>", r);
+diff -Naur mod_cluster-1.1.1.Final-src-ssl.orig/srclib/mod_cluster/native/mod_manager/balancer.c mod_cluster-1.1.1.Final-src-ssl.new/srclib/mod_cluster/native/mod_manager/balancer.c
+--- mod_cluster-1.1.1.Final-src-ssl.orig/srclib/mod_cluster/native/mod_manager/balancer.c	2009-08-05 21:35:44.000000000 +0200
++++ mod_cluster-1.1.1.Final-src-ssl.new/srclib/mod_cluster/native/mod_manager/balancer.c	2011-03-11 14:10:23.706778901 +0100
+@@ -170,7 +170,7 @@
+     apr_status_t rv;
+     balancerinfo_t *ou = balancer;
+     if (balancer->id)
+-        s->storage->ap_slotmem_free(s->slotmem, balancer->id, balancer);
++        rv = s->storage->ap_slotmem_free(s->slotmem, balancer->id, balancer);
+     else {
+         /* XXX: for the moment January 2007 ap_slotmem_free only uses ident to remove */
+         rv = s->storage->ap_slotmem_do(s->slotmem, loc_read_balancer, &ou, s->p);
+diff -Naur mod_cluster-1.1.1.Final-src-ssl.orig/srclib/mod_cluster/native/mod_manager/context.c mod_cluster-1.1.1.Final-src-ssl.new/srclib/mod_cluster/native/mod_manager/context.c
+--- mod_cluster-1.1.1.Final-src-ssl.orig/srclib/mod_cluster/native/mod_manager/context.c	2010-02-19 14:41:39.000000000 +0100
++++ mod_cluster-1.1.1.Final-src-ssl.new/srclib/mod_cluster/native/mod_manager/context.c	2011-03-11 14:10:49.531585887 +0100
+@@ -173,7 +173,7 @@
+     apr_status_t rv;
+     contextinfo_t *ou = context;
+     if (context->id)
+-        s->storage->ap_slotmem_free(s->slotmem, context->id, context);
++        rv = s->storage->ap_slotmem_free(s->slotmem, context->id, context);
+     else {
+         /* XXX: for the moment January 2007 ap_slotmem_free only uses ident to remove */
+         rv = s->storage->ap_slotmem_do(s->slotmem, loc_read_context, &ou, s->p);
+diff -Naur mod_cluster-1.1.1.Final-src-ssl.orig/srclib/mod_cluster/native/mod_manager/domain.c mod_cluster-1.1.1.Final-src-ssl.new/srclib/mod_cluster/native/mod_manager/domain.c
+--- mod_cluster-1.1.1.Final-src-ssl.orig/srclib/mod_cluster/native/mod_manager/domain.c	2009-08-05 21:35:44.000000000 +0200
++++ mod_cluster-1.1.1.Final-src-ssl.new/srclib/mod_cluster/native/mod_manager/domain.c	2011-03-11 14:09:20.697129579 +0100
+@@ -170,7 +170,7 @@
+     apr_status_t rv;
+     domaininfo_t *ou = domain;
+     if (domain->id)
+-        s->storage->ap_slotmem_free(s->slotmem, domain->id, domain);
++        rv = s->storage->ap_slotmem_free(s->slotmem, domain->id, domain);
+     else {
+         /* XXX: for the moment January 2007 ap_slotmem_free only uses ident to remove */
+         rv = s->storage->ap_slotmem_do(s->slotmem, loc_read_domain, &ou, s->p);
+diff -Naur mod_cluster-1.1.1.Final-src-ssl.orig/srclib/mod_cluster/native/mod_manager/host.c mod_cluster-1.1.1.Final-src-ssl.new/srclib/mod_cluster/native/mod_manager/host.c
+--- mod_cluster-1.1.1.Final-src-ssl.orig/srclib/mod_cluster/native/mod_manager/host.c	2009-08-05 21:35:44.000000000 +0200
++++ mod_cluster-1.1.1.Final-src-ssl.new/srclib/mod_cluster/native/mod_manager/host.c	2011-03-11 14:12:37.371428175 +0100
+@@ -170,7 +170,7 @@
+     apr_status_t rv;
+     hostinfo_t *ou = host;
+     if (host->id)
+-        s->storage->ap_slotmem_free(s->slotmem, host->id, host);
++        rv = s->storage->ap_slotmem_free(s->slotmem, host->id, host);
+     else {
+         /* XXX: for the moment January 2007 ap_slotmem_free only uses ident to remove */
+         rv = s->storage->ap_slotmem_do(s->slotmem, loc_read_host, &ou, s->p);
+diff -Naur mod_cluster-1.1.1.Final-src-ssl.orig/srclib/mod_cluster/native/mod_manager/mod_manager.c mod_cluster-1.1.1.Final-src-ssl.new/srclib/mod_cluster/native/mod_manager/mod_manager.c
+--- mod_cluster-1.1.1.Final-src-ssl.orig/srclib/mod_cluster/native/mod_manager/mod_manager.c	2011-01-24 21:25:34.000000000 +0100
++++ mod_cluster-1.1.1.Final-src-ssl.new/srclib/mod_cluster/native/mod_manager/mod_manager.c	2011-03-11 14:12:14.580363591 +0100
+@@ -650,44 +650,6 @@
+     /* All other fields can be modified without causing problems */
+     return -1;
+ }
+-/*
+- * Remove host and context belonging to the node
+- */
+-static void remove_host_context(request_rec *r, int node)
+-{
+-    /* for read the hosts */
+-    int i;
+-    int size = loc_get_max_size_host();
+-    int *id;
+-    int sizecontext = loc_get_max_size_context();
+-    int *idcontext;
+-
+-
+-    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
+-                "remove_host_context processing node: %d", node);
+-    if (size == 0)
+-        return;
+-    id = apr_palloc(r->pool, sizeof(int) * size);
+-    idcontext = apr_palloc(r->pool, sizeof(int) * sizecontext);
+-    size = get_ids_used_host(hoststatsmem, id);
+-    for (i=0; i<size; i++) {
+-        hostinfo_t *ou;
+-
+-        if (get_host(hoststatsmem, &ou, id[i]) != APR_SUCCESS)
+-            continue;
+-        if (ou->node == node)
+-            remove_host(hoststatsmem, ou);
+-    }
+-
+-    sizecontext = get_ids_used_context(contextstatsmem, idcontext);
+-    for (i=0; i<sizecontext; i++) {
+-        contextinfo_t *context;
+-        if (get_context(contextstatsmem, &context, idcontext[i]) != APR_SUCCESS)
+-            continue;
+-        if (context->node == node)
+-            remove_context(contextstatsmem, context);
+-    }
+-}
+ 
+ /*
+  * Process a CONFIG message
+diff -Naur mod_cluster-1.1.1.Final-src-ssl.orig/srclib/mod_cluster/native/mod_manager/node.c mod_cluster-1.1.1.Final-src-ssl.new/srclib/mod_cluster/native/mod_manager/node.c
+--- mod_cluster-1.1.1.Final-src-ssl.orig/srclib/mod_cluster/native/mod_manager/node.c	2010-03-23 16:22:23.000000000 +0100
++++ mod_cluster-1.1.1.Final-src-ssl.new/srclib/mod_cluster/native/mod_manager/node.c	2011-03-11 14:11:10.043844005 +0100
+@@ -189,7 +189,7 @@
+     apr_status_t rv;
+     nodeinfo_t *ou = node;
+     if (node->mess.id)
+-        s->storage->ap_slotmem_free(s->slotmem, node->mess.id, node);
++        rv = s->storage->ap_slotmem_free(s->slotmem, node->mess.id, node);
+     else {
+         /* XXX: for the moment January 2007 ap_slotmem_free only uses ident to remove */
+         rv = s->storage->ap_slotmem_do(s->slotmem, loc_read_node, &ou, s->p);
+diff -Naur mod_cluster-1.1.1.Final-src-ssl.orig/srclib/mod_cluster/native/mod_manager/sessionid.c mod_cluster-1.1.1.Final-src-ssl.new/srclib/mod_cluster/native/mod_manager/sessionid.c
+--- mod_cluster-1.1.1.Final-src-ssl.orig/srclib/mod_cluster/native/mod_manager/sessionid.c	2009-08-05 21:35:44.000000000 +0200
++++ mod_cluster-1.1.1.Final-src-ssl.new/srclib/mod_cluster/native/mod_manager/sessionid.c	2011-03-11 14:09:56.043128059 +0100
+@@ -170,7 +170,7 @@
+     apr_status_t rv;
+     sessionidinfo_t *ou = sessionid;
+     if (sessionid->id)
+-        s->storage->ap_slotmem_free(s->slotmem, sessionid->id, sessionid);
++        rv = s->storage->ap_slotmem_free(s->slotmem, sessionid->id, sessionid);
+     else {
+         /* XXX: for the moment January 2007 ap_slotmem_free only uses ident to remove */
+         rv = s->storage->ap_slotmem_do(s->slotmem, loc_read_sessionid, &ou, s->p);
+diff -Naur mod_cluster-1.1.1.Final-src-ssl.orig/srclib/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c mod_cluster-1.1.1.Final-src-ssl.new/srclib/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
+--- mod_cluster-1.1.1.Final-src-ssl.orig/srclib/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c	2011-01-24 21:58:01.000000000 +0100
++++ mod_cluster-1.1.1.Final-src-ssl.new/srclib/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c	2011-03-11 14:18:29.962485616 +0100
+@@ -496,7 +496,7 @@
+         proxy_balancer *balancer = ap_proxy_get_balancer(pool, conf, name);
+ 
+         if (!balancer && (creat_bal == CREAT_NONE ||
+-            creat_bal == CREAT_ROOT && s!=main_server)) {
++            (creat_bal == CREAT_ROOT && s!=main_server))) {
+             s = s->next;
+             continue;
+         }
+@@ -718,8 +718,8 @@
+ {
+     apr_status_t status;
+     apr_interval_time_t timeout;
+-    apr_interval_time_t savetimeout;
+-    char savetimeout_set;
++    apr_interval_time_t savetimeout = 0;
++    char savetimeout_set = 0;
+ #if AP_MODULE_MAGIC_AT_LEAST(20051115,4)
+ #else
+     proxy_cluster_helper *helperping;
+@@ -1189,7 +1189,6 @@
+         /* keep only the contexts corresponding to our balancer */
+         if (balancer != NULL) {
+             nodeinfo_t *node;
+-            char *name;
+             if (node_storage->read_node(context->node, &node) != APR_SUCCESS)
+                 continue;
+             if (strlen(balancer->name) > 11 && strcasecmp(&balancer->name[11], node->mess.balancer) != 0)
+@@ -1264,7 +1263,6 @@
+         return NULL;
+     while (*nodes != -1) {
+         nodeinfo_t *node;
+-        char *ret;
+         if (node_storage->read_node(*nodes, &node) != APR_SUCCESS)
+             continue;
+         if (node->mess.balancer) {
diff --git a/mod_cluster.conf b/mod_cluster.conf
new file mode 100644
index 0000000..0e1393a
--- /dev/null
+++ b/mod_cluster.conf
@@ -0,0 +1,12 @@
+#
+# This is mod_cluster module configuration file. Please refer to README
+# for more information on how to enable mod_cluster.
+#
+# LoadModule slotmem_module       modules/mod_slotmem.so
+# LoadModule proxy_cluster_module modules/mod_proxy_cluster.so
+# LoadModule advertise_module     modules/mod_advertise.so
+# LoadModule manager_module       modules/mod_manager.so
+#
+# <Location /mod_cluster_manager>
+#     SetHandler mod_cluster-manager
+# </Location>
diff --git a/mod_cluster.spec b/mod_cluster.spec
new file mode 100644
index 0000000..ad175da
--- /dev/null
+++ b/mod_cluster.spec
@@ -0,0 +1,103 @@
+%global release_suffix .Final
+
+Summary:    Apache HTTP load balancer
+Name:       mod_cluster
+Version:    1.1.1
+Release:    2%{?dist}
+License:    LGPLv2
+URL:        http://jboss.org/mod_cluster
+Group:      System Environment/Daemons
+Source:     http://downloads.jboss.org/%{name}/%{version}%{release_suffix}/%{name}-%{version}%{release_suffix}-src-ssl.tar.gz
+Source1:    mod_cluster.conf
+Source2:    README.fedora
+BuildRoot:  %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+Patch0:     mod_cluster-1.1.1-lesswarnings.patch
+
+Requires:      httpd >= 2.2.8
+BuildRequires: httpd-devel >= 2.2.8
+BuildRequires: autoconf
+# BuildRequires: maven3 # Required to build docs
+
+%description
+Mod_cluster is an httpd-based load balancer. Like mod_jk and mod_proxy,
+mod_cluster uses a communication channel to forward requests from httpd to one
+of a set of application server nodes. Unlike mod_jk and mod_proxy, mod_cluster
+leverages an additional connection between the application server nodes and
+httpd. The application server nodes use this connection to transmit server-side
+load balance factors and lifecycle events back to httpd via a custom set of
+HTTP methods, affectionately called the Mod-Cluster Management Protocol (MCMP).
+This additional feedback channel allows mod_cluster to offer a level of
+intelligence and granularity not found in other load balancing solutions.
+
+%prep
+%setup -q -n %{name}-%{version}%{release_suffix}-src-ssl
+
+# Remove unecessary directories
+find srclib -mindepth 1 -maxdepth 1 ! -name mod_cluster -print0|xargs -0 -r rm -rf
+
+# Remove a lot of compile-time warnings
+%patch0 -p1
+
+%build
+CFLAGS="$RPM_OPT_FLAGS"
+export CFLAGS
+
+module_dirs=( advertise mod_manager mod_proxy_cluster mod_slotmem )
+
+for dir in ${module_dirs[@]} ; do
+    pushd srclib/%{name}/native/${dir}
+        sh buildconf
+        ./configure --libdir=%{_libdir} --with-apxs=/usr/sbin/apxs
+        make %{?_smp_mflags}
+    popd
+done
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+install -d -m 755 $RPM_BUILD_ROOT%{_libdir}/httpd/modules
+
+module_dirs=( advertise mod_manager mod_proxy_cluster mod_slotmem )
+
+for dir in ${module_dirs[@]} ; do
+    pushd srclib/%{name}/native/${dir}
+        cp ./*.so $RPM_BUILD_ROOT%{_libdir}/httpd/modules
+    popd
+done
+
+install -d -m 755 $RPM_BUILD_ROOT/etc/httpd/conf.d
+cp -a %{SOURCE1} $RPM_BUILD_ROOT/etc/httpd/conf.d/
+
+install -m 0644 %{SOURCE2} README
+
+cp -a srclib/mod_cluster/lgpl.txt .
+
+%clean
+rm -Rf $RPM_BUILD_ROOT
+
+%files
+
+# There is a docs/ directory which contains documentation in docbook
+# format. Unfortunately Maven 3 is needed to build it.
+
+%defattr(-,root,root)
+%doc README
+%doc lgpl.txt
+%{_libdir}/httpd/modules/mod_advertise.so
+%{_libdir}/httpd/modules/mod_manager.so
+%{_libdir}/httpd/modules/mod_proxy_cluster.so
+%{_libdir}/httpd/modules/mod_slotmem.so
+%config(noreplace) %{_sysconfdir}/httpd/conf.d/*.conf
+
+%changelog
+* Fri Mar 11 2011 Marek Goldmann <mgoldman at redhat.com> - 1.1.1-2
+- Another round of cleanup in spec file
+- Patch that disables compilation-time warnings
+
+* Thu Mar 10 2011 Marek Goldmann <mgoldman at redhat.com> - 1.1.1-1
+- Upstream release 1.1.1
+- Cleanup in spec file
+
+* Fri Nov 12 2010 Marek Goldmann <mgoldman at redhat.com> - 1.1.0-1
+- Initial release
+
diff --git a/sources b/sources
index e69de29..dc189e0 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+3d4fec37ecfd1e5ec33cd147525cfe5e  mod_cluster-1.1.1.Final-src-ssl.tar.gz


More information about the scm-commits mailing list