Jail: db

one time
zfs create ship/db
zfs set recordsize=128k ship/db
zfs set sync=disabled ship/db
zfs set compression=gzip ship/db
#zfs set atime=off ship/db

zfs create ship/db/log
zfs create ship/db/data
zfs set recordsize=16k ship/db/data
zfs set primarycache=metadata ship/db/data

zfs get -r recordsize,sync,compression,primarycache ship/db

#Since MySQL uses it’s own cache, it isn’t necessary to cache both metadata and data in the ARC. Set the dataset to only cache metadata.

create jail
export JAIL=db
export JAILHOSTNAME=db
export JAILDOMAIN=ahlawat.com
export JAILIP=53
export JAILUSER=X
export JAILUSERID=1000
export JAILUSERVNC=false

/root/FreeBSD/jails/create.sh $JAIL $JAILHOSTNAME $JAILDOMAIN $JAILIP $JAILUSER $JAILUSERID $JAILUSERVNC

iocage fstab -r $JAIL /mnt/ship/certs /mnt/certs nullfs ro 0 0

iocage exec $JAIL "mkdir  /var/db/mysql"
iocage exec $JAIL "mkdir  /var/db/mysql-log"
iocage fstab -a $JAIL /mnt/ship/db/data /var/db/mysql nullfs rw 0 0
iocage fstab -a $JAIL /mnt/ship/db/log /var/db/mysql-log nullfs rw 0 0
iocage fstab -l $JAIL

iocage exec $JAIL "pkg install -y mariadb105-server"

iocage exec $JAIL "sysrc mysql_enable=YES"
iocage exec $JAIL "cp /mnt/config/my.cnf /usr/local/etc/mysql/my.cnf"
iocage exec $JAIL "cp /mnt/config/server.cnf /usr/local/etc/mysql/conf.d/server.cnf"
iocage exec $JAIL "chown -R mysql:mysql /var/db/mysql*"
iocage exec $JAIL "service mysql-server start"


Notes:

Showcased here is a capital and operational cost effective approach, using minimal server and networking hardware with multiple virtualized applications for Home and Business. This solution template can be easily scaled out and adapted for larger Enterprise deployments.
drop by the diyIT Matrix public room at #diyit:matrix.ahlawat.com
if you have any IT questions/feedback or to request pro bono consulting for a nonprofit

message me privately at @sharad:matrix.ahlawat.com
or email me at - sharad@ahlawat.com - pgpkey: 68DD6B89
Networking and Security Technologist.
Engineer and an avid Programmer.

https://sharad.ahlawat.com
strive to learn and pass on the knowledge to the next generation
one day humanity will understand the meaning of life and hopefully it will be more than ASCII 42 = "*" regex for whatever you want it to be,
and destiny is more than just a roll of a pair of dice with 42 dots (Lets nail down Quantum Entanglement)

May you Live Long (Intelligently) and Prosper and work on technology that matters.
© 2024 Sharad Ahlawat

No personal identifying data is collected or any form of analytics/metrics reported to a third-party by this website.