```{index} volume, quota, внешние ссылки ``` # Создание и настройка volume ## Скрипт для создания ```bash #!/bin/bash # Simple script to create new GlusterFS volume # Alexey 2021-06-08 ####################### # Initial settings # ####################### newvolname=tagil quota_size=50GB # Path to create all new volumes at # https://docs.gluster.org/en/latest/Administrator-Guide/Brick-Naming-Conventions/ # > We're going to define the actual brick in the brick directory on that filesystem. # > This helps by causing the brick to fail to start if the XFS filesystem isn't mounted. mount_root=/data/glusterfs/brick1/brick/ # It's better to use FQDN AFAIK gfs_node1=c07-gluster01.sitefactory.local gfs_node2=c07-gluster02.sitefactory.local gfs_node3=c07-gluster03.sitefactory.local ####################### # Main part # ####################### newvol_path="${mount_root}/${newvolname}" mkdir -p "${newvol_path}" gluster volume create "${newvolname}" replica 3 transport tcp "${gfs_node1}:${newvol_path}" "${gfs_node2}:${newvol_path}" "${gfs_node3}:${newvol_path}" exitcode=$? if [ ${exitcode} -ne 0 ] then exit 1 fi gluster volume start "${newvolname}" # Set quota gluster volume quota "${newvolname}" enable gluster volume quota "${newvolname}" limit-usage / "${quota_size}" # Additional tweaks gluster volume set "${newvolname}" network.ping-timeout 2 gluster volume set "${newvolname}" performance.quick-read on gluster volume set "${newvolname}" cluster.quorum-type fixed gluster volume set "${newvolname}" cluster.quorum-count 2 ``` ## Создание вручную Создание volume ```bash export NEWVOLNAME=apppro mkdir -p "/export/${NEWVOLNAME}" # Лучше использовать fqdn, или я не прав? gluster volume create "${NEWVOLNAME}" replica 3 transport tcp prod-fs-01.sitefactory.local:"/export/${NEWVOLNAME}" prod-fs-02.sitefactory.local:"/export/${NEWVOLNAME}" prod-fs-03.sitefactory.local:"/export/${NEWVOLNAME}" gluster volume start "${NEWVOLNAME}" ``` Определение quota ```bash gluster volume quota "${NEWVOLNAME}" enable gluster volume quota "${NEWVOLNAME}" limit-usage / 50GB ``` Дополнительные настройки ```bash gluster volume set "${NEWVOLNAME}" network.ping-timeout 2 gluster volume set "${NEWVOLNAME}" performance.quick-read on gluster volume set "${NEWVOLNAME}" cluster.quorum-type fixed gluster volume set "${NEWVOLNAME}" cluster.quorum-count 2 ```