-
Notifications
You must be signed in to change notification settings - Fork 2
/
corosync-setup.tex
289 lines (225 loc) · 6.71 KB
/
corosync-setup.tex
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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
% Corosync setup
\chapter{Corosync setup}
\label{chap:corosync-setup}
This chapter explains the Corosync setup.
\section {About Corosync}
The Corosync Cluster Engine is a group communication system for implementing HA within applications. Among its features we can find:
\begin{itemize}
\item Create replicated state machines thanks to a closed process group communication model
\item Restart application process if it fails thanks to simple availability manager
\item A configuration and statistics in-memory database
\item A quorum system that notifies applications when quorum is achieved or lost.
\end{itemize}
The software is designed to operate on UDP/IP and InfiniBand networks natively.
We can find more information about Corosync. Either at its Wikipedia article (\cite{WikipediaCorosync}) or at its web page (\cite{CorosyncWebpage}).
Corosync enables a group communication system so that Pacemaker can talk to all the cluster nodes without having to implement communication capabilities.
\section {Corosync installation}
\textbf{In both nodes} we just need to install Corosync packages for Ubuntu 12.04.
We need to issue this command:
\begin{verbatim}
apt-get install corosync
\end{verbatim}
% COROSYNC Setup
\section {Corosync.conf}
The corosync.conf file on both computers it will be modified to use upnp so that we can use in non multicast environments. In order to use upnp we need to use a corosync version higher than 1.3 but that is not a problem because current version is higher than that.
\subsection {\label{subsec:primary-server-corosync-conf}Primary server Corosync.conf}
We create the file:
\begin{verbatim}
/etc/corosync/corosync.conf
\end{verbatim}
which its contents will be:
\begin{verbatim}
# Please read the openais.conf.5 manual page
totem {
version: 2
# How long before declaring a token lost (ms)
token: 5000
# How many token retransmits before
# forming a new configuration
token_retransmits_before_loss_const: 20
# How long to wait for join messages
# in the membership protocol (ms)
join: 1000
# How long to wait for consensus to be achieved
# before starting a new round of
# membership configuration (ms)
consensus: 7500
# Turn off the virtual synchrony filter
vsftype: none
# Number of messages that may be sent by one
# processor on receipt of the token
max_messages: 20
# Limit generated nodeids to 31-bits
# (positive signed integers)
clear_node_high_bit: yes
# Disable encryption
secauth: off
# How many threads to use for encryption/decryption
threads: 0
# Optionally assign a fixed node id (integer)
#nodeid: 1234
rrp_mode: passive
interface {
member {
memberaddr: 10.0.66.201
}
member {
memberaddr: 10.0.66.202
}
ringnumber: 0
bindnetaddr: 10.0.66.201
mcastport: 5405
}
transport: udpu
}
amf {
mode: disabled
}
service {
# Load the Pacemaker Cluster Resource Manager
ver: 0
name: pacemaker
}
aisexec {
user: root
group: root
}
logging {
fileline: off
to_stderr: yes
to_logfile: no
to_syslog: yes
syslog_facility: daemon
debug: off
timestamp: on
logger_subsys {
subsys: AMF
debug: off
tags: enter|leave|trace1|trace2|trace3|trace4|trace6
}
}
\end{verbatim}
Among other settings the configuration defines that there are two node members which their ips are: 10.0.66.201 and 10.0.66.202. The transport must use unicast protocol (udpu) through 5405 port (and 5404 too). Logging is set to output into syslog and stderr but without debug output. As we are using unicast we need to define the current node ip as the multicast one: 10.0.66.202.
\subsection {Secondary server Corosync.conf}
We create the file:
\begin{verbatim}
/etc/corosync/corosync.conf
\end{verbatim}
which its contents will be:
\begin{verbatim}
# Please read the openais.conf.5 manual page
totem {
version: 2
# How long before declaring a token lost (ms)
token: 5000
# How many token retransmits before
# forming a new configuration
token_retransmits_before_loss_const: 20
# How long to wait for join messages
# in the membership protocol (ms)
join: 1000
# How long to wait for consensus to be achieved
# before starting a new round of
# membership configuration (ms)
consensus: 7500
# Turn off the virtual synchrony filter
vsftype: none
# Number of messages that may be sent by one
# processor on receipt of the token
max_messages: 20
# Limit generated nodeids to 31-bits
# (positive signed integers)
clear_node_high_bit: yes
# Disable encryption
secauth: off
# How many threads to use for encryption/decryption
threads: 0
# Optionally assign a fixed node id (integer)
#nodeid: 1234
rrp_mode: passive
interface {
member {
memberaddr: 10.0.66.201
}
member {
memberaddr: 10.0.66.202
}
ringnumber: 0
bindnetaddr: 10.0.66.202
mcastport: 5405
}
transport: udpu
}
amf {
mode: disabled
}
service {
# Load the Pacemaker Cluster Resource Manager
ver: 0
name: pacemaker
}
aisexec {
user: root
group: root
}
logging {
fileline: off
to_stderr: yes
to_logfile: no
to_syslog: yes
syslog_facility: daemon
debug: off
timestamp: on
logger_subsys {
subsys: AMF
debug: off
tags: enter|leave|trace1|trace2|trace3|trace4|trace6
}
}
\end{verbatim}
You can check subsection \textbf{\ref{subsec:primary-server-corosync-conf} Primary server Corosync.conf} for configuration file settings explanation.
\section {Corosync's Authkey}
In \textbf{primary node} we will create the file:
\begin{verbatim}
/etc/corosync/authkey
\end{verbatim}
thanks to running:
\begin{verbatim}
corosync-keygen
\end{verbatim}
We might be requested to press keys on our keyboard to generate entropy.
Once the file created we will copy the very same file to the \textbf{secondary node} in the same path as in primary server.
In order to secure it in secondary node we will need to run:
\begin{verbatim}
chown root:root /etc/corosync/authkey
chmod 400 /etc/corosync/authkey
\end{verbatim}
\section {Cfgtool}
In \textbf{both nodes} we need to edit:
\begin{verbatim}
/etc/rc.local
\end{verbatim}
in order to add the line:
\begin{verbatim}
/usr/sbin/corosync-cfgtool -r
\end{verbatim}
just before the:
\begin{verbatim}
exit 0
\end{verbatim}
line.
This way we make sure that redudant ring state is reset cluster wide after a fault to re-enable redundant ring.
\section {Corosync startup enabling}
In \textbf{both nodes} in order to enable Corosync at boot we need to edit:
\begin{verbatim}
/etc/default/corosync
\end{verbatim}
file so that:
\begin{verbatim}
START=no
\end{verbatim}
line becomes:
\begin{verbatim}
START=yes
\end{verbatim}
.