[mythtv-users] ramfs for mysql

Miroslav Suchy miroslav at suchy.cz
Thu Jan 5 16:13:17 UTC 2012


On 01/04/2012 06:14 PM, Josu Lazkano wrote:
> Hello, I just configure the tmpfs for mysql, I make it with this steps:
>
> mkdir /tmp/mysqltmp
> chown mysql:mysql /tmp/mysqltmp
>
> id mysql
> uid=110(mysql) gid=117(mysql) groups=117(mysql)
>
> nano /etc/fstab
>
> tmpfs /tmp/mysqltmp tmpfs rw,gid=117,uid=110,size=1G,nr_inodes=10k,mode=0700 0 0
>
> /etc/init.d/mysql stop
>
> nano /etc/mysql/my.cnf
>
> tmpdir=/tmp/mysqltmp/
>
> cp -R /var/lib/mysql /tmp/mysqltmp/
> chown -R mysql:mysql /tmp/mysqltmp/mysql/
>
> /etc/init.d/mysql start
>
> Now it is working great, I check the mythweb and it is faster than
> before, I am not at home and I can not check the LiveTV speed.
>
> I know that if I power off the system, I will lose all data, how could
> I make the mysqldump?
>
> How could I copy all data on system stop and then copy again on system start?
>
> Thanks for your great help, best regards.
>

This is generally bad idea.
It can be done, but it will cost you a lot of work, which is not worth 
of it.

You can do the same with much less effort by tuning up 
/etc/mysql/my.cnf. You can start with:
tmpdir          = /dev/shm
Which will use tmpfs for temporary tables.

And bump up some variables of mysql. This is what I have in my my.cnf:
set-variable    = sort_buffer_size=100M
read_buffer_size = 100M
set-variable    = read_rnd_buffer_size=100M
set-variable    = max_connect_errors=2000
myisam_sort_buffer_size = 100M
set-variable    = max_connections=2000
set-variable    = tmp_table_size=128M
set-variable    = max_heap_table_size=128M
innodb_flush_log_at_trx_commit=0
innodb_buffer_pool_size=500M

But be warned, that I have a *lot* of memory. You can check 
http://dev.mysql.com/doc/refman/5.0/en/memory-use.html

Mirek


More information about the mythtv-users mailing list