GlusterFS: различия между версиями
Внешний вид
Glorin (обсуждение | вклад) |
Glorin (обсуждение | вклад) |
||
| Строка 106: | Строка 106: | ||
chmod +x /etc/init.d/glusterfs-client | chmod +x /etc/init.d/glusterfs-client | ||
systemctl enable glusterfs-client | |||
===== Make depend on glusterfs-server ===== | ===== Make depend on glusterfs-server ===== | ||
Версия от 18:39, 18 мая 2016
GlusterFS
apt-get install glusterfs-server
Add peer
gluster peer probe peer1 gluster peer probe peer2 gluster peer probe peer3
Add volume
One volume
gluster volume create wwww-data transport tcp peer1:/var/gluster/wwww-data
Or multiple
gluster volume create wwww-data replica 3 transport tcp peer1:/var/gluster/wwww-data peer2:/var/gluster/wwww-data peer3:/var/gluster/wwww-data force
Start volumme
gluster volume start www-data
Tuning
gluster volume set wwww-data performance.cache-size 512MB
Mount volume on client
mount.glusterfs peer1:/www-data-wecret /var/www/www-data
Add to fstab
xen2:/www-data /var/www/test.wecret.com glusterfs defaults,_netdev 0 0
Add new Brick to replication
replica = total + new bricks on volume
gluster volume add-brick wwww-data replica 4 peer4:/var/gluster/wwww-data force
Client mount
Client and server placed at same host and need mount glusterfs after glusterfs-server up
vi /etc/init.d/glusterfs-client
#! /bin/sh
### BEGIN INIT INFO
# Provides: glusterfs-client
# Required-Start: $local_fs $remote_fs $network glusterfs-server
# Required-Stop: $local_fs $remote_fs $network
# Should-Start: glusterfs-server
# Should-Stop: glusterfs-server
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: GlusterFS client
# Description: GlusterFS client mount cluster filesystem.
### END INIT INFO
# Author: Chris AtLee <chris@atlee.ca>
# Patched by: Matthias Albert < matthias@linux4experts.de>
# Define LSB log_* functions.
. /lib/lsb/init-functions
do_start()
{
mount.glusterfs peer1:/wecret-www-data /var/www/www-data
return $?
}
do_stop()
{
umount /var/www/www-data
return $?
}
do_status()
{
exit $status
}
case "$1" in
start)
do_start
;;
stop)
do_stop
;;
status)
do_status;
;;
restart|force-reload)
do_stop
sleep 2
do_start
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
chmod +x /etc/init.d/glusterfs-client
systemctl enable glusterfs-client
Make depend on glusterfs-server
mkdir /etc/systemd/system/glusterfs-client.service.d/
vi /etc/systemd/system/glusterfs-client.service.d/depend.conf
[Unit] Requires=glusterfs-server.service After=glusterfs-server.service