IP | Hostname | Short name |
192.168.1.100 | server1.example.com | server1 |
192.168.1.101 | server2.example.com | server2 |
192.168.1.102 | client1.example.com | client1 |
root@server1:~# cat /etc/hosts 127.0.0.1 localhost 192.168.1.100 server1.example.com server1 192.168.1.101 server2.example.com server2 192.168.1.102 client1.example.com client1 root@server2:~# cat /etc/hosts 127.0.0.1 localhost 192.168.1.100 server1.example.com server1 192.168.1.101 server2.example.com server2 192.168.1.102 client1.example.com client1 root@client1:~# cat /etc/hosts 127.0.0.1 localhost 192.168.1.100 server1.example.com server1 192.168.1.101 server2.example.com server2 192.168.1.102 client1.example.com client1
root@server1:~#apt-get install python-software-properties root@server1:~#add-apt-repository ppa:semiosis/ubuntu-glusterfs-3.5 root@server1:~#apt-get update root@server1:~#apt-get install glusterfs-server - root@server2:~#apt-get install python-software-properties root@server2:~#add-apt-repository ppa:semiosis/ubuntu-glusterfs-3.5 root@server2:~#apt-get update root@server2:~# apt-get install glusterfs-server -
root@server1:~# gluster peer probe server2.example.com Probe successful
root@server1:~# gluster peer status Number of Peers: 1 Hostname: server2.example.com Uuid: 0f3aa4f4-f9dd-4cd2-a7a5-126606fbab33 State: Peer in Cluster (Connected)
root@server2:~# gluster peer status Number of Peers: 1 Hostname: 192.168.1.100 Uuid: ae4e6766-787f-4d0c-8b96-8fc9523ef346 State: Peer in Cluster (Connected)
root@server1:~# mkdir /mnt/dist{1,2} root@server2:~# mkdir /mnt/dist{3,4}
root@server1:~# gluster volume create distributed transport tcp server1:/mnt/dist1 server1:/mnt/dist2 server2:/mnt/dist3 server2:/mnt/dist4 force Creation of volume distributed has been successful. Please start the volume to access data. root@server1:~# gluster volume start distributed Starting volume distributed has been successful
root@server1:~# mkdir /mnt/repl{1,2} root@server2:~# mkdir /mnt/repl{3,4}
root@server1:~# gluster volume create replicated replica 4 transport tcp server1:/mnt/repl1 server2:/mnt/repl3 server1:/mnt/repl2 server2:/mnt/repl4 force Multiple bricks of a replicate volume are present on the same server. This setup is not optimal. Do you still want to continue creating the volume? (y/n) y volume create: replicated: success: please start the volume to access data root@server1:~# gluster volume start replicated volume start: replicated: success
root@server1:~# mkdir /mnt/strip{1,2} root@server2:~# mkdir /mnt/strip{3,4}
root@server1:~# gluster volume create striped stripe 4 transport tcp server1:/mnt/strip1 server1:/mnt/strip2 server2:/mnt/strip3 server2:/mnt/strip4 force Creation of volume striped has been successful. Please start the volume to access data. root@server1:~# gluster volume start striped Starting volume striped has been successful
root@server1:~# mkdir /mnt/dist-strip{1,2} root@server2:~# mkdir /mnt/dist-strip{3,4}
root@server1:~# gluster volume create distributed-striped stripe 2 transport tcp server1:/mnt/dist-strip1 server2:/mnt/dist-strip3 server1:/mnt/dist-strip2 server2:/mnt/dist-strip4 force Creation of volume distributed-striped has been successful. Please start the volume to access data. root@server1:~# gluster volume start distributed-striped Starting volume distributed-striped has been successful
root@server1:~# mkdir /mnt/dist-repl{1,2} root@server2:~# mkdir /mnt/dist-repl{3,4}
root@server1:~# gluster volume create distributed-replicated replica 2 transport tcp server1:/mnt/dist-repl1 server2:/mnt/dist-repl3 server1:/mnt/dist-repl2 server2:/mnt/dist-repl4 force Creation of volume distributed-replicated has been successful. Please start the volume to access data. root@server1:~# gluster volume start distributed-replicated Starting volume distributed-replicated has been successful
root@server1:~# gluster volume info Volume Name: distributed Type: Distribute Volume ID: 01622619-fd93-4ee1-85ad-ca8cf1d85f7e Status: Started Number of Bricks: 4 Transport-type: tcp Bricks: Brick1: server1:/mnt/dist1 Brick2: server1:/mnt/dist2 Brick3: server2:/mnt/dist3 Brick4: server2:/mnt/dist4 Volume Name: replicated Type: Replicate Volume ID: 67afcb89-7e5d-4a02-b4ac-0c2de7cd97be Status: Started Number of Bricks: 1 x 4 = 4 Transport-type: tcp Bricks: Brick1: server1:/mnt/repl1 Brick2: server2:/mnt/repl3 Brick3: server1:/mnt/repl2 Brick4: server2:/mnt/repl4 Volume Name: striped Type: Stripe Volume ID: e9ef42bf-8265-4973-85de-4cafd2a68fec Status: Started Number of Bricks: 1 x 4 = 4 Transport-type: tcp Bricks: Brick1: server1:/mnt/strip1 Brick2: server1:/mnt/strip2 Brick3: server2:/mnt/strip3 Brick4: server2:/mnt/strip4 Volume Name: distributed-striped Type: Distributed-Stripe Volume ID: aa70dd67-3ca9-48cb-865b-b10f8ca1ccad Status: Started Number of Bricks: 2 x 2 = 4 Transport-type: tcp Bricks: Brick1: server1:/mnt/dist-strip1 Brick2: server2:/mnt/dist-strip3 Brick3: server1:/mnt/dist-strip2 Brick4: server2:/mnt/dist-strip4 Volume Name: distributed-replicated Type: Distributed-Replicate Volume ID: 59a819c4-6e84-4c49-9e90-23daa59d12ee Status: Started Number of Bricks: 2 x 2 = 4 Transport-type: tcp Bricks: Brick1: server1:/mnt/dist-repl1 Brick2: server2:/mnt/dist-repl3 Brick3: server1:/mnt/dist-repl2 Brick4: server2:/mnt/dist-repl4
root@client1:~#apt-get install python-software-properties root@client1:~#add-apt-repository ppa:semiosis/ubuntu-glusterfs-3.5 root@client1:~#apt-get update root@client1:~#apt-get install glusterfs-client
root@client1:~# mkdir /mnt/distrib root@client1:~# mount.glusterfs server1:/distributed /mnt/distrib/ root@client1:~# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 7.3G 1.5G 5.5G 21% / udev 236M 4.0K 236M 1% /dev tmpfs 49M 280K 49M 1% /run none 5.0M 0 5.0M 0% /run/lock none 245M 0 245M 0% /run/shm server1:/distributed 30G 6.3G 22G 23% /mnt/distrib
root@client1:~# seq 1 10 | while read line; do echo "This is File${line}" > /mnt/distrib/file${line};done root@client1:~# ls /mnt/distrib/ file1 file10 file2 file3 file4 file5 file6 file7 file8 file9
root@server1:~# ls /mnt/dist[0-9]/ /mnt/dist1/: file10 file3 file4 file9 /mnt/dist2/: file7 root@server2:~# ls /mnt/dist[0-9]/ /mnt/dist3/: file1 file2 /mnt/dist4/: file5 file6 file8
root@client1:~# mkdir /mnt/replica root@client1:~# mount.glusterfs server1:/replicated /mnt/replica/ root@client1:~# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 7.3G 1.5G 5.5G 21% / udev 131M 4.0K 131M 1% /dev tmpfs 28M 280K 28M 1% /run none 5.0M 0 5.0M 0% /run/lock none 140M 0 140M 0% /run/shm server1:/replicated 7.3G 1.9G 5.1G 28% /mnt/replica
root@client1:~# seq 1 10 | while read line; do echo "This is File${line}" > /mnt/replica/file${line};done root@client1:~# ls /mnt/replica/ file1 file10 file2 file3 file4 file5 file6 file7 file8 file9
root@server1:~# ls /mnt/repl* /mnt/repl1: file1 file10 file2 file3 file4 file5 file6 file7 file8 file9 /mnt/repl2: file1 file10 file2 file3 file4 file5 file6 file7 file8 file9 root@server2:~# ls /mnt/repl* /mnt/repl3: file1 file10 file2 file3 file4 file5 file6 file7 file8 file9 /mnt/repl4: file1 file10 file2 file3 file4 file5 file6 file7 file8 file9
root@client1:~# mkdir /mnt/strip root@client1:~# mount.glusterfs server1:/striped /mnt/strip/ root@client1:~# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 7.3G 1.5G 5.5G 21% / udev 131M 4.0K 131M 1% /dev tmpfs 28M 280K 28M 1% /run none 5.0M 0 5.0M 0% /run/lock none 140M 0 140M 0% /run/shm server1:/striped 30G 6.3G 22G 23% /mnt/strip
root@client1:~# dd if=/dev/urandom of=test2.bin bs=30M count=10 root@client1:~# dd if=/dev/urandom of=test1.bin bs=30M count=10 root@client1:~# cp test* /mnt/strip/ root@client1:~# ls -lh /mnt/strip/ total 601M -rw-r--r-- 1 root root 300M Mar 2 14:13 test1.bin -rw-r--r-- 1 root root 300M Mar 2 14:13 test2.bin
root@server1:~# ls -lh /mnt/strip* /mnt/strip1: total 151M -rw-r--r-- 2 root root 75M Mar 2 14:13 test1.bin -rw-r--r-- 2 root root 75M Mar 2 14:13 test2.bin /mnt/strip2: total 151M -rw-r--r-- 2 root root 75M Mar 2 14:13 test1.bin -rw-r--r-- 2 root root 75M Mar 2 14:13 test2.bin root@server2:~# ls -lh /mnt/strip* /mnt/strip3: total 151M -rw-r--r-- 2 root root 75M Mar 2 14:13 test1.bin -rw-r--r-- 2 root root 75M Mar 2 14:13 test2.bin /mnt/strip4: total 151M -rw-r--r-- 2 root root 75M Mar 2 14:13 test1.bin -rw-r--r-- 2 root root 75M Mar 2 14:13 test2.bin
root@client1:~# mkdir /mnt/distrib-strip root@client1:~# mount.glusterfs server1:/distributed-striped /mnt/distrib-strip/ root@client1:~# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 7.3G 1.8G 5.2G 25% / udev 131M 4.0K 131M 1% /dev tmpfs 28M 280K 28M 1% /run none 5.0M 0 5.0M 0% /run/lock none 140M 0 140M 0% /run/shm server1:/distributed-striped 30G 6.9G 21G 26% /mnt/distrib-strip
root@client1:~# dd if=/dev/urandom of=test2.bin bs=30M count=10 root@client1:~# dd if=/dev/urandom of=test1.bin bs=30M count=10 root@client1:~# cp test* /mnt/distrib-strip/ root@client1:~# ls -lh /mnt/distrib-strip/ total 600M -rw-r--r-- 1 root root 300M Mar 2 14:35 test1.bin -rw-r--r-- 1 root root 300M Mar 2 14:34 test2.bin
root@server1:~# ls -lh /mnt/dist-strip* /mnt/dist-strip1: total 151M -rw-r--r-- 2 root root 150M Mar 2 14:35 test1.bin /mnt/dist-strip2: total 151M -rw-r--r-- 2 root root 150M Mar 2 14:34 test2.bin root@server2:~# ls -lh /mnt/dist-strip* /mnt/dist-strip3: total 151M -rw-r--r-- 2 root root 150M Mar 2 14:35 test1.bin /mnt/dist-strip4: total 151M -rw-r--r-- 2 root root 150M Mar 2 14:34 test2.bin
root@client1:~# mkdir /mnt/distrib-repl root@client1:~# mount.glusterfs server1:/distributed-replicated /mnt/distrib-repl/ root@client1:~# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 7.3G 1.8G 5.1G 27% / udev 131M 4.0K 131M 1% /dev tmpfs 28M 280K 28M 1% /run none 5.0M 0 5.0M 0% /run/lock none 140M 0 140M 0% /run/shm server1:/distributed-replicated 15G 4.4G 9.5G 32% /mnt/distrib-repl
root@client1:~# seq 1 10 | while read line; do echo "This is File${line}" > /mnt/distrib-repl/file${line};done root@client1:~# ls /mnt/distrib-repl/ file1 file10 file2 file3 file4 file5 file6 file7 file8 file9
root@server1:~# ls /mnt/dist-repl* /mnt/dist-repl1: file10 file3 file4 file7 file9 /mnt/dist-repl2: file1 file2 file5 file6 file8 root@server2:~# ls /mnt/dist-repl* /mnt/dist-repl3: file10 file3 file4 file7 file9 /mnt/dist-repl4: file1 file2 file5 file6 file8
Source: https://habr.com/ru/post/251931/
All Articles