Solved [Solved] MySQL FreeBSD and ZFS

Re: MySQL FreeBSD and ZFS

Not a tutorial but searching for ZFS and MySQL gives this as the top result:
https://blogs.oracle.com/realneel/entry ... _practices

Although it's written for Solaris you can use pretty much everything. It will at least give you some pointers regarding the various settings on ZFS you can use to optimize it for MySQL.

Setting up MySQL is fairly straightforward. pkg install mysql55-server or make -C /usr/ports/databases/mysql55-server install clean. Then create a ZFS filesystem and mount it on /var/db/mysql. If you start MySQL for the first time it will automatically create the basic databases required to run MySQL. After that it'll work just like any other MySQL installation.
 
Re: MySQL FreeBSD and ZFS

SirDice said:
Then create a ZFS filesystem and mount it on /var/db/mysql. If you start MySQL for the first time it will automatically create the basic databases required to run MySQL. After that it'll work just like any other MySQL installation.
Hi @SirDice
The jail I created for MySQL is already a ZFS filesystem .
Do you still need to do this step?
 
Last edited by a moderator:
Re: MySQL FreeBSD and ZFS

fred974 said:
SirDice said:
Then create a ZFS filesystem and mount it on /var/db/mysql. If you start MySQL for the first time it will automatically create the basic databases required to run MySQL. After that it'll work just like any other MySQL installation.
Hi @SirDice
The jail I created for MySQL is already a ZFS filesystem .
Do you still need to do this step?
In that case, no. But you might want to put the MySQL databases (stored in /var/db/mysql/) on it's own filesystem. That would make it easier to move/copy/snapshot etc. independent of the operating system.
 
Last edited by a moderator:
Re: MySQL FreeBSD and ZFS

Hi @SirDice,

My database jail is under /local/jails/DBJail, will the following do what you advised me to do?
zfs create -o mountpoint=/local/jails/DBJail zroot/jails/DBJail/var/db/mysql/

Thank you in advance,

Fred
 
Last edited by a moderator:
Re: MySQL FreeBSD and ZFS

fred974 said:
My database jail is under /local/jails/DBJail, will the following do what you advised me to do?
zfs create -o mountpoint=/local/jails/DBJail zroot/jails/DBJail/var/db/mysql/
Mountpoint should probably be /local/jails/DBJail/var/db/mysql, dataset is something you created, its name doesn't matter much but zroot/jails/DBJail/var/db/mysql/ assumes you already have zroot/jails/DBJail/var/ and zroot/jails/DBJail/var/db/.
 
Re: MySQL FreeBSD and ZFS

Hi,

My jail dataset was created with the following command:

zfs create -o mountpoint=/local/jails zroot/jails
Code:
root@FreeBSD:~ # zfs list
NAME                                     USED  AVAIL  REFER  MOUNTPOINT
zroot                                   16.9G   251G  6.43G  /zroot
zroot@clean                             2.44G      -  4.47G  -
zroot@laggPatchApplied                   484M      -  6.32G  -
zroot@b4jailinstall.sh                  25.4M      -  6.36G  -
zroot/jails                             5.39G   251G   624K  /local/jails
zroot/jails/basejail                    4.04G   251G  4.04G  /local/jails/basejail
zroot/jails/basejail@20140731_13:54:29   156K      -   216K  -
zroot/jails/holy                         631M   251G   631M  /local/jails/holy
zroot/jails/jericho                      259M   251G   259M  /local/jails/jericho
zroot/jails/newjail                     6.42M   251G  6.42M  /local/jails/newjail
zroot/jails/zion                         477M   251G   477M  /local/jails/zion
zroot/swap                              1.03G   253G   108K  -
zroot/swap@clean                            0      -   108K  -
zroot/swap@laggPatchApplied                 0      -   108K  -
zroot/swap@b4jailinstall.sh                 0      -   108K  -
zroot/jails/zion is the database server here
so..will the following command do the job?

zfs create -o mountpoint=/local/jails/DBJail/var/db/mysql zroot/jails/zion
 
Back
Top