Skip to content

Instantly share code, notes, and snippets.

View Karm's full-sized avatar
🎪
Staring at my screen

Karm Michal Babacek Karm

🎪
Staring at my screen
View GitHub Profile
@Karm
Karm / Apache HTTP error_log
Last active August 29, 2015 13:56
mod_cluster / mod_proxy integration, BalancerMember setup, a lot of Friday fun....
[Fri Feb 14 08:58:42 2014] [notice] SELinux policy enabled; httpd running as context unconfined_u:unconfined_r:unconfined_java_t:s0-s0:c0.c1023
[Fri Feb 14 08:58:42 2014] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Fri Feb 14 08:58:42 2014] [notice] Digest: generating secret for digest authentication ...
[Fri Feb 14 08:58:42 2014] [notice] Digest: done
[Fri Feb 14 08:58:42 2014] [debug] util_ldap.c(1990): LDAP merging Shared Cache conf: shm=0x7ffb94307980 rmm=0x7ffb943079d8 for VHOST: 10.16.88.19
[Fri Feb 14 08:58:42 2014] [debug] util_ldap.c(1990): LDAP merging Shared Cache conf: shm=0x7ffb94307980 rmm=0x7ffb943079d8 for VHOST: 10.16.88.19
[Fri Feb 14 08:58:42 2014] [info] APR LDAP: Built with OpenLDAP LDAP SDK
[Fri Feb 14 08:58:42 2014] [info] LDAP: SSL support available
[Fri Feb 14 08:58:42 2014] [notice] Advertise initialized for process 15553
[Fri Feb 14 08:58:42 2014] [debug] proxy_util.c(1818): proxy: grabbed scoreboard slot 4 in child 15555 for worker proxy:reverse
@Karm
Karm / STOP-APP_log
Last active August 29, 2015 13:57
STOP-APP Playing around...
curl "http://BOX666:8847/clusterbench/jvmroute" -i
HTTP/1.1 200 OK
Date: Fri, 14 Mar 2014 15:15:09 GMT
Set-Cookie: JSESSIONID=G6iMXP1R9g69aF0c6+0kHzBy.jboss-eap-6.3; Path=/clusterbench
Content-Type: text/plain;charset=ISO-8859-1
Content-Length: 13
Connection: close
jboss-eap-6.3
@Karm
Karm / mod_cluster.conf
Last active August 29, 2015 14:02
mod_cluster configuration snippets
LoadModule proxy_cluster_module modules/mod_proxy_cluster.so
LoadModule slotmem_module modules/mod_slotmem.so
LoadModule manager_module modules/mod_manager.so
LoadModule advertise_module modules/mod_advertise.so
Listen 192.168.122.74:2181
MemManagerFile "/opt/bpms/load-balancer/jboss-ews-2.0/httpd/cache/mod_cluster"
ServerName 192.168.122.74:2181
@Karm
Karm / error_log
Created October 7, 2014 14:02
MODCLUSTER-430 pastebin...
mod_manager.c(1907): manager_trans INFO (/)
mod_manager.c(2623): manager_handler INFO (/) processing: ""
mod_manager.c(2672): manager_handler INFO OK
mod_manager.c(1907): manager_trans CONFIG (/)
mod_manager.c(2623): manager_handler CONFIG (/) processing: "JVMRoute=jboss-eap-6.3-2&Host=192.168.122.204&Maxattempts=1&Port=8110&StickySessionForce=No&Type=ajp&ping=10"
mod_manager.c(2672): manager_handler CONFIG OK
mod_manager.c(1907): manager_trans ENABLE-APP (/)
mod_manager.c(2623): manager_handler ENABLE-APP (/) processing: "JVMRoute=jboss-eap-6.3-2&Alias=default-host%2Clocalhost%2Cexample.com&Context=%2Fclusterbench"
mod_manager.c(1347): process_appl_cmd: adding vhost: 1 node: 1
mod_manager.c(2672): manager_handler ENABLE-APP OK
@Karm
Karm / server_logs
Created January 22, 2015 14:52
Session draining
6.4.0.Beta1
-----------
[org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 60) JBAS010281: Started default-host/clusterbench cache from web container
[org.jboss.web] (ServerService Thread Pool -- 60) JBAS018210: Register web context: /clusterbench
[org.jboss.as.server] (ServerService Thread Pool -- 30) JBAS015859: Deployed "clusterbench.war" (runtime-name : "clusterbench.war")
[org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://192.168.122.172:9990/management
[org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://192.168.122.172:9990
[org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss EAP 6.4.0.Beta1 (AS 7.5.0.Final-redhat-17) started in 6734ms - Started 260 of 337 services (124 services are lazy, passive or on-demand)
[org.jboss.web] (ServerService Thread Pool -- 60) JBAS018224: Unregister web context: /clusterbench
@Karm
Karm / unbound_python_notes.md
Last active August 29, 2015 14:19
Unbound Python module: examine response just before it's send to the client

Goal

I would like to examine the response just before it's dispatched to the client. Primarily, I'm interested in the ;; ANSWER SECTION:.

Problem

What had looked like a trivial modification of logDnsMsg function turned out to be a dounting task of browsing reply_info, rrset_ref and ub_packed_rrset_key structures in pursuit of the desired ;; ANSWER SECTION: bytes.

The reason is the logDnsMsg function does not work as expected for A queries ;; ANSWER SECTION:, while it suprisingly operates as expected for ;; AUTHORITY SECTION: on AAAA queries.

@Karm
Karm / mod_cluster.conf
Created August 12, 2015 09:30
Fail_on_status mod_cluster configuration
LoadModule slotmem_module modules/mod_slotmem.so
LoadModule manager_module modules/mod_manager.so
LoadModule proxy_cluster_module modules/mod_proxy_cluster.so
LoadModule advertise_module modules/mod_advertise.so
MemManagerFile "/dev/shm/mod_cluster-eapx/jboss-ews-2.1/httpd/cache/mod_cluster"
ProxyPass / balancer://balancerxxx stickysession=JSESSIONID|jsessionid nofailover=on failonstatus=201
ProxyPassReverse / balancer://balancerxxx
ProxyPreserveHost on
@Karm
Karm / woker:jboss-eap-7.0-2.log
Created October 21, 2015 09:43
3 Wildfy servers with mod_cluster, web session relication, failover on JVM kill
2015-10-20 14:02:30,638 INFO [org.jboss.modules] (main) JBoss Modules version 1.4.4.Final
2015-10-20 14:02:34,397 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final
2015-10-20 14:02:35,345 INFO [org.jboss.as] (MSC service thread 1-6) WFLYSRV0049: EAP 7.0.0.Alpha1 (WildFly Core 2.0.0.CR5) starting
2015-10-20 14:02:35,362 DEBUG [org.jboss.as.config] (MSC service thread 1-6) Configured system properties:
331122245 = true
[Standalone] =
awt.toolkit = sun.awt.X11.XToolkit
file.encoding = UTF-8
file.encoding.pkg = sun.io
file.separator = /
@Karm
Karm / gist:5395463
Last active December 16, 2015 06:59
AS7: How to add mod_cluster to standalone.xml profile? Composite operation workaround to https://issues.jboss.org/browse/JBPAPP6-1420:

Add extension

/extension=org.jboss.as.modcluster:add()

Add ajp connector

/subsystem=web/connector=ajp:add(name=ajp,protocol=ajp,scheme=ajp,socket-binding=ajp)

Composite operation for mod_cluster without advertising, with proxy-list (list of balancers)

/**
* Find the best nodes for a request (check host and context (and balancer))
* @param r the request_rec
* @param balancer the balancer (balancer to use in that case we check it).
* @param route from the sessionid if we have one.
* @param use_alias compare alias with server_name
* @return a pointer to a list of nodes.
*/
static node_context *find_node_context_host(request_rec *r, proxy_balancer *balancer, const char *route, int use_alias, proxy_vhost_table* vhost_table, proxy_context_table* context_table)
{