Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
MySQL is eating my /var
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Napalm Llama
Guru
Guru


Joined: 04 Jun 2005
Posts: 533
Location: Cardiff, UK

PostPosted: Mon Nov 20, 2006 6:48 pm    Post subject: MySQL is eating my /var Reply with quote

I returned home today to notice that my emerge -e world had failed due to lack of disk space. On further investigation, it turns out that /var is 100% full - with over 2.5Gb of its 4Gb residing in /var/lib/mysql.

Now all I knowingly use MySQL for on a regular basis is my Amarok database, and I'm fairly sure that's not whats causing it. There are a couple of massive files called /var/lib/mysql/splig-bin.000xxx (splig is my hostname), the largest of which is just a shade over 1Gb.

Now I don't know a lot about MySQL, so could someone tell me if these files are really needed? Have I been pwnd? What's going on?

Cheers,
NL :?
_________________
Ryzen 5600x; Asus TUF Gaming B550-Plus; Geforce 1660 Super
Registered Linux User #381314
# killall humans
Back to top
View user's profile Send private message
kashani
Advocate
Advocate


Joined: 02 Sep 2002
Posts: 2032
Location: San Francisco

PostPosted: Mon Nov 20, 2006 7:07 pm    Post subject: Reply with quote

What you're seeing are bin-log logs. Mysql writes them and uses them for table recovery and replication. To see what Mysql is logging do
Code:
 mysqlbinlog <filename> | less


If a db crash won't bother you greatly or you feel that nightly backups are fine since you're db doesn't update often then remove the bin-log line from your /etc/mysql/my.cnf, restart mysql, and then delete them.

However I recommend putting a weekly cron in that runs the following which will remove all but the last seven days of logs. That should solve your space issues and keep enough logs for Mysql to use for recovery if needed.
Code:
PURGE MASTER LOGS BEFORE DATE_SUB( NOW( ), INTERVAL 7 DAY);


kashani
_________________
Will personally fix your server in exchange for motorcycle related shop tools in good shape.
Back to top
View user's profile Send private message
Napalm Llama
Guru
Guru


Joined: 04 Jun 2005
Posts: 533
Location: Cardiff, UK

PostPosted: Tue Nov 21, 2006 3:12 am    Post subject: Reply with quote

Cool - just one thing, though. I'm assuming here that your command is SQL, in which case, where do I put it to get it automated?
_________________
Ryzen 5600x; Asus TUF Gaming B550-Plus; Geforce 1660 Super
Registered Linux User #381314
# killall humans
Back to top
View user's profile Send private message
zeek
Guru
Guru


Joined: 16 Nov 2002
Posts: 480
Location: Bantayan Island

PostPosted: Tue Nov 21, 2006 5:47 am    Post subject: Reply with quote

Napalm Llama wrote:
Cool - just one thing, though. I'm assuming here that your command is SQL, in which case, where do I put it to get it automated?


I think this should work. In /etc/mysql/my.cnf add

Code:
expire_logs_days = 1


Adjust 1 to how many days you want to keep logs around.
Back to top
View user's profile Send private message
robin_elvin
n00b
n00b


Joined: 25 Nov 2004
Posts: 16
Location: Dereham, Norfolk, England

PostPosted: Tue Nov 21, 2006 8:02 pm    Post subject: Reply with quote

Excellent! I was wondering why my filesystem was full :oops:

Just as a side note
Code:
expire_logs_days = 1


goes in the
Code:
[mysqld]

section of /etc/mysql/my.cnf
Back to top
View user's profile Send private message
madhusker
Tux's lil' helper
Tux's lil' helper


Joined: 03 Jan 2004
Posts: 82
Location: Illinois

PostPosted: Thu Dec 14, 2006 3:47 am    Post subject: Reply with quote

I am surprised that this is not listed in the config file. At least put it in the file,, commented out or something!!!

This "feature" ate my machine for lunch with 24G of useless logs.

A sane default of 30 days or something would be nice.
Back to top
View user's profile Send private message
Acoc
Apprentice
Apprentice


Joined: 06 Aug 2004
Posts: 189
Location: New Jersey, USA

PostPosted: Sun Dec 17, 2006 6:48 am    Post subject: Reply with quote

I agree, it doesn't make sense why they wouldn't, because I think if you set it to 0, it serves the same function as having it off. They should at least set it at 0 and put comments about what it does.

John
_________________
_There were plenty of times in my century when I was gonna give up, but I never did. Never! Hey, are you even listening to me? Oh, I give up._ Futurama
Back to top
View user's profile Send private message
olsberg
n00b
n00b


Joined: 24 Sep 2003
Posts: 19
Location: Sweden

PostPosted: Thu Aug 02, 2007 7:47 am    Post subject: Reply with quote

I totally agree on this proposal. I still do not the the line in my.cnf and my mysql installation eats up 20GB in five days - resulting in server downtime.

Line now added manually, but gosh, this has been a time-consuming search for solutions.
Back to top
View user's profile Send private message
PraetorZero
Apprentice
Apprentice


Joined: 11 Dec 2004
Posts: 239
Location: /home

PostPosted: Sun Jan 24, 2010 3:50 pm    Post subject: Reply with quote

This is an old topic but still very relevant. I've ran into this twice now in the past 6 months and only just now found this thread.
_________________
What's the worst that can happen?
Back to top
View user's profile Send private message
Napalm Llama
Guru
Guru


Joined: 04 Jun 2005
Posts: 533
Location: Cardiff, UK

PostPosted: Tue Jan 26, 2010 8:17 pm    Post subject: Reply with quote

Hmm, does anyone else feel like filing a bug report asking for the default setting to be changed, or shall I? It won't happen otherwise.
_________________
Ryzen 5600x; Asus TUF Gaming B550-Plus; Geforce 1660 Super
Registered Linux User #381314
# killall humans
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum