[Voyage-linux] Running MySQL on memory
Michael Fung
(spam-protected)
Mon Nov 9 12:32:28 HKT 2009
An embedded and charset-unspecified text was scrubbed...
Name: warning1.txt
URL: <http://list.voyage.hk/pipermail/voyage-linux/attachments/20091109/0976a3d8/attachment.txt>
-------------- next part --------------
Hello all,
I have an application that updates the data tables heavily. I worked out these and may be someone need it too.
Put backup-mydb.sh in /usr/local/bin
Edit and run the backup-mydb.sh script (set ROOTPW, ...etc)
Create mount point for new datadir:
Edit /etc/fstab , add lines:
# for mysql:
tmpfs /var/mysqldata tmpfs defaults,size=16M 0 2
run:
mount /var/mysqldata
df -h
You see this line in the output:
tmpfs 16M 1.2M 15M 8% /var/mysqldata
shutdown mysql, run:
invoke-rc.d mysql stop
Edit /etc/mysql/my.cnf, set
datadir = /var/mysqldata
replace /etc/init.d/mysql with the attached modified version.
(the modified one is based on 5.0.51a-24+lenny2)
start mysql, run
invoke-rc.d mysql start
The script will automatically restore all data files to /var/mysqldata
You can also run backup-mydb.sh by cron periodically.
Next time when you normally shutdown the system, the data files is auto backed up.
When the system restart, the data files is auto restored.
Your comments are welcome.
- Michael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mysql
Type: application/octet-stream
Size: 6970 bytes
Desc: not available
URL: <http://list.voyage.hk/pipermail/voyage-linux/attachments/20091109/0976a3d8/attachment.obj>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: defang-1.binary
URL: <http://list.voyage.hk/pipermail/voyage-linux/attachments/20091109/0976a3d8/attachment.ksh>
More information about the Voyage-linux
mailing list