среда, 27 июля 2016 г.

Кластеры - это модно! (с)

По следам свежей установки gluster на тройку серверов с Centos 7 для разведения там виртуальных машин.

Сначала просто кусок history сразу после установки сервера (язык, клавиатура, время настраивались сразу во время установки):



hostnamectl set-hostname father
hostnamectl status

vi /etc/yum.conf
proxy=http://192.168.22.252:8080/
yum update
yum install epel-release
vi /etc/yum.repos.d/epel.repo
 #baseurl=
 mirrorlist
yum install mc vim bridge-utils ntp ntpdate
mcedit /etc/ntp.conf

systemctl start ntpd
systemctl enable ntpd
systemctl disable chronyd
vim /etc/sysconfig/network-scripts/ifcfg-br0
vim /etc/sysconfig/network-scripts/ifcfg-enp32s0
brctl addbr br0
brctl show
systemctl restart network
vim /etc/sysconfig/selinux
 SELINUX=disabled
ssh-keygen
ssh-copy-id -i /root/.ssh/id_rsa.pub root@son
ssh-copy-id -i /root/.ssh/id_rsa.pub root@spirit
fdisk /dev/sda
reboot

yum groupinstall "Virtualization Platform"
yum groupinstall "Virtualization Client"
yum install xorg-x11-xauth libcanberra-gtk3

logout/login

virt-manager
vim /etc/yum.repos.d/gluster.repo
yum update
yum install glusterfs-server glusterfs-fuse libvirt-lock-sanlock
vim /etc/glusterfs/glusterd.vol
vim /var/lib/glusterd/groups/virt
fdisk /dev/sda
fdisk -l /dev/sda
    Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048   134219775    67108864   83  Linux
/dev/sda2       134219776   167774207    16777216   82  Linux swap / Solaris
/dev/sda3       167774208  2335932415  1084079104   8e  Linux LVM

pvcreate /dev/sda3
vgcreate vg0 /dev/sda3
lvcreate -n lv_gluster -L 512G vg0
mkfs -t xfs /dev/vg0/lv_gluster
mkdir /wall
mcedit /etc/fstab
/dev/vg0/lv_gluster     /wall   xfs     defaults        1 1
mount -a
mount
systemctl start libvirtd
systemctl enable libvirtd
mkdir /wall/brick
systemctl enable glusterd.service
systemctl start glusterd.service
gluster peer status
lvcreate -n lv_sanlock -L1G vg0
mkfs -t xfs /dev/vg0/lv_sanlock
mkdir /wall/brick/sanlock
echo "/dev/vg0/lv_sanlock /wall/brick/sanlock/ xfs defaults 1 1" >> /etc/fstab
mount -a
mount
gluster volume create sanlock replica 3 transport tcp father:/wall/brick/sanlock son:/wall/brick/sanlock spirit:/wall/brick/sanlock
gluster volume status
mkdir /sanlock
vim /etc/fstab
localhost:/sanlock /sanlock glusterfs defaults,_netdev 0 0
mount -a
gluster volume set sanlock auth.allow 127.0.0.1,192.168.22.26,192.168.22.27,192.168.22.28
gluster volume set sanlock auth.reject none
gluster volume info sanlock
mcedit /etc/sysconfig/sanlock
 SANLOCKOPTS="-w 0"
mcedit /etc/libvirt/qemu-sanlock.conf
disk_lease_dir = "/sanlock"
user = "sanlock"
group = "sanlock"
mcedit /etc/libvirt/qemu.conf
 lock_manager = "sanlock"
systemctl start sanlock
systemctl enable sanlock
mcedit /var/lib/glusterd/groups/virt
quick-read=off
read-ahead=off
io-cache=off
stat-prefetch=off
remote-dio=enable
quorum-type=auto
server-quorum-type=server
cluster.eager-lock=enable
nfs.disable=on
sanlock client add_lockspace -s VM_LS:2:/sanlock/VM_LS:0
gluster volume set sanlock storage.owner-uid 179
gluster volume set sanlock storage.owner-gid 179
mcedit /etc/systemd/system/systemd-sanlock
...
        sanlock client add_lockspace -s VM_LS:1:/sanlock/VM_LS:0
        return $retval
}

stop() {
        sanlock client rem_lockspace -s VM_LS:1:/sanlock/VM_LS:0
...