You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Christian Schneider <cs...@gmail.com> on 2013/08/01 17:55:49 UTC

Re: Using the bin/daemon.sh script on ubuntu.

Thanks for the great responses.

@Ognjen: Yes, currently we also use the setenv.sh (because it will not be
touched by an update).
The *ln -s* Tipp is not bad.
But the problem is, it stores the files in the folder (/opt/tomcat/logs).

On our (AWS) installation we have limited space on /opt, therefore we
attached an EBS volume  to /var/, - otherwise we would get problems with
the log files. Now it can grow above some GB.

But because the log dirs are defined in the logging.properties (what get
shipped and overridden by updates) we put this "hack" into our setenv.sh:

sed -i 's/${catalina.base}\/logs/\/var\/log\/tomcat\//g'
\/opt\/tomcat\/conf\/logging.properties

This will replace the sting *${catalina.base}\/logs* with */var\/log\/tomcat
* everytime setenv.sh is executed.

Now we will never forget to touch the logging.properties after an update.
But i still think it is not that elegant...

Best Regards,
Christian.


2013/7/30 Ognjen Blagojevic <og...@gmail.com>

> Christian,
>
>
> On 30.7.2013 11:58, Christian Schneider wrote:
>
>> But what about:
>> * set env. variables (maybe: catalina.sh?, /etc/profiles?)
>>
>
> /etc/profiles is executed when you enter bash shell, so if Tomcat starts
> at boot time, it won't be able to access environment variables defined in
> /etc/profile.
>
> I set JAVA_HOME, CATALINA_BASE and CATALINA_HOME environment variables in
> /etc/init.d/tomcat (which is a copy of daemon.sh), but I guess there may be
> a better place to do that.
>
> This link [1] recommends to put environment variables in
> /etc/default/tomcat, and then to source them from /etc/init.d/tomcat.
>
>
>
>  * adjust the heap size
>>
>
> Create file $CATALINA_BASE/bin/setenv.sh:
>
> ----
> export CATALINA_OPTS='-Xms...m -Xmx...m'
> ----
>
>
>
>  * logging to the right directory (like: /var/log/tomcat/...)
>>
>
> Maybe something like:
>
> ln -s /var/log/tomcat $CATALINA_BASE/logs
>
>
>
>  * specifying the User: "tomcat"
>>
>
> User 'tomcat' is already specified in daemon.sh, though you may override
> that with $TOMCAT_USER environment variable.
>
> -Ognjen
>
> [1] http://unix.stackexchange.com/**questions/44370/how-to-make-**
> unix-service-see-environment-**variables<http://unix.stackexchange.com/questions/44370/how-to-make-unix-service-see-environment-variables>
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.**apache.org<us...@tomcat.apache.org>
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

RE: [OT] Using the bin/daemon.sh script on ubuntu.

Posted by Jeffrey Janner <Je...@PolyDyne.com>.
> -----Original Message-----
> From: Christopher Schultz [mailto:chris@christopherschultz.net]
> Sent: Tuesday, August 06, 2013 10:52 PM
> To: Tomcat Users List
> Subject: Re: [OT] Using the bin/daemon.sh script on ubuntu.
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> Igor,
> 
> On 8/6/13 6:28 AM, Igor Cicimov wrote:
> > On 06/08/2013 12:40 AM, "Jeffrey Janner"
> > <Je...@polydyne.com> wrote:
> >>
> >>> -----Original Message----- From: Christopher Schultz
> >>> [mailto:chris@christopherschultz.net] Sent: Friday, August 02,
> >>> 2013 10:30 PM To: Tomcat Users List Subject: Re: [OT] Using the
> >>> bin/daemon.sh script on ubuntu.
> >>>
> >>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
> >>>
> >>> Christian
> >>>
> >>> On 8/1/13 11:55 AM, Christian Schneider wrote:
> >>>> On our (AWS) installation we have limited space on /opt, therefore
> >>>> we attached an EBS volume  to /var/, - otherwise we would get
> >>>> problems with the log files. Now it can grow above some GB.
> >>>
> >>> Have you thought about using /mnt/ephemeral[0-9]?
> >>>
> >>> Our instances have ~1TiB in combined ephemeral storage available
> per
> >>> instance. I'm sure it depends upon the instance type, though.
> >>> Remember that terminating the instance loses the ephemeral data..
> >>> that's what makes it ... ephemeral. Just remember to copy what you
> >>> need back to an EBS-backed storage volume before you terminate.
> >>>
> >>> - -chris
> >>
> >> Chris, If I remember my empirical testing of the AWS ephemeral
> >> storage system, you actually lose data on shutdown, not termination.
> >
> > Not true, the ephemeral data is only lost on instance termination.
> 
> Confirmed -- at least with "shutdown -r", and on an m1.large instance
> - -- /mnt/ephemeralX retains files across reboots. I didn't do a "stop"
> and "start" from the GUI or anything like that, though.
> 
> I think you're supposed to be able to rely on ephemeral storage. The
> thing is that it's not EBS-backed: it's actually only on the physical
> server that you get when you launch an instance. When you shut-down,
> the data stays on the physical machine and you can only get to it again
> when you boot the same instance on the same machine. Since AWS always
> runs instances on the same physical hardware every time, you're good
> unless you /terminate/ (i.e. discard) the instance.
> 
> Honestly, I was a bit surprised to find out that each time you launch
> an instance it doesn't just get launched on some random piece of
> equipment. That would seem more flexible (if wasteful: moving GiBs of
> data around to various hosts isn't exactly fast) to me.
> 
> On more than one occasion, I've had an instance start acting funny and
> shortly thereafter, I get an email from AWS saying that they will be
> terminating my instance in a few days. You can't just "migrate" the VM
> to another piece of hardware. Instead, you have to image the VM, create
> an AMI from that image, create a new instance with that AMI, and
> destroy the old instance. (Then delete the old image *and* EBS store,
> otherwise you continue to pay for the disk space taken up by an
> instance that will never again be launched). Pain in the neck.
> 
> I think you can create an AMI directly from a running instance these
> days (probably for this exact reason).
> 
> - -chris

Well, I must admit my test was using an m4.xlarge with EBS-backed root, so my tests might have had some difference. I don't remember if I tested it with "shutdown -r" or "init 6", though I do remember doing a stop/start from the GUI (since that's probably what my backup folks here would end up doing). 
BTW: If you set up your instance with an EBS-backed startup drive (or all useful drives), then you don't have to worry about all that AMI business, they can just mount your drives on another physical box.  Of course, at that point, the ephemeral drives are basically useless for anything other than temp/swap space. Makes one wonder why they are even offered, though I'm OK with using them for those purposes.
Jeff 

Re: [OT] Using the bin/daemon.sh script on ubuntu.

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Igor,

On 8/6/13 6:28 AM, Igor Cicimov wrote:
> On 06/08/2013 12:40 AM, "Jeffrey Janner"
> <Je...@polydyne.com> wrote:
>> 
>>> -----Original Message----- From: Christopher Schultz
>>> [mailto:chris@christopherschultz.net] Sent: Friday, August 02,
>>> 2013 10:30 PM To: Tomcat Users List Subject: Re: [OT] Using the
>>> bin/daemon.sh script on ubuntu.
>>> 
>>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
>>> 
>>> Christian
>>> 
>>> On 8/1/13 11:55 AM, Christian Schneider wrote:
>>>> On our (AWS) installation we have limited space on /opt,
>>>> therefore we attached an EBS volume  to /var/, - otherwise we
>>>> would get problems with the log files. Now it can grow above
>>>> some GB.
>>> 
>>> Have you thought about using /mnt/ephemeral[0-9]?
>>> 
>>> Our instances have ~1TiB in combined ephemeral storage
>>> available per instance. I'm sure it depends upon the instance
>>> type, though. Remember that terminating the instance loses the
>>> ephemeral data.. that's what makes it ... ephemeral. Just
>>> remember to copy what you need back to an EBS-backed storage
>>> volume before you terminate.
>>> 
>>> - -chris
>> 
>> Chris, If I remember my empirical testing of the AWS ephemeral
>> storage system, you actually lose data on shutdown, not
>> termination.
> 
> Not true, the ephemeral data is only lost on instance termination.

Confirmed -- at least with "shutdown -r", and on an m1.large instance
- -- /mnt/ephemeralX retains files across reboots. I didn't do a "stop"
and "start" from the GUI or anything like that, though.

I think you're supposed to be able to rely on ephemeral storage. The
thing is that it's not EBS-backed: it's actually only on the physical
server that you get when you launch an instance. When you shut-down,
the data stays on the physical machine and you can only get to it
again when you boot the same instance on the same machine. Since AWS
always runs instances on the same physical hardware every time, you're
good unless you /terminate/ (i.e. discard) the instance.

Honestly, I was a bit surprised to find out that each time you launch
an instance it doesn't just get launched on some random piece of
equipment. That would seem more flexible (if wasteful: moving GiBs of
data around to various hosts isn't exactly fast) to me.

On more than one occasion, I've had an instance start acting funny and
shortly thereafter, I get an email from AWS saying that they will be
terminating my instance in a few days. You can't just "migrate" the VM
to another piece of hardware. Instead, you have to image the VM,
create an AMI from that image, create a new instance with that AMI,
and destroy the old instance. (Then delete the old image *and* EBS
store, otherwise you continue to pay for the disk space taken up by an
instance that will never again be launched). Pain in the neck.

I think you can create an AMI directly from a running instance these
days (probably for this exact reason).

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJSAcRtAAoJEBzwKT+lPKRYogQQAKGd+eI4KbJ3Y9aSrS73iZ3g
BIHxDL5EvZ+45KKIzKWZAEu5ojjJhT9eR8szwt19yR3ZxleGGFgiU202W+RRVMCN
fw3saTN34QTDR2R+16zoqgX2CvdJm16exiXzurq5M941nsJHyZY3LL7WyVkAkW22
Q3xIQEYlR9t1LckxPJNRuw8Ix0qEHD/dVcOucTDBI9MVWKLny4MTJzdb9mCdb+1T
fDza8JtQxOvywhFb4aVwkO1YRP4RYjswAH5mXDMcfFvWeZse7u+4tahvPkAwxkc/
DKkWA7l+ltC7dy95N4Ge+vErkCYMruwc6xCvFM+rfk95Bw+WdhpZ4zoE9nX304Ku
Y/pvljaPJhPDxldEnEVKqpfd9Zu/6GIximFTFDJ2zDzZ4XWSpR6sUpVGbK38x7oX
NT1j2k36IU6jfog/Z2f4Hq6ZI1jc8hFix0trP+zqhzyMibbkek+mMwm2M+Z/jv8F
AxYl1qnXsxRzZQ/Ja6gu00aem3x77LFqzkpu0wgbDnjt6iA1xqMft+UL2bXA+0Ba
UPPAAi/xrf8MXjOBAc0IR2Oo/UIe2hw8m/pCwVvOYowSwnKaCj3oD8SNFZ4/fuRS
slVaDu8t9+73GDE6m2kOZ1mZQ8koZ76nIp6bS/bvOOWzatni7iOL3DnYl6LpXUUk
utx9mVW7vkYe+2OZfdPR
=2YAn
-----END PGP SIGNATURE-----

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


RE: [OT] Using the bin/daemon.sh script on ubuntu.

Posted by Igor Cicimov <ic...@gmail.com>.
On 06/08/2013 12:40 AM, "Jeffrey Janner" <Je...@polydyne.com>
wrote:
>
> > -----Original Message-----
> > From: Christopher Schultz [mailto:chris@christopherschultz.net]
> > Sent: Friday, August 02, 2013 10:30 PM
> > To: Tomcat Users List
> > Subject: Re: [OT] Using the bin/daemon.sh script on ubuntu.
> >
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA256
> >
> > Christian
> >
> > On 8/1/13 11:55 AM, Christian Schneider wrote:
> > > On our (AWS) installation we have limited space on /opt, therefore we
> > > attached an EBS volume  to /var/, - otherwise we would get problems
> > > with the log files. Now it can grow above some GB.
> >
> > Have you thought about using /mnt/ephemeral[0-9]?
> >
> > Our instances have ~1TiB in combined ephemeral storage available per
> > instance. I'm sure it depends upon the instance type, though. Remember
> > that terminating the instance loses the ephemeral data.. that's what
> > makes it ... ephemeral. Just remember to copy what you need back to an
> > EBS-backed storage volume before you terminate.
> >
> > - -chris
>
> Chris,
> If I remember my empirical testing of the AWS ephemeral storage system,
you actually lose data on shutdown, not termination.

Not true, the ephemeral data is only lost on instance termination.

> On my Linux boxes, I use the ephemeral storage for swap space because of
that issue, and really nothing else, though /tmp is a second possibility.
 The big thing about using it, for anything, is you have to code a special
startup script to format it at every boot, as it comes back as raw disk.
 Figuring out how to do that for swap was fun, but it's great now (I've got
loads of swap space that I'll probably never ever use.)
> Jeff
>

RE: [OT] Using the bin/daemon.sh script on ubuntu.

Posted by Jeffrey Janner <Je...@PolyDyne.com>.
> -----Original Message-----
> From: Christopher Schultz [mailto:chris@christopherschultz.net]
> Sent: Friday, August 02, 2013 10:30 PM
> To: Tomcat Users List
> Subject: Re: [OT] Using the bin/daemon.sh script on ubuntu.
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> Christian
> 
> On 8/1/13 11:55 AM, Christian Schneider wrote:
> > On our (AWS) installation we have limited space on /opt, therefore we
> > attached an EBS volume  to /var/, - otherwise we would get problems
> > with the log files. Now it can grow above some GB.
> 
> Have you thought about using /mnt/ephemeral[0-9]?
> 
> Our instances have ~1TiB in combined ephemeral storage available per
> instance. I'm sure it depends upon the instance type, though. Remember
> that terminating the instance loses the ephemeral data.. that's what
> makes it ... ephemeral. Just remember to copy what you need back to an
> EBS-backed storage volume before you terminate.
> 
> - -chris

Chris,
If I remember my empirical testing of the AWS ephemeral storage system, you actually lose data on shutdown, not termination.
On my Linux boxes, I use the ephemeral storage for swap space because of that issue, and really nothing else, though /tmp is a second possibility.  The big thing about using it, for anything, is you have to code a special startup script to format it at every boot, as it comes back as raw disk.  Figuring out how to do that for swap was fun, but it's great now (I've got loads of swap space that I'll probably never ever use.)
Jeff


Re: [OT] Using the bin/daemon.sh script on ubuntu.

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Christian

On 8/1/13 11:55 AM, Christian Schneider wrote:
> On our (AWS) installation we have limited space on /opt, therefore
> we attached an EBS volume  to /var/, - otherwise we would get
> problems with the log files. Now it can grow above some GB.

Have you thought about using /mnt/ephemeral[0-9]?

Our instances have ~1TiB in combined ephemeral storage available per
instance. I'm sure it depends upon the instance type, though. Remember
that terminating the instance loses the ephemeral data.. that's what
makes it ... ephemeral. Just remember to copy what you need back to an
EBS-backed storage volume before you terminate.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJR/HlFAAoJEBzwKT+lPKRYXJ8P/j3ouG9axBAGB5SvTV7VHImf
JzFOZr37S5Dv/3jerxe/w7prBc713efM/8MDIPJ1ccmNRxbsfB+Q2xvHIhxvKA4m
30HYsdGL08zjx9skyUaoSBLP9EU0FA5if3FhvGMeyhp5uwqZSL9SlBtBOZI03DDg
EiLi1qUP6MQ4MqZDIPTY1To0zA4Jwn3not3rclGGPDLcdffoEXSr495jbfFS8Hg0
2eRpS0jQF82G6W9iDb8PqvouEdnIRGwWbh2bDVthp72n3ykwM0TZObC574c10JsR
2Dkno5Qs9nwr92aonCYCIJmXSWo+OETV5nVDqWViZfTqXuN+Ewd+vWgyW3XOA/Kr
hwIhsVfql3Ay9XD/oAA2kFzgleTWkY0z/TLckFBoWzzQUnCcQsE+aoSzJ7K2UbGF
DPtoSicgNpByQjo1jR/OJYIpfx4o0T864t5V2c0z4sBRd6kQDxr370A12enzbL7t
lWD+Xwk+pTrX3fS9DDwYC2LVYBb7UBhA85wj1dtlBE5TBoRGJ4QZprceZM0QXM2i
LQF9lt2YGGCwR0DinV1RRExMZEcPiDpfkxBA5WRzV82roKPKPniYifyl6pd7nlzj
HguCAm7AHgwFhj3Zju32VBEsahMipvf50PjWgWoIA9UuCuLs1wzC7ave87yQvf91
RGuhap359f8Ej2WWLcag
=UO6k
-----END PGP SIGNATURE-----

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