pmcf 1.88.4 → 1.89.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/cluster.mjs +34 -15
package/package.json
CHANGED
package/src/cluster.mjs
CHANGED
|
@@ -105,7 +105,7 @@ export class Cluster extends Host {
|
|
|
105
105
|
);
|
|
106
106
|
cfg.push(" }");
|
|
107
107
|
cfg.push(` virtual_router_id ${cluster.routerId}`);
|
|
108
|
-
cfg.push(` priority ${host.priority}`);
|
|
108
|
+
cfg.push(` priority ${host.priority - cluster.masters.has(ni) ? 0 : 5}`);
|
|
109
109
|
cfg.push(" smtp_alert");
|
|
110
110
|
cfg.push(" advert_int 5");
|
|
111
111
|
cfg.push(" authentication {");
|
|
@@ -113,17 +113,22 @@ export class Cluster extends Host {
|
|
|
113
113
|
cfg.push(" auth_pass pass1234");
|
|
114
114
|
cfg.push(" }");
|
|
115
115
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
cfg.push(
|
|
116
|
+
cfg.push(
|
|
117
|
+
` notify_master "/usr/bin/systemctl start ${cluster.name}-master.target"`
|
|
118
|
+
);
|
|
119
|
+
cfg.push(
|
|
120
|
+
` notify_backup "/usr/bin/systemctl start ${cluster.name}-backup.target"`
|
|
121
|
+
);
|
|
122
|
+
cfg.push(
|
|
123
|
+
` notify_fault "/usr/bin/systemctl start ${cluster.name}-fault.target"`
|
|
124
|
+
);
|
|
120
125
|
|
|
121
126
|
cfg.push("}");
|
|
122
127
|
cfg.push("");
|
|
123
128
|
|
|
124
|
-
for (const service of cluster.findServices({ type: "http" })) {
|
|
129
|
+
for (const service of cluster.findServices({ type: "http|dns|smtp" })) {
|
|
125
130
|
cfg.push(`virtual_server ${cluster.rawAddress} ${service.port} {`);
|
|
126
|
-
cfg.push(" delay_loop
|
|
131
|
+
cfg.push(" delay_loop 10");
|
|
127
132
|
cfg.push(" lb_algo wlc");
|
|
128
133
|
cfg.push(" persistence_timeout 600");
|
|
129
134
|
cfg.push(` protocol ${service.protocol.toUpperCase()}`);
|
|
@@ -136,12 +141,26 @@ export class Cluster extends Host {
|
|
|
136
141
|
);
|
|
137
142
|
cfg.push(` weight ${memberService.weight}`);
|
|
138
143
|
|
|
139
|
-
switch (service.
|
|
140
|
-
case "
|
|
141
|
-
cfg.push(`
|
|
142
|
-
cfg.push("
|
|
144
|
+
switch (service.type) {
|
|
145
|
+
case "dns":
|
|
146
|
+
cfg.push(` DNS_CHECK {`);
|
|
147
|
+
cfg.push(" type A");
|
|
148
|
+
cfg.push(" name google.com");
|
|
143
149
|
cfg.push(" }");
|
|
144
150
|
break;
|
|
151
|
+
case "smtp":
|
|
152
|
+
cfg.push(` SMTP_CHECK {`);
|
|
153
|
+
cfg.push(" }");
|
|
154
|
+
break;
|
|
155
|
+
|
|
156
|
+
default:
|
|
157
|
+
switch (service.protocol) {
|
|
158
|
+
case "tcp":
|
|
159
|
+
cfg.push(` TCP_CHECK {`);
|
|
160
|
+
cfg.push(" connect_timeout 10");
|
|
161
|
+
cfg.push(" }");
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
145
164
|
}
|
|
146
165
|
|
|
147
166
|
cfg.push(" }");
|
|
@@ -163,7 +182,7 @@ export class Cluster extends Host {
|
|
|
163
182
|
`${this.name}-master.target`,
|
|
164
183
|
[
|
|
165
184
|
"[Unit]",
|
|
166
|
-
`Description=
|
|
185
|
+
`Description=Target for master state of cluster ${this.name}`,
|
|
167
186
|
"PartOf=keepalived.service",
|
|
168
187
|
`Conflicts=${this.name}-fault.target`
|
|
169
188
|
]
|
|
@@ -174,7 +193,7 @@ export class Cluster extends Host {
|
|
|
174
193
|
`${this.name}-backup.target`,
|
|
175
194
|
[
|
|
176
195
|
"[Unit]",
|
|
177
|
-
`Description=
|
|
196
|
+
`Description=Target for backup state of cluster ${this.name}`,
|
|
178
197
|
"PartOf=keepalived.service",
|
|
179
198
|
`Conflicts=${this.name}-fault.target`
|
|
180
199
|
]
|
|
@@ -185,8 +204,8 @@ export class Cluster extends Host {
|
|
|
185
204
|
`${this.name}-fault.target`,
|
|
186
205
|
[
|
|
187
206
|
"[Unit]",
|
|
188
|
-
`Description=
|
|
189
|
-
`Conflicts=${this.name}-master.target ${this.name}-backup.target
|
|
207
|
+
`Description=Target for fault state of cluster ${this.name}`,
|
|
208
|
+
`Conflicts=${this.name}-master.target ${this.name}-backup.target`
|
|
190
209
|
]
|
|
191
210
|
);
|
|
192
211
|
|