snippetsqlMinor
How to setup mysql on tmpfs?
Viewed 0 times
mysqlsetuptmpfshow
Problem
How to setup mysql on tmpfs ?
I am reading a tutorial in french, where the author do it this way :
1.) Create a tmpfs directory :
2.) Add it to fstab :
3.) Copy MySQL to tmpfs (is ramfs here is correct?)
4.) Edit /etc/my.cnf
Then restart mysqld and you can optionally add a startup/stop script to backup the ram data to disk...
But I am not sure the above is right : did the writer of this tutorial mistake ramfs for tmpfs here ? He then goes on to use ramfs in the start/stop script, but what ramfs has to do there, isn't it really tmpfs only ?
I am reading a tutorial in french, where the author do it this way :
1.) Create a tmpfs directory :
mkdir /var/tmpfs
mount -t tmpfs -o size=1G tmpfs /var/tmpfs
chown -R mysql:mysql /var/tmpfs/mysql2.) Add it to fstab :
tmpfs /var/tmpfs tmpfs nodev,nosuid,noexec,noatime,size=1G 0 03.) Copy MySQL to tmpfs (is ramfs here is correct?)
service mysql stop
cp -Rfv /var/lib/mysql /var/ramfs/
chown -R mysql:mysql /var/tmpfs/mysql4.) Edit /etc/my.cnf
datadir /var/tmpfs/mysqlThen restart mysqld and you can optionally add a startup/stop script to backup the ram data to disk...
But I am not sure the above is right : did the writer of this tutorial mistake ramfs for tmpfs here ? He then goes on to use ramfs in the start/stop script, but what ramfs has to do there, isn't it really tmpfs only ?
Solution
Before you try doing this: take a look at mysql's "memory" storage engine. I would stick with that rather than having to deal with the many edge cases with e tmpfs.
http://dev.mysql.com/doc/refman/5.5/en/memory-storage-engine.html
we were considering the exact same scenario, but luckly ran across the memory engine, and have not had a problem since.
http://dev.mysql.com/doc/refman/5.5/en/memory-storage-engine.html
we were considering the exact same scenario, but luckly ran across the memory engine, and have not had a problem since.
Context
StackExchange Database Administrators Q#20649, answer score: 2
Revisions (0)
No revisions yet.