From owner-freebsd-questions@FreeBSD.ORG Fri May 2 16:21:52 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1AD391065673 for ; Fri, 2 May 2008 16:21:52 +0000 (UTC) (envelope-from eagletree@hughes.net) Received: from n120.sc0.he.tucows.com (smtpout1066.sc0.he.tucows.com [64.97.144.66]) by mx1.freebsd.org (Postfix) with ESMTP id DC8398FC17 for ; Fri, 2 May 2008 16:21:51 +0000 (UTC) (envelope-from eagletree@hughes.net) Received: from sc0-out06.emaildefenseservice.com (64.97.131.2) by n120.sc0.he.tucows.com (7.2.069.1) id 476BFC810194B157; Fri, 2 May 2008 16:21:50 +0000 X-SpamScore: 2 X-Spamcatcher-Summary: 2, 0, 0, deb56d278085acee, b9338917dab56e3e, eagletree@hughes.net, -, RULES_HIT:355:379:541:564:599:601:967:973:982:988:989:1260:1261:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1766:1792:2194:2199:2379:2393:2525:2553:2559:2564:2682:2685:2693:2857:2859:2933:2937:2939:2942:2945:2947:2951:2954:3022:3027:3354:3865:3866:3867:3868:3869:3870:3871:3872:3873:3874:3934:3936:3938:3941:3944:3947:3950:5007:6117:6248:7652:7679:7875:7903: 8603, 0, RBL:none, CacheIP:none, Bayesian:0.5, 0.5, 0.5, Netcheck:none, DomainCache:0, MSF:not bulk, SPF:, MSBL:none, DNSBL:none, TSO:0 X-Spamcatcher-Explanation: Received: from [192.168.0.3] (dpc6744118153.direcpc.com [67.44.118.153]) (Authenticated sender: eagletree@hughes.net) by sc0-out06.emaildefenseservice.com (Postfix) with ESMTP; Fri, 2 May 2008 16:21:44 +0000 (UTC) In-Reply-To: <481B3A0E.6060300@lc-words.com> References: <481B08B2.7070702@lc-words.com> <4C629ECE-9203-4A3B-94FA-8BACEA07EE70@hughes.net> <481B3A0E.6060300@lc-words.com> Mime-Version: 1.0 (Apple Message framework v753) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <9C2A6842-CBB4-4DD6-B759-4054BCAE2C70@hughes.net> Content-Transfer-Encoding: 7bit From: Chris Pratt Date: Fri, 2 May 2008 09:10:45 -0700 To: z.szalbot@lc-words.com X-Mailer: Apple Mail (2.753) Cc: freebsd-questions@freebsd.org Subject: Re: handling mysql binlog data X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 May 2008 16:21:52 -0000 On May 2, 2008, at 8:58 AM, Zbigniew Szalbot wrote: > >> The procedure for this is here: >> http://dev.mysql.com/doc/refman/5.1/en/purge-master-logs.html >> for 5.1 and here: >> http://dev.mysql.com/doc/refman/5.0/en/purge-master-logs.html >> for 5.0 > > Thanks a lot! It did help me get rid of a few files in a safe way. > I only wonder now how to set up a cron job to do it on a permanent > basis? > > 1/ I would probably be better off setting this mysql query (URGE > {MASTER | BINARY} LOGS BEFORE 'date') in a separate file an run it > from cron? > > 2/ Even if I do that, I would still have to change the 'date' value > each month... hmm... as non-programmer I will probably do best to > simply enter a task in a calendar to run this manually... each > month :) > > Thank you anyway - this was very helpful and I instantly saved a > lot of space on a shrinking /var partition! > I find it most comfortable to do this manually so I can check my backups first. There is an example in the reply comments below the documentation on the 5.0 version of the mysql doc page that shows a "unix" way to set up a cron script and automate the process. I've not tried it. Shrinking /var partition?: I found the ports setup of mysql to be overly restrictive by using the /var method. It was simple to install, shutdown mysqld, copy the contents of the /var database files (preserving the appropriate ownership and permissions). I then added (assuming /usr is your large partition) mysql_dbdir="/usr/mysql" mysql_datadir="/usr/mysql" to /etc/rc.conf and restarted. It is an outage but it helped given I'd never have thought to size /var anywhere near what a medium size database required.