747
Comment:
|
3498
|
Deletions are marked like this. | Additions are marked like this. |
Line 11: | Line 11: |
* 192.168.1.40 glusterfs01 * 192.168.1.41 glusterfs02 * 192.168.1.42 glusterfs03 * 192.168.1.43 glusterfs04 |
* 192.168.1.40 gluster01 * 192.168.1.41 gluster02 * 192.168.1.42 gluster03 * 192.168.1.43 gluster04 == Disk == === Add hardware === * [[Domain Editing|Domain Editing]] We will add an additional disk to the system. This disk will be used for file storage. in the guest === Configure disk === ==== Partition ==== Create one large partition on vdb with partition type 8e (linux lvm). ==== LVM ==== Set up a new physical volume and volume group {{{ pvcreate /dev/vdb1 vgcreate vg2 /dev/vdb1 }}} ==== LVM Volume ==== {{{ lvcreate --size 4G --name gluster_www vg2 }}} ==== Mountpoint ==== Create the mountpoint. {{{ mkdir /srv/www }}} ==== Format ==== Format the volume. {{{ mkfs.btrfs /dev/vg2/gluster_www }}} ==== fstab ==== Add the volumes to `/etc/fstab`. {{{ /dev/vg2/gluster_www /srv/www btrfs defaults 0 0 }}} |
Line 17: | Line 59: |
{{{ apt-get install glusterfs-server }}} from gluster01 connect with the other gluster servers {{{ gluster peer probe gluster02 gluster peer probe gluster03 gluster peer probe gluster04 }}} check server status {{{ gluster peer status Number of Peers: 3 Hostname: gluster02 Uuid: 031573c2-3b1f-4946-bd78-421563249db6 State: Peer in Cluster (Connected) Hostname: gluster03 Uuid: ff5cec1c-6d7f-4db7-8676-08deff06b4d0 State: Peer in Cluster (Connected) Hostname: gluster04 Uuid: 65fc398a-52e9-4292-9bbb-884becfbf5d6 State: Peer in Cluster (Connected) }}} create the gluster volume. the force option is needed because we are creating the volume on a mountpoint. {{{ gluster volume create www replica 4 transport tcp gluster01:/srv/www gluster02:/srv/www gluster03:/srv/www gluster04:/srv/www force }}} start the volume {{{ root@gluster01:/srv/www# gluster volume start www volume start: www: success root@gluster01:/srv/www# gluster volume status Status of volume: www Gluster process TCP Port RDMA Port Online Pid ------------------------------------------------------------------------------ Brick gluster01:/srv/www 49152 0 Y 826 Brick gluster02:/srv/www 49152 0 Y 1355 Brick gluster03:/srv/www 49152 0 Y 1034 Brick gluster04:/srv/www 49152 0 Y 1135 Self-heal Daemon on localhost N/A N/A Y 846 Self-heal Daemon on gluster02 N/A N/A Y 1377 Self-heal Daemon on gluster03 N/A N/A Y 1054 Self-heal Daemon on gluster04 N/A N/A Y 1155 Task Status of Volume www ------------------------------------------------------------------------------ There are no active volume tasks }}} |
GlusterFS
GlusterFS is a distributed filesystem. It has built in redundancy, so it is possible to run two servers which automatically replicate files between the servers. If one server goes down, the other just takes over. Once it comes up again, files are automatically replicated. Here we will use GlusterFS as a redundant network mounted file storage.
For the sport of it, we will configure 4 GlusterFS servers.
Network
The GlusterFS servers will have fixed IP-addresses. That is configured in the DHCP servers list of statically assigned IP-adresses by using the Domains MAC address.
- 192.168.1.40 gluster01
- 192.168.1.41 gluster02
- 192.168.1.42 gluster03
- 192.168.1.43 gluster04
Disk
Add hardware
Domain Editing We will add an additional disk to the system. This disk will be used for file storage.
in the guest
Configure disk
Partition
Create one large partition on vdb with partition type 8e (linux lvm).
LVM
Set up a new physical volume and volume group
pvcreate /dev/vdb1 vgcreate vg2 /dev/vdb1
LVM Volume
lvcreate --size 4G --name gluster_www vg2
Mountpoint
Create the mountpoint.
mkdir /srv/www
Format
Format the volume.
mkfs.btrfs /dev/vg2/gluster_www
fstab
Add the volumes to /etc/fstab.
/dev/vg2/gluster_www /srv/www btrfs defaults 0 0
Software
apt-get install glusterfs-server
from gluster01 connect with the other gluster servers
gluster peer probe gluster02 gluster peer probe gluster03 gluster peer probe gluster04
check server status
gluster peer status Number of Peers: 3 Hostname: gluster02 Uuid: 031573c2-3b1f-4946-bd78-421563249db6 State: Peer in Cluster (Connected) Hostname: gluster03 Uuid: ff5cec1c-6d7f-4db7-8676-08deff06b4d0 State: Peer in Cluster (Connected) Hostname: gluster04 Uuid: 65fc398a-52e9-4292-9bbb-884becfbf5d6 State: Peer in Cluster (Connected)
create the gluster volume. the force option is needed because we are creating the volume on a mountpoint.
gluster volume create www replica 4 transport tcp gluster01:/srv/www gluster02:/srv/www gluster03:/srv/www gluster04:/srv/www force
start the volume
root@gluster01:/srv/www# gluster volume start www volume start: www: success root@gluster01:/srv/www# gluster volume status Status of volume: www Gluster process TCP Port RDMA Port Online Pid ------------------------------------------------------------------------------ Brick gluster01:/srv/www 49152 0 Y 826 Brick gluster02:/srv/www 49152 0 Y 1355 Brick gluster03:/srv/www 49152 0 Y 1034 Brick gluster04:/srv/www 49152 0 Y 1135 Self-heal Daemon on localhost N/A N/A Y 846 Self-heal Daemon on gluster02 N/A N/A Y 1377 Self-heal Daemon on gluster03 N/A N/A Y 1054 Self-heal Daemon on gluster04 N/A N/A Y 1155 Task Status of Volume www ------------------------------------------------------------------------------ There are no active volume tasks