Blog personnel d'Alex Sbille sur les technologies, et autres de mes centres d’intérêts.

Aller au contenu | Aller au menu | Aller à la recherche

Mysql / Mariadb tmpdir on tmpfs

On spinning disks, write is dramatically slow for some applications, after tweaking my.cnf, I needed more.

So I'm setting up a tmpfs disk an put mysql tmpdir in it:

Prepare mysql config with only replace the tmpdir value with the future path:

nano /etc/mysql/my.cnf

Add or replace tmpdir value with

tmpdir          = /var/lib/mysqltmp

Create the tmpfs with privileges:

Get uid and gid of mysql / mariadb

id mysql
uid=110(mysql) gid=113(mysql) groupes=113(mysql)

Add a line in the /etc/fstab

nano /etc/fstab

For 500 MB space:

tmpfs   /var/lib/mysqltmp   tmpfs   rw,gid=113,uid=110,size=500m,mode=0750,noatime   0 0

No need to restart, just

mount -a && service mysql restart
[ ok ] Stopping MariaDB database server: mysqld.
[ ok ] Starting MariaDB database server: mysqld . ..
[info] Checking for corrupt, not cleanly closed and upgrade needing tables..
df -h
tmpfs                                                    500M     0  500M   0% /var/lib/mysqltmp

Partage

Ajouter un commentaire

Le code HTML est affiché comme du texte et les adresses web sont automatiquement transformées.

La discussion continue ailleurs

URL de rétrolien : http://www.alexsbille.fr/index.php?trackback/22

Fil des commentaires de ce billet