Gentoo Archives: gentoo-user

From: kashani <kashani-list@××××××××.net>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] A lot of big files in /var/lib/mysql/ => /var full!
Date: Fri, 23 Apr 2010 20:55:59
Message-Id: 4BD2090B.4020902@badapple.net
In Reply to: [gentoo-user] A lot of big files in /var/lib/mysql/ => /var full! by Jarry
1 On 4/23/2010 9:25 AM, Jarry wrote:
2 > Hi,
3 > today I discovered mysql is slowly eating my disk space!
4 > Actually, one web-server already had /var 98% full.
5 >
6 > After a little search I found more than 200 files in
7 > /var/lib/mysql/mysqld-bin.000001 -~ 000214 of various
8 > size, but together take ~10GB of disk space. Yet phpmyadmin
9 > shows I have only one database ~15MB. So what is all this
10 > mysqld-bin.* crap doing in /var/lib/mysql? I increased
11 > /var, but it does not solve the problem. How can I prevent
12 > mysql from filling up my whole /var partition?
13 >
14 > I looked into /var/log/mysql, mysql.err and mysql.log
15 > are empty, in mysqld.err there are these messages:
16 > -------------------
17 > 100423 15:47:05 [Warning] No argument was provided to --log-bin, and
18 > --log-bin-index was not used; so replication may break when this MySQL
19 > server acts as a master and has his hostname changed!! Please use
20 > '--log-bin=mysqld-bin' to avoid this problem.
21 > InnoDB: The InnoDB memory heap is disabled
22 > InnoDB: use atomic builtins.
23 > 100423 15:47:05 InnoDB: Started; log sequence number 0 43715
24 > 100423 15:47:05 [Note] /usr/sbin/mysqld: ready for connections.
25 > Version: '5.0.90-log' socket: '/var/run/mysqld/mysqld.sock' port: 3306
26 > Gentoo Linux mysql-5.0.90-r2
27 > -------------------
28 >
29 > I must admit I didt not play with mysql configutation much,
30 > just followed gentoo MySQL Startup Guide and everything
31 > seemed to work...
32 >
33 > Jarry
34 >
35
36 Add this line to your /etc/init.d/my.cnf and it'll need to be in the
37 [mysqld] section.
38
39 expire_logs_days = 7
40
41 Then log into Mysql and run this command to set the variable without
42 having to restart Mysql.
43
44 SET GLOBAL expire_logs_days=7;
45
46 While logged in you can immediately expire the old logs with the
47 following command. Even though you've set seven days as the max time
48 Mysql will not expire the old logs until the current log reaches 1GB and
49 it is time to create a new log.
50
51 PURGE BINARY LOGS BEFORE DATE_SUB( NOW( ), INTERVAL 7 DAY);
52
53 Seven days works well for most home systems, but you can set it higher
54 or lower depending on your situation. It is generally not a good idea to
55 turn bin logs off because there are cases when it's easier to recover
56 data or fix tables if you have current logs.
57
58 kashani