-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathglusterfs.xml
229 lines (221 loc) · 6.89 KB
/
glusterfs.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V5.0//EN"
"/usr/share/xml/docbook/schema/dtd/4.5/docbookx.dtd" [
<!ENTITY article.author.xml SYSTEM "../common/article.author.xml">
<!ENTITY book.info.legalnotice.xml SYSTEM "../common/book.info.legalnotice.xml">
<!ENTITY book.info.abstract.xml SYSTEM "../common/book.info.abstract.xml">
]>
<article xml:base="http://netkiller.github.io/journal/"
xmlns="http://docbook.org/ns/docbook" xml:lang="en-us">
<articleinfo>
<title>Glusterfs</title>
<subtitle>http://netkiller.github.io/journal/glusterfs.html</subtitle>
&article.author.xml;
&book.info.legalnotice.xml;
<abstract>
</abstract>
&book.info.abstract.xml;
<keywordset>
<keyword>gluster, glusterfs, glusterfs-server</keyword>
<keyword></keyword>
<keyword></keyword>
<keyword></keyword>
</keywordset>
<pubdate>2014-09-23</pubdate>
<release>$Id$</release>
</articleinfo>
<section>
<title>Host</title>
<screen>
# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.6.12 client1.example.com client1
192.168.6.13 server.example.com server
192.168.6.1 brick1.example.com brick1
192.168.2.1 brick2.example.com brick2
</screen>
</section>
<section>
<title>Storage bricks</title>
<para>brick1, brick2</para>
<para>Install Gluster packages on both nodes</para>
<screen>
wget http://download.gluster.org/pub/gluster/glusterfs/3.5/3.5.2/CentOS/glusterfs-epel.repo -P /etc/yum.repos.d/
yum install -y glusterfs-server
chkconfig glusterd on
service glusterd start
service iptables stop
</screen>
<para></para>
<screen>
mkdir /opt/export
</screen>
</section>
<section>
<title>Server</title>
<para>Install Gluster packages on server nodes</para>
<screen>
wget http://download.gluster.org/pub/gluster/glusterfs/3.5/3.5.2/CentOS/glusterfs-epel.repo -P /etc/yum.repos.d/
yum install -y glusterfs-server
chkconfig glusterd on
service glusterd start
</screen>
<para>Run the gluster peer probe command</para>
<screen>
# gluster peer probe brick1.example.com
peer probe: success.
# gluster peer probe brick2.example.com
peer probe: success.
</screen>
<para></para>
<screen>
# gluster peer status
Number of Peers: 2
Hostname: brick1.example.com
Uuid: c8acab33-ed6a-4aa5-8b77-5be84695ffce
State: Peer in Cluster (Connected)
Hostname: brick2.example.com
Uuid: bf309355-7444-48e4-a7ea-25223c771160
State: Peer in Cluster (Connected)
</screen>
<para>Configure your Gluster volume</para>
<screen>
# gluster volume create testvol replica 2 transport tcp brick1.example.com:/opt/export brick2.example.com:/opt/export
volume create: testvol: success: please start the volume to access data
</screen>
<para></para>
<screen>
# gluster volume start testvol
volume start: testvol: success
</screen>
<para></para>
<screen>
# gluster volume info
Volume Name: testvol
Type: Replicate
Volume ID: cd4cdf2f-178b-4160-9ee9-c579266753de
Status: Started
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: brick1.example.com:/opt/export
Brick2: brick2.example.com:/opt/export
</screen>
<para></para>
<screen>
# gluster volume set testvol auth.allow client.example.com
volume set: success
</screen>
<para></para>
<screen>
# gluster volume info
Volume Name: testvol
Type: Replicate
Volume ID: cd4cdf2f-178b-4160-9ee9-c579266753de
Status: Started
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: brick1.example.com:/opt/export
Brick2: brick2.example.com:/opt/export
Options Reconfigured:
auth.allow: client.example.com
</screen>
</section>
<section>
<title>Check brick nodes</title>
<para>netstat -tap | grep glusterfsd</para>
<screen>
# netstat -tap | grep glusterfsd
tcp 0 0 *:49152 *:* LISTEN 13841/glusterfsd
tcp 0 0 brick1.example.com:49152 brick1.example.com:1014 ESTABLISHED 13841/glusterfsd
tcp 0 0 brick1.example.com:exp1 brick1.example.com:24007 ESTABLISHED 13841/glusterfsd
tcp 0 0 brick1.example.com:49152 brick2.example.com:1011 ESTABLISHED 13841/glusterfsd
tcp 0 0 brick1.example.com:49152 brick2.example.com:1012 ESTABLISHED 13841/glusterfsd
tcp 0 0 brick1.example.com:49152 server.example.com:1017 ESTABLISHED 13841/glusterfsd
tcp 0 0 brick1.example.com:49152 brick1.example.com:1020 ESTABLISHED 13841/glusterfsd
</screen>
</section>
<section>
<title>Client</title>
<para>Install Gluster packages on client nodes</para>
<screen>
wget http://download.gluster.org/pub/gluster/glusterfs/3.5/3.5.2/CentOS/glusterfs-epel.repo -P /etc/yum.repos.d/
yum install -y glusterfs-client
</screen>
<para>Test using the volume</para>
<screen>
mkdir /mnt/glusterfs
mount.glusterfs server.example.com:/testvol /mnt/glusterfs
</screen>
<para>Add an entry to /etc/fstab</para>
<screen>
server1.example.com:/testvol /mnt/glusterfs glusterfs defaults,_netdev 0 0
</screen>
<para></para>
<screen>
# mount
/dev/vda1 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
server.example.com:/testvol on /mnt/glusterfs type fuse.glusterfs (rw,default_permissions,allow_other,max_read=131072)
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 38G 2.3G 34G 7% /
tmpfs 939M 0 939M 0% /dev/shm
server.example.com:/testvol
477G 359G 101G 79% /mnt/glusterfs
</screen>
<para></para>
<screen>
# touch /mnt/glusterfs/hello
# ll /mnt/glusterfs/
total 0
-rw-r--r-- 1 root root 0 Sep 23 14:31 hello
</screen>
<para>brick1</para>
<screen>
# ll /opt/export/
total 0
-rw-r--r-- 2 root root 0 Sep 23 14:31 hello
</screen>
<para>brick2</para>
<screen>
# ll /opt/export/
total 0
-rw-r--r-- 2 root root 0 Sep 23 14:31 hello
</screen>
<section>
<title>/etc/fstab</title>
<para>Add an entry to /etc/fstab</para>
<screen>
server1.example.com:/testvol /mnt/glusterfs glusterfs defaults,_netdev 0 0
</screen>
</section>
</section>
<section>
<title>Other</title>
<para>stop volume</para>
<screen>
# gluster volume stop testvol
Stopping volume will make its data inaccessible. Do you want to continue? (y/n) y
volume stop: testvol: success
</screen>
<para>delete volume</para>
<screen>
# gluster volume delete testvol
Deleting volume will erase all information about the volume. Do you want to continue? (y/n) y
volume delete: testvol: success
</screen>
<screen>
# gluster peer datach brick1.example.com
</screen>
<screen>
# gluster volume remove-brick testvol brick1.example.com:/export/u01
</screen>
</section>
</article>