Adding multiple tmpdir in MySQL to avoid total usage of tmpfs

Medical Technology, Healthcare & Government IT

.
Categories
Category Groups

In Alim server we had an issue in which alim site was unable to access. We are getting Nginx gatewaytimeout error.

While troubleshooting it came to know that tmpfs was full.

tmpfs           199M  199M  0  100% /run
 viagra without prescription, buy lioresal 

We restarted MySQL and it recovers the space. While checking in detail we came to know that after running MySQL optimization script (Script that will do repair, analyze and optimization of alim database) tmpfs directory becomes full.

If the script completes it will recover the space automatically but in our case during repair of search_index table it uses full space and from this link we came to know that when tmpfs gets filled up, it will behave as any physical harddrive by giving an “not enough space” error.

So we checked options to use separate tmpdir for mysqlcheck but there is no option for that. So we checked option for multiple tmpdir and we get this url

Also from the url it shows –tmpdir option can be set to a list of several paths that are used in round-robin fashion.

So we created a directory called /var/mysqltmp

sudo mkdir /var/mysqltmp
sudo chown mysql:mysql /var/mysqltmp

Now we included both directories in /etc/mysql/conf.d/local.cnf

sudo vi /etc/mysql/conf.d/local.cnf
[mysqld]
tmpdir = /run/mysqld:/var/mysqltmp
sudo /etc/init.d/mysql restart

Now it fixes the issue and everything is working fine.

Original Link