tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Jung <rainer.j...@kippdata.de>
Subject Re: Scripting mod_jk load-balancer member changes
Date Mon, 12 Jan 2015 22:41:10 GMT
Hi Chris,

Am 12.01.2015 um 20:12 schrieb Christopher Schultz:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> All,
>
> On 1/12/15 2:01 PM, Christopher Schultz wrote:
>> I'm running into a bit of difficulty scripting updates for
>> load-balancer members and thought I'd ask here before slogging
>> through the code to see if there are any requirements I'm missing.
>>
>> Long story short, I'd like to script setting the "activation"
>> status for a particular load-balanced worker to something, like ACT
>> or DIS.
>>
>> I've written a python script to do this for me and I can confirm
>> with Wireshark that it's sending what I expect. Here is the HTTP
>> request that is being sent:
>>
>> " POST /jk-status HTTP/1.1 Accept-Encoding: identity
>> Content-Length: 43 Host: localhost Content-Type:
>> application/x-www-form-urlencoded Connection: close User-Agent:
>> mod_jk.py / Python-urllib
>>
>>
>> from=list&cmd=update&sw=myworker&vwa=1&w=lb "
>>
>> That's the whole request. The response I get is a 200 response,
>> but it's got the form content in it again, and not the "you will
>> be redirected in 3 seconds" response that I get from the web UI.
>>
>> I can think of a few things that I just wanted to sanity check:
>>
>> 1. I need to provide all of the various values and not just the
>> "vwa" value (which is the short-code request parameter value for
>> the "activation" status).
>>
>> 2. The status worker can't handle POST requests (the web interface
>> uses GET).
>>
>> 3. I've broken something else.
>>
>> Can anyone confirm either 2 or 3 above, or both?
>
> I tried switching to GET and so I'm using this URL, now:
>
> GET /jk-status?from=list&cmd=update&sw=myworker&vwa=0&w=lb HTTP/1.1
> Accept-Encoding: identity
> Host: localhost
> Connection: close
> User-Agent: mod_jk.py / Python-urllib
>
> (Note that the load balancer worker's name is "lb" and the balanced
> worker is called "myworker")
>
> I'm getting a 200 response with the expected "You will be redirected
> in 3 seconds" page, but the value for the activation of this worker is
> not actually being updated.
>
> So, it seems that the data must be in the URL (i.e. GET) but something
> is still not working as I expect.
>
> Can anyone shed some light on what I might be missing?
>
> I can probably change the order of the parameters if that's what's
> required... I'm using a python dictionary (an unordered name/value
> hash) to build my request parameters which is automatically converted
> to URL parameters, but they are unordered. I could put them in order
> if that is likely to change anything.

Only GET works currently.

It is easiest to do what you want in the browser GUI and then take the 
request URL including query string from the web server access log. And 
vice versa, does the URL do what you want, if you enter it in the browser?

At first sight, the query string looks good. Value "0" means "active". 
The "from=list" part should not be necessary. It will define, which 
redirect URL will be used in the response (in which you are not really 
interested).

In case of problems, you can try the JkLogLevel debug for the status 
worker request. Status worker also logs quite verbosely what it does. 
Any changes done will be logged on info log level, problems as errors or 
warnings.

Are you using 1.2.40 or an older version? Some older versions had 
problems with updating data via status worker. It should be in the 
changelog of the more recent version.

Finally: make sure the status worker is not configured as read-only.

Regards,

Rainer







---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message