[[zfs cheatsheet]]
|
|
———
|
Table of Contents
zfs cheatsheetinstall zfs on centos 7.3(source): 1. install zfs repo: yum install http://download.zfsonlinux.org/epel/zfs-release.el7_3.noarch.rpm 2. disable zfs and enable zfs-kmod in /etc/yum.repos.d/zfs.repo in order to automatically import pools on CentOS run this (source): systemctl preset zfs-import-cache zfs-import-scan zfs-mount zfs-share zfs-zed zfs.target Create poolzpool create -o mountpoint=/path/to/mount <name> <raid level> <dev1> <dev2> ... Raid levels:
example - create raid5 of 4 disks: zpool create -o mountpoint=/storage storage raidz /dev/sdb /dev/sdc /dev/sdd /dev/sde Create FilesystemsCreate filesystem zfs create [-o mountpoint=/path/to/mount] -o compression=lz4 <pool>/<fsname> create sub-filesystem zfs create [-o mountpoint=/path/to/mount] -o compression=lz4 <pool>/<fsname>/<subfsname> Default mount point is as a subdirectory of pool mount point. To set mount point: zfs set mountpoint=/path/to/mount <pool>/<fsname> Remove filesystem zfs destroy [-f] <pool><filesystem> cacheMySQLMySQL This assumes lots of RAM Tweaks for MySQL innodb_flush_log_at_trx_commit=2 skip-innodb_doublewrite Tweaks for ZFS zfs set primarycache=metadata tank/db zfs set atime=off tank/db zfs set recordsize=16k tank/db/innodb zfs set recordsize=128k tank/db/logs zfs set zfs:zfs_nocacheflush = 1 zfs set sync=disabled tank/db Note: MySQL 5.6.6 and newer (and related MariaDB / Percona forks) has innodb_file_per_table = on as default, so IBD files are not created under tank/db/innodb (defined by innodb_data_home_dir in your my.cnf), they are created under tank/db/<db_name>/ and you should use recordsize=16k on this dataset too or switch back to innodb_file_per_table = off Links
|