Auto Set unique.instanceId

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Auto Set unique.instanceId

samhamilton
Hey everyone!

This is kinda a weird question but does anyone know a way to auto insert the machines hostname in the unique.instanceId variable in general.properties?

I am asking as I am migrating over to AWS and trying to automate the build for a whole clustered stack so that if one of the instances dies the system knows and rebuilds.

Something like unique.instanceId=$HOSTNAME but I don't know where to find the supported list of variables that a properties file can have?


Cheers
Sam

smime.p7s (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Auto Set unique.instanceId

Jacques Le Roux
Administrator
Hi Sam,

I'm not sure to get it but you could use the IP address of each machine, look into startofbiz.sh:
IPADDR=`/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`

From that you could parse (ie remove the dot) and create an unique Id for each machine

Also Googled for "sh properties file access", found this as 2nd entry in the SERP
http://shrubbery.mynetgear.net/c/display/W/Reading+Java-style+Properties+Files+with+Shell

HTH

Jacques


Sam Hamilton wrote:

> Hey everyone!
>
> This is kinda a weird question but does anyone know a way to auto insert the machines hostname in the unique.instanceId variable
> in general.properties?
>
> I am asking as I am migrating over to AWS and trying to automate the build for a whole clustered stack so that if one of the
> instances dies the system knows and rebuilds.
>
> Something like unique.instanceId=$HOSTNAME but I don't know where to find the supported list of variables that a properties file
> can have?
>
>
> Cheers
> Sam

smime.p7s (8K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Auto Set unique.instanceId

samhamilton
Many thanks Jacques - off to do some testing!

Cheers
Sam

On 4 Aug 2012, at 00:11, Jacques Le Roux <[hidden email]> wrote:

> Hi Sam,
>
> I'm not sure to get it but you could use the IP address of each machine, look into startofbiz.sh:
> IPADDR=`/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`
>
> From that you could parse (ie remove the dot) and create an unique Id for each machine
>
> Also Googled for "sh properties file access", found this as 2nd entry in the SERP http://shrubbery.mynetgear.net/c/display/W/Reading+Java-style+Properties+Files+with+Shell
>
> HTH
>
> Jacques
>
>
> Sam Hamilton wrote:
>> Hey everyone!
>>
>> This is kinda a weird question but does anyone know a way to auto insert the machines hostname in the unique.instanceId variable
>> in general.properties?
>>
>> I am asking as I am migrating over to AWS and trying to automate the build for a whole clustered stack so that if one of the
>> instances dies the system knows and rebuilds.
>>
>> Something like unique.instanceId=$HOSTNAME but I don't know where to find the supported list of variables that a properties file
>> can have?
>>
>>
>> Cheers
>> Sam

Reply | Threaded
Open this post in threaded view
|

Re: Auto Set unique.instanceId

Scott Gray-2
Keep in mind that if your machine IP address ever changes then any jobs queued or running at shutdown won't get picked up on restarting.

Regards
Scott

On 6/08/2012, at 3:06 PM, Sam Hamilton wrote:

> Many thanks Jacques - off to do some testing!
>
> Cheers
> Sam
>
> On 4 Aug 2012, at 00:11, Jacques Le Roux <[hidden email]> wrote:
>
>> Hi Sam,
>>
>> I'm not sure to get it but you could use the IP address of each machine, look into startofbiz.sh:
>> IPADDR=`/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`
>>
>> From that you could parse (ie remove the dot) and create an unique Id for each machine
>>
>> Also Googled for "sh properties file access", found this as 2nd entry in the SERP http://shrubbery.mynetgear.net/c/display/W/Reading+Java-style+Properties+Files+with+Shell
>>
>> HTH
>>
>> Jacques
>>
>>
>> Sam Hamilton wrote:
>>> Hey everyone!
>>>
>>> This is kinda a weird question but does anyone know a way to auto insert the machines hostname in the unique.instanceId variable
>>> in general.properties?
>>>
>>> I am asking as I am migrating over to AWS and trying to automate the build for a whole clustered stack so that if one of the
>>> instances dies the system knows and rebuilds.
>>>
>>> Something like unique.instanceId=$HOSTNAME but I don't know where to find the supported list of variables that a properties file
>>> can have?
>>>
>>>
>>> Cheers
>>> Sam
>

Reply | Threaded
Open this post in threaded view
|

Re: Auto Set unique.instanceId

Adrian Crum-3
That would be the primary reason not to do things that way. Instead,  
you should keep server-specific patches in the checked-out project and  
have each server apply its patch after checkout.

-Adrian

Quoting Scott Gray <[hidden email]>:

> Keep in mind that if your machine IP address ever changes then any  
> jobs queued or running at shutdown won't get picked up on restarting.
>
> Regards
> Scott
>
> On 6/08/2012, at 3:06 PM, Sam Hamilton wrote:
>
>> Many thanks Jacques - off to do some testing!
>>
>> Cheers
>> Sam
>>
>> On 4 Aug 2012, at 00:11, Jacques Le Roux  
>> <[hidden email]> wrote:
>>
>>> Hi Sam,
>>>
>>> I'm not sure to get it but you could use the IP address of each  
>>> machine, look into startofbiz.sh:
>>> IPADDR=`/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 |  
>>> awk '{ print $1}'`
>>>
>>> From that you could parse (ie remove the dot) and create an unique  
>>> Id for each machine
>>>
>>> Also Googled for "sh properties file access", found this as 2nd  
>>> entry in the SERP  
>>> http://shrubbery.mynetgear.net/c/display/W/Reading+Java-style+Properties+Files+with+Shell
>>>
>>> HTH
>>>
>>> Jacques
>>>
>>>
>>> Sam Hamilton wrote:
>>>> Hey everyone!
>>>>
>>>> This is kinda a weird question but does anyone know a way to auto  
>>>> insert the machines hostname in the unique.instanceId variable
>>>> in general.properties?
>>>>
>>>> I am asking as I am migrating over to AWS and trying to automate  
>>>> the build for a whole clustered stack so that if one of the
>>>> instances dies the system knows and rebuilds.
>>>>
>>>> Something like unique.instanceId=$HOSTNAME but I don't know where  
>>>> to find the supported list of variables that a properties file
>>>> can have?
>>>>
>>>>
>>>> Cheers
>>>> Sam
>>
>
>



Reply | Threaded
Open this post in threaded view
|

Re: Auto Set unique.instanceId

samhamilton
Thanks for the tips.

Scott I never knew that the jobs worked that way. The use case I am working towards is where I can scale up and down the amount of OFBiz application servers running depending on load i.e. number of visitors on the website and I was trying to totally automate the scaling process. Is there anyway to reassign queued jobs assuming that a server will never come back into the pool?

Thanks
Sam


On 6 Aug 2012, at 19:56, [hidden email] wrote:

> That would be the primary reason not to do things that way. Instead, you should keep server-specific patches in the checked-out project and have each server apply its patch after checkout.
>
> -Adrian
>
> Quoting Scott Gray <[hidden email]>:
>
>> Keep in mind that if your machine IP address ever changes then any jobs queued or running at shutdown won't get picked up on restarting.
>>
>> Regards
>> Scott
>>
>> On 6/08/2012, at 3:06 PM, Sam Hamilton wrote:
>>
>>> Many thanks Jacques - off to do some testing!
>>>
>>> Cheers
>>> Sam
>>>
>>> On 4 Aug 2012, at 00:11, Jacques Le Roux <[hidden email]> wrote:
>>>
>>>> Hi Sam,
>>>>
>>>> I'm not sure to get it but you could use the IP address of each machine, look into startofbiz.sh:
>>>> IPADDR=`/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`
>>>>
>>>> From that you could parse (ie remove the dot) and create an unique Id for each machine
>>>>
>>>> Also Googled for "sh properties file access", found this as 2nd entry in the SERP http://shrubbery.mynetgear.net/c/display/W/Reading+Java-style+Properties+Files+with+Shell
>>>>
>>>> HTH
>>>>
>>>> Jacques
>>>>
>>>>
>>>> Sam Hamilton wrote:
>>>>> Hey everyone!
>>>>>
>>>>> This is kinda a weird question but does anyone know a way to auto insert the machines hostname in the unique.instanceId variable
>>>>> in general.properties?
>>>>>
>>>>> I am asking as I am migrating over to AWS and trying to automate the build for a whole clustered stack so that if one of the
>>>>> instances dies the system knows and rebuilds.
>>>>>
>>>>> Something like unique.instanceId=$HOSTNAME but I don't know where to find the supported list of variables that a properties file
>>>>> can have?
>>>>>
>>>>>
>>>>> Cheers
>>>>> Sam
>>>
>>
>>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Auto Set unique.instanceId

Jacques Le Roux
Administrator
From: "Sam Hamilton" <[hidden email]>
> Thanks for the tips.
>
> Scott I never knew that the jobs worked that way.

Most things depends on DB in OFBiz, so are jobs. They are picked from DB to be run.

>The use case I am working towards is where I can scale up and down the amount of OFBiz application servers running depending on
>load i.e. number of visitors on the website and I was trying to totally automate the scaling process. Is there anyway to reassign
>queued >jobs assuming that a server will never come back into the pool?

Adrian is working/has worked on similar things recently. Not with the automates scaling process but I think with overhaul Jacopo and
Adrian did recently and Brett's ideas to introduce JMS queues (see http://markmail.org/message/m7siuv7stkvv7nh6) this should be
possible. Not OOTB of course, but we have never been closest...

Jacques

> Thanks
> Sam
>
>
> On 6 Aug 2012, at 19:56, [hidden email] wrote:
>
>> That would be the primary reason not to do things that way. Instead, you should keep server-specific patches in the checked-out
>> project and have each server apply its patch after checkout.
>>
>> -Adrian
>>
>> Quoting Scott Gray <[hidden email]>:
>>
>>> Keep in mind that if your machine IP address ever changes then any jobs queued or running at shutdown won't get picked up on
>>> restarting.
>>>
>>> Regards
>>> Scott
>>>
>>> On 6/08/2012, at 3:06 PM, Sam Hamilton wrote:
>>>
>>>> Many thanks Jacques - off to do some testing!
>>>>
>>>> Cheers
>>>> Sam
>>>>
>>>> On 4 Aug 2012, at 00:11, Jacques Le Roux <[hidden email]> wrote:
>>>>
>>>>> Hi Sam,
>>>>>
>>>>> I'm not sure to get it but you could use the IP address of each machine, look into startofbiz.sh:
>>>>> IPADDR=`/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`
>>>>>
>>>>> From that you could parse (ie remove the dot) and create an unique Id for each machine
>>>>>
>>>>> Also Googled for "sh properties file access", found this as 2nd entry in the SERP
>>>>> http://shrubbery.mynetgear.net/c/display/W/Reading+Java-style+Properties+Files+with+Shell
>>>>>
>>>>> HTH
>>>>>
>>>>> Jacques
>>>>>
>>>>>
>>>>> Sam Hamilton wrote:
>>>>>> Hey everyone!
>>>>>>
>>>>>> This is kinda a weird question but does anyone know a way to auto insert the machines hostname in the unique.instanceId
>>>>>> variable
>>>>>> in general.properties?
>>>>>>
>>>>>> I am asking as I am migrating over to AWS and trying to automate the build for a whole clustered stack so that if one of the
>>>>>> instances dies the system knows and rebuilds.
>>>>>>
>>>>>> Something like unique.instanceId=$HOSTNAME but I don't know where to find the supported list of variables that a properties
>>>>>> file
>>>>>> can have?
>>>>>>
>>>>>>
>>>>>> Cheers
>>>>>> Sam
>>>>
>>>
>>>
>>
>>
>>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Auto Set unique.instanceId

Adrian Crum-3
On 8/10/2012 7:33 PM, Jacques Le Roux wrote:

> From: "Sam Hamilton" <[hidden email]>
>> Thanks for the tips.
>>
>> Scott I never knew that the jobs worked that way.
>
> Most things depends on DB in OFBiz, so are jobs. They are picked from
> DB to be run.
>
>> The use case I am working towards is where I can scale up and down
>> the amount of OFBiz application servers running depending on
>> load i.e. number of visitors on the website and I was trying to
>> totally automate the scaling process. Is there anyway to reassign
>> queued >jobs assuming that a server will never come back into the pool?
>
> Adrian is working/has worked on similar things recently. Not with the
> automates scaling process but I think with overhaul Jacopo and
> Adrian did recently and Brett's ideas to introduce JMS queues (see
> http://markmail.org/message/m7siuv7stkvv7nh6) this should be
> possible. Not OOTB of course, but we have never been closest...

I have an update for the Job Scheduler that will dequeue any queued jobs
when the server shuts down. Other servers should pick up the dequeued
jobs - so no extra work will be necessary.

-Adrian

Reply | Threaded
Open this post in threaded view
|

Re: Auto Set unique.instanceId

samhamilton
Many thanks Adrian!

Sam

On 11 Aug 2012, at 02:38, Adrian Crum <[hidden email]> wrote:

> On 8/10/2012 7:33 PM, Jacques Le Roux wrote:
>> From: "Sam Hamilton" <[hidden email]>
>>> Thanks for the tips.
>>>
>>> Scott I never knew that the jobs worked that way.
>>
>> Most things depends on DB in OFBiz, so are jobs. They are picked from DB to be run.
>>
>>> The use case I am working towards is where I can scale up and down the amount of OFBiz application servers running depending on
>>> load i.e. number of visitors on the website and I was trying to totally automate the scaling process. Is there anyway to reassign
>>> queued >jobs assuming that a server will never come back into the pool?
>>
>> Adrian is working/has worked on similar things recently. Not with the automates scaling process but I think with overhaul Jacopo and
>> Adrian did recently and Brett's ideas to introduce JMS queues (see http://markmail.org/message/m7siuv7stkvv7nh6) this should be
>> possible. Not OOTB of course, but we have never been closest...
>
> I have an update for the Job Scheduler that will dequeue any queued jobs when the server shuts down. Other servers should pick up the dequeued jobs - so no extra work will be necessary.
>
> -Adrian
>