users@glassfish.java.net

Re: setting node-specific properties

From: Dick Davies <rasputnik_at_gmail.com>
Date: Sat, 26 Jul 2008 15:28:06 +0100

On Sat, Jul 26, 2008 at 2:26 PM, Kedar Mhaswade <Kedar.Mhaswade_at_sun.com> wrote:
> Absolutely.
>
> If all you need is a Java system property that is unique for instances
> in a cluster, you can do the following:
>
> - In the cluster, define a Java system property (we call it JVM option
> for some weird reason) named defaultClientId (e.g.) using command
> like: asadmin create-jvm-options -- "-DdefaultClientId=${UNIQUE_NAME}"
>
> As a result, the cluster's java-config element would have something
> like: <jvm-options>-DdefaultClientId=${UNIQUE_NAME} </jvm-options>
>
> - Define a GlassFish system property (weird name, but that's what it
> is!) that overrides the value of UNIQUE_NAME per instance:
> asadmin create-system-properties --target instance1
> UNIQUE_NAME=cluster1:instance1
> asadmin create-system-properties --target instance2
> UNIQUE_NAME=cluster1:instance2

That sounds like what I want, thanks. Glassfish doesn't expose something
like the instance name by default, by any chance?
Would be handy for general debugging if we could grab that (we run this
behind a Netscaler for load balancing, and it's often useful to expose something
like a node id for troubleshooting).

> I hope this can be easily tied with Roller's properties file.

Hmm, that's the bit I'm worried about :)

Need to Google up a way to do something like
appspecific.property = ${some-system-property}
in a general properties file.
(Feel free to pipe up, developers :) )

Thanks a lot !

> Regards,
> Kedar
>
>
> Dick Davies wrote:
>>
>> Hi, we're running a 2 node GFv2 cluster, and we've got the Roller
>> weblogger running
>> on both nodes.
>>
>> I've been debugging some weird issues the past day or two and think I
>> found the problem;
>> the webapp needs a property
>>
>> # client identifier. should be unique for each instance in a cluster.
>> tasks.clientId=defaultClientId
>>
>> (in a bundled properties file) to uniquely identify each
>> instance (to handle concurrent access to parts of the database).
>>
>> Since both glassfish instances are running the same WAR file, they
>> both have the same clientid.
>>
>> I really don't want to have to write 2 different WARfiles, so I'm
>> wondering if there's a way to set
>> a system property at glassfish instance startup (-Dclientid=$HOSTNAME),
>> that I could somehow inject into that properties file?
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>



-- 
Rasputnik :: Jack of All Trades - Master of Nuns
http://number9.hellooperator.net/