How do you deal with ulog files?

1,497 views
Skip to first unread message

Jeff Davey

unread,
Feb 25, 2010, 2:58:26 PM2/25/10
to Tokyo Cabinet Users
Been running a small cluster of TT servers for a project, and every
few days I have to go clear out the ulog files.

How do you guys on this list normally deal with the ulog files? Kill
everything but the last 5? Use the inform command to determine which
are no longer relevant? Via cron?

Anyone have a script or two they'd like to share? :)

Jeff

Jeremy Hinegardner

unread,
Feb 26, 2010, 12:15:25 AM2/26/10
to tokyocabi...@googlegroups.com

I made the tokyotyrant ruby gem (also just a commandline program) to manage my
tyrant clusters. 'archive-ulog' is one of the sub commands.

$ tyrantmanager archive-ulogs --help
NAME
tyrantmanager v1.4.1

SYNOPSIS
tyrantmanager archive-ulogs instances [options]+

DESCRIPTION
Archive the ulog files that are no longer necessary for replication

PARAMETERS
instances (1 -> list(instances=all))
A comman separated list of instance names the tyrant manager knows
about
--home=home (0 ~> home=/var/lib/tyrant)
The home directory of the tyrant manager
--log-level=log-level (0 ~> log-level)
The verbosity of logging, one of [ debug, info, warn, error, fatal ]
--archive-method=archive-method (0 ~> archive-method=compress)
The method of archiving, compress, or delete. Choosing 'delete' will
also delete previously 'compressed' ulog files.
--dry-run
Do not archive, just show the commands
--slaves=slaves (0 ~> list_of_string(slaves))
Comma separated list of slave instances connection strings
host:port,host:port,...
--help, -h

AUTHOR
Copyright 2009 (c) Jeremy Hinegardner

I run via cron every night:

/usr/local/bin/tyrantmanager archive --home /var/lib/tyrant/

enjoy,

-jeremy


--
========================================================================
Jeremy Hinegardner jer...@hinegardner.org

sime

unread,
Mar 1, 2010, 12:33:39 AM3/1/10
to Tokyo Cabinet Users
On Feb 26, 4:15 pm, Jeremy Hinegardner <jer...@hinegardner.org> wrote:
> On Thu, Feb 25, 2010 at 11:58:26AM -0800, Jeff Davey wrote:
> > Been running a small cluster of TT servers for a project, and every
> > few days I have to go clear out the ulog files.
>
> > How do you guys on this list normally deal with the ulog files? Kill
> > everything but the last 5? Use the inform command to determine which
> > are no longer relevant? Via cron?
>
> > Anyone have a script or two they'd like to share? :)
>
> I made the tokyotyrant ruby gem (also just a commandline program) to manage my
> tyrant clusters.  'archive-ulog' is one of the sub commands.

On a similar note, the documentation for ttservctl suggests that logs
will rotate when sent a SIGHUP signal. I have tried both "ttservcrtl
hup" and "kill -HUP processid" with no luck. Though I can't see what I
am doing wrong, the server does restart according to the log.

http://1978th.net/tokyotyrant/spex.html#serverprog_ttservctl

Jeremy Hinegardner

unread,
Mar 1, 2010, 2:15:50 AM3/1/10
to tokyocabi...@googlegroups.com
On Sun, Feb 28, 2010 at 09:33:39PM -0800, sime wrote:
> On Feb 26, 4:15?pm, Jeremy Hinegardner <jer...@hinegardner.org> wrote:
> > On Thu, Feb 25, 2010 at 11:58:26AM -0800, Jeff Davey wrote:
> > > Been running a small cluster of TT servers for a project, and every
> > > few days I have to go clear out the ulog files.
> >
> > > How do you guys on this list normally deal with the ulog files? Kill
> > > everything but the last 5? Use the inform command to determine which
> > > are no longer relevant? Via cron?
> >
> > > Anyone have a script or two they'd like to share? :)
> >
> > I made the tokyotyrant ruby gem (also just a commandline program) to manage my
> > tyrant clusters. ?'archive-ulog' is one of the sub commands.

>
> On a similar note, the documentation for ttservctl suggests that logs
> will rotate when sent a SIGHUP signal. I have tried both "ttservcrtl
> hup" and "kill -HUP processid" with no luck. Though I can't see what I
> am doing wrong, the server does restart according to the log.
>
> http://1978th.net/tokyotyrant/spex.html#serverprog_ttservctl

I think that the this is to support debug/error log rotation, not ulog
rotation. Hitting the server with HUP makes the server close and reopen
the debug/error log. You would use this in combination with something
like logrotate to rotate the logs and then hit ttserver with HUP in the
'postrotate' section of the logrotate config.

This would have ttserver close its log file handles and then open up
the log file again, which would create the file again, since the old
one had been moved by logrotate.

I just tested this scenario and that appears to be what happens. Hittting
ttserver with HUP does not have it reopen the ulog files, it only has it reopen
then debug/error log file.

Reply all
Reply to author
Forward
0 new messages