-
Notifications
You must be signed in to change notification settings - Fork 1
/
drbd.bom
699 lines (672 loc) · 27.4 KB
/
drbd.bom
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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
brooklyn.catalog:
version: "1.0.0-SNAPSHOT" # BROOKLYN_DRBD_VERSION
publish:
description: |
DRBD is a distributed replicated storage system for the Linux platform. It is implemented as a kernel driver,
several userspace management applications, and some shell scripts. DRBD is traditionally used in high availability (HA) computer clusters to provide a
RAID 1 like configuration over a network.
license_code: Apache-2.0
defaults:
drbdIconUrl: "https://s3.eu-central-1.amazonaws.com/misc-csft/drbd.jpg"
classpathIconUrl: &drbdIconUrl 'classpath://io.brooklyn.drbd.brooklyn-drbd:drbd.png'
items:
- "https://github.com/brooklyncentral/common-catalog-utils/releases/download/v0.1.0/common.bom"
- id: drbd-node
name: "DRBD Node"
description: |
A DRBD node
itemType: entity
iconUrl: *drbdIconUrl
item:
id: drbd-node
name: "DRBD Node"
type: centos7-software-process
brooklyn.parameters:
- name: drbd.version
label: "DRBD Version"
description: |
The version of DRBD to install
type: string
#default: 90
default: 84
- name: drbd.mountpoint
label: "DRBD Mount Point"
description: |
The place to mount the DRBD filesystem
type: string
default: /mnt
- name: drbd.filesystem
label: "DRBD Filesystem"
description: |
The type of filesystem to format the DRBD volume with
type: string
default: ext4
- name: initial.drive.mountpoint
label: "Initial Drive Mount Point"
description: |
The inital mount point of drive to use
type: string
default: /mount/brooklyn/h
- name: drbd.skip.install
label: "Skip the DRBD install"
description: |
Should we skip the DRBD install
type: boolean
default: false
brooklyn.policies:
- type: org.apache.brooklyn.policy.InvokeEffectorOnCollectionSensorChange
brooklyn.config:
sensor: $brooklyn:sensor("drbd.isUp.list")
onAdded: detectAndUpdate
onRemoved: detectAndUpdate
brooklyn.enrichers:
- type: org.apache.brooklyn.enricher.stock.Propagator
brooklyn.config:
enricher.suppressDuplicates: true
producer: $brooklyn:parent().parent()
propagating:
- $brooklyn:sensor("drbd.monitor.hostaddresses")
- $brooklyn:sensor("drbd.monitor.hostnames")
- $brooklyn:sensor("drbd.isUp.list")
- $brooklyn:sensor("drbd.isUps")
- $brooklyn:sensor("drbd.started")
- type: org.apache.brooklyn.enricher.stock.Transformer
brooklyn.config:
enricher.suppressDuplicates: true
enricher.triggerSensors:
- $brooklyn:sensor("is.primary")
- $brooklyn:sensor("service.isUp")
enricher.targetSensor: $brooklyn:sensor("primary.isUp")
enricher.targetValue: $brooklyn:formatString("%s%s", $brooklyn:attributeWhenReady("is.primary"), $brooklyn:attributeWhenReady("service.isUp"))
- type: org.apache.brooklyn.enricher.stock.Transformer
brooklyn.config:
enricher.suppressDuplicates: true
enricher.sourceSensor: $brooklyn:sensor("primary.isUp")
enricher.targetSensor: $brooklyn:sensor("is.active.primary")
enricher.transformation:
$brooklyn:object:
type: "com.google.guava:com.google.common.base.Functions"
factoryMethod.name: "forMap"
factoryMethod.args:
- "truetrue" : true
- false
brooklyn.initializers:
- type: org.apache.brooklyn.core.effector.ssh.SshCommandEffector
brooklyn.config:
shell.env:
DRIVE: $brooklyn:attributeWhenReady("device")
DRBD_STARTED: $brooklyn:attributeWhenReady("drbd.started")
name: detectAndUpdate
description: |
Detects the position of this DRBD instance in the pair and promotes or demotes it
command: |
if [ ${DRBD_STARTED} != "started,started" ] ; then
echo ${NODE_ADDRESSES} [effector non started] >> ~/addressList.txt
echo "Service not yet started"
exit 0
fi
echo ${NODE_ADDRESSES} [effector] >> ~/addressList.txt
echo ${NODE_ISUPS} > `date +%s`.txt
echo ${NODE_ADDRESSES} > `date +%s`.txt
NODE_1=`echo ${NODE_ADDRESSES} | cut -d"," -f1`
NODE_2=`echo ${NODE_ADDRESSES} | cut -d"," -f2`
HOSTNAME_1=`echo ${NODE_HOSTNAMES} | cut -d"," -f1`
HOSTNAME_2=`echo ${NODE_HOSTNAMES} | cut -d"," -f2`
ISUP_1=`echo ${NODE_ISUPS} | cut -d"," -f1`
ISUP_2=`echo ${NODE_ISUPS} | cut -d"," -f2`
HOSTNAME=`hostname`
# quit out if there's only one ip
if [ "${NODE_1}" == "${NODE_2}" ]; then
exit 0
fi
if [ "${HOST_SUBNET_ADDRESS}" == "${NODE_1}" ]; then
if [ "${HOSTNAME_1}" != "${HOSTNAME}" ]; then
HOSTNAME_1=${HOSTNAME}
fi
else
if [ "${HOSTNAME_2}" != "${HOSTNAME}" ]; then
HOSTNAME_2=${HOSTNAME}
fi
fi
echo ${ISUP_1} >> `date +%s`.txt
echo "rebuild the config file"
sudo tee /etc/drbd.d/${DRBD_CONFIGURATION_NAME}.res <<-EOF
resource ${DRBD_CONFIGURATION_NAME} {
protocol C;
disk {
c-fill-target 10M;
c-max-rate 700M;
c-plan-ahead 7;
c-min-rate 4M;
}
on ${HOSTNAME_1} {
device /dev/${DRBD_DEVICE};
disk /dev/${DRIVE};
address ${NODE_1}:${DRBD_PORT_START};
meta-disk internal;
}
on ${HOSTNAME_2} {
device /dev/${DRBD_DEVICE};
disk /dev/${DRIVE};
address ${NODE_2}:${DRBD_PORT_START};
meta-disk internal;
}
}
EOF
# re-scan the new config file
sudo drbdadm adjust all
echo "Adjust" >> `date +%s`.txt
# if it's primary, configure the mount and make a file system
if [ "${HOST_SUBNET_ADDRESS}" == "${NODE_1}" ] || [ "${ISUP_1}" == "false" ]; then
echo "It's primary, so mount the file system"
echo "Make primary" >> `date +%s`.txt
# if we try to promote too fast, it can fail as there's still a primary, so retry this
drbd-overview
until sudo drbdadm primary ${DRBD_CONFIGURATION_NAME} --force
do
echo "Retrying making primary"
done
sudo mount /dev/${DRBD_DEVICE} ${MOUNT_POINT}
sudo chmod 777 ${MOUNT_POINT}
else
echo "Dont Make primary" >> `date +%s`.txt
fi
- type: org.apache.brooklyn.core.sensor.ssh.SshCommandSensor
brooklyn.config:
name: is.primary
period: 30s
description: |
Is this primary
targetType: boolean
command: |
STATE=`drbd-overview 2>/dev/null | grep ${DRBD_CONFIGURATION_NAME} | awk '{print $3;}' | awk -F/ '{print $1}'`
if [[ "${STATE}" == *"Primar"* ]]; then
echo true
else
echo false
fi
- type: org.apache.brooklyn.core.sensor.ssh.SshCommandSensor
brooklyn.config:
name: state
period: 30s
description: |
Is this primary or secondary
targetType: string
command: |
drbd-overview 2>/dev/null | grep ${DRBD_CONFIGURATION_NAME} | awk '{print $3;}' | awk -F/ '{print $1}'
- type: org.apache.brooklyn.core.sensor.ssh.SshCommandSensor
brooklyn.config:
name: device
period: 30s
description: |
The name of the underlying device drbd is using
targetType: string
command: |
cat ~/drive.txt
- type: org.apache.brooklyn.core.sensor.ssh.SshCommandSensor
brooklyn.config:
name: started
period: 30s
description: |
If the full start process has taken place on this machine
targetType: string
command: |
cat ~/started.txt
- type: org.apache.brooklyn.core.sensor.ssh.SshCommandSensor
brooklyn.config:
name: connected
period: 30s
description: |
Is the drbd link connected
targetType: string
command: |
drbd-overview | grep Connected
brooklyn.config:
install.skip: $brooklyn:config("drbd.skip.install")
latch.install: $brooklyn:parent().parent().attributeWhenReady("cluster.one_and_all.members.up")
latch.customize: $brooklyn:parent().parent().attributeWhenReady("cluster.one_and_all.members.up")
shell.env:
DRBD_VERSION: $brooklyn:config("drbd.version")
DRBD_DEVICE: drbd0
MOUNT_POINT: $brooklyn:config("drbd.mountpoint")
FILE_SYSTEM: $brooklyn:config("drbd.filesystem")
DRBD_CONFIGURATION_NAME: brooklyn-drbd
INITIAL_MOUNTPOINT: $brooklyn:config("drive.initial.mountpoint")
HOST_SUBNET_ADDRESS: $brooklyn:attributeWhenReady("host.subnet.address")
HOST_SUBNET_HOSTNAME: $brooklyn:attributeWhenReady("host.subnet.hostname")
NODE_ADDRESSES: $brooklyn:attributeWhenReady("drbd.monitor.hostaddresses")
NODE_HOSTNAMES: $brooklyn:attributeWhenReady("drbd.monitor.hostnames")
NODE_ISUPS: $brooklyn:attributeWhenReady("drbd.isUps")
DRBD_PORT_START: 7788
DRBD_PORT_END: 7799
IS_PRIMARY: $brooklyn:parent().config("is.primary")
install.command: |
echo ${NODE_ADDRESSES} [install] >> ~/addressList.txt
sudo hostnamectl set-hostname ${HOST_SUBNET_HOSTNAME}
if [ -f "/etc/cloud/cloud.cfg" ]; then
sudo tee -a /etc/cloud/cloud.cfg <<-EOF
preserve_hostname: true
EOF
fi
sudo rpm -ivh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
#sudo yum -y update
sudo yum -y install drbd${DRBD_VERSION} kmod-drbd${DRBD_VERSION} nano kernel-devel
sudo yum -y --disablerepo='*' --enablerepo=elrepo-kernel install kernel-ml
# remove the oldest kernel
sudo rm -rf "$(ls -t /boot/vmlinuz* | tail -1)"
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
# shutdown nicely
#trap 'exit 0' SIGINT SIGQUIT SIGTERM SIGHUP EXIT
#sudo shutdown -r now
nohup sudo bash -c "sleep 0.5; shutdown -r now" &
pre.customize.command: |
# wait until the ips from the nodes have been propagated which may take a second or two
sleep 10
customize.command: |
echo ${NODE_ADDRESSES} [configure] >> ~/addressList.txt
echo "Start the DRBD module"
sudo /sbin/modprobe drbd
# get the device name we added with brooklyn blockstore
DRIVE=`lsblk | grep ${INITIAL_MOUNTPOINT} | awk '{print $1;}'`
NODE_1=`echo ${NODE_ADDRESSES} | cut -d"," -f1`
NODE_2=`echo ${NODE_ADDRESSES} | cut -d"," -f2`
HOSTNAME_1=`echo ${NODE_HOSTNAMES} | cut -d"," -f1`
HOSTNAME_2=`echo ${NODE_HOSTNAMES} | cut -d"," -f2`
HOSTNAME=`hostname`
if [ "${IS_PRIMARY}" == true ]; then
if [ "${HOSTNAME_1}" != "${HOSTNAME}" ]; then
HOSTNAME_1=${HOSTNAME}
fi
else
if [ "${HOSTNAME_2}" != "${HOSTNAME}" ]; then
HOSTNAME_2=${HOSTNAME}
fi
fi
# store the drive to disk
echo ${DRIVE} > ~/drive.txt
echo "Build the config file"
sudo umount ${INITIAL_MOUNTPOINT}
sudo tee /etc/drbd.d/${DRBD_CONFIGURATION_NAME}.res <<-EOF
resource ${DRBD_CONFIGURATION_NAME} {
protocol C;
on ${HOSTNAME_1} {
device /dev/${DRBD_DEVICE};
disk /dev/${DRIVE};
address ${NODE_1}:${DRBD_PORT_START};
meta-disk internal;
}
on ${HOSTNAME_2} {
device /dev/${DRBD_DEVICE};
disk /dev/${DRIVE};
address ${NODE_2}:${DRBD_PORT_START};
meta-disk internal;
}
}
EOF
echo "Blank any filesystem"
sudo dd if=/dev/zero of=/dev/${DRIVE} bs=1M count=128
# start drbd
sudo drbdadm create-md ${DRBD_CONFIGURATION_NAME}
# --force
# if it's primary, configure the mount and make a file system
if [ "${IS_PRIMARY}" == true ]; then
echo "It's primary, so make the file system"
until sudo systemctl start drbd
do
echo "Retry connection"
done
echo "Enable system"
sudo systemctl enable drbd
# The service needs to be up before we attach
sleep 10
echo "Attach system"
# for some reason we need to use up instead of attach in drbd9, also this may not be rqd
if [[ "${DRBD_VERSION}" == 8* ]]; then
sudo drbdadm attach ${DRBD_CONFIGURATION_NAME} || true
else
sudo drbdadm up ${DRBD_CONFIGURATION_NAME} || true
fi
# We need to be attached before we become primary
sleep 10
echo "Make me primary"
sudo drbdadm primary ${DRBD_CONFIGURATION_NAME} --force
echo "Make the filesystem"
sudo mkfs.${FILE_SYSTEM} /dev/${DRBD_DEVICE}
echo "Mount the endpoint"
sudo mount /dev/${DRBD_DEVICE} ${MOUNT_POINT}
sudo chmod 777 ${MOUNT_POINT}
fi
launch.command: |
until sudo systemctl start drbd
do
sleep 5
echo "Timed out waiting to connect, retrying"
done
sudo systemctl enable drbd
if [ "${IS_PRIMARY}" != "true" ]; then
echo "Non-primary node, attach the device"
if [[ "${DRBD_VERSION}" == 8* ]]; then
sudo drbdadm attach ${DRBD_CONFIGURATION_NAME} || true
else
sudo drbdadm up ${DRBD_CONFIGURATION_NAME} || true
fi
fi
echo started > ~/started.txt
checkRunning.command: |
echo true
- id: drbd-parent-entity
name: "DRBD parent entity"
itemType: entity
item:
id: drbd-node
name: "DRBD parent entity"
type: centos7-software-process
brooklyn.parameters:
- name: drbd.version
label: "DRBD Version"
description: |
The version of DRBD to install
type: string
#default: 90
default: 84
- name: drbd.mountpoint
label: "DRBD Mount Point"
description: |
The place to mount the DRBD filesystem
type: string
default: /mnt
- name: drbd.filesystem
label: "DRBD Filesystem"
description: |
The type of filesystem to format the DRBD volume with
type: string
default: ext4
- name: drive.initial.mountpoint
label: "Initial Drive Mount Point"
description: |
The inital mount point of drive to use
type: string
default: /mount/brooklyn/h
- name: drive.capacity
label: "Drive Capacity"
description: |
The drive capacity in gigabytes
type: string
default: 1
- name: drbd.skip.install
label: "Skip the DRBD install"
description: |
Should we skip the DRBD install
type: boolean
default: false
provisioning.properties:
# 10 mins
sshTriesTimeout: 600000
sshTries: 100
sshRetryDelay: 2000
inboundPorts:
- 22
- 80
- 7788-7799
- 8080
- 8443
- 31001
- 31880
- 3306
customizers:
- $brooklyn:object:
type: brooklyn.location.blockstore.NewVolumeCustomizer
deferred: true
object.fields:
volumes:
- $brooklyn:formatString:
- |
blockDevice:
sizeInGb: %s
deviceSuffix: 'h'
deleteOnTermination: true
tags:
brooklyn: drbd
filesystem:
mountPoint: %s
filesystemType: %s
- $brooklyn:config("drive.capacity")
- $brooklyn:config("drive.initial.mountpoint")
- $brooklyn:config("drbd.filesystem")
brooklyn.config:
children.startable.mode: BACKGROUND
checkRunning.command: |
echo true
brooklyn.policies:
- type: org.apache.brooklyn.policy.ha.ServiceRestarter
brooklyn.config:
failOnRecurringFailuresInThisDuration: 5m
brooklyn.enrichers:
- type: org.apache.brooklyn.policy.ha.ServiceFailureDetector
brooklyn.config:
entityFailed.stabilizationDelay: 30s
- type: org.apache.brooklyn.enricher.stock.Propagator
brooklyn.config:
enricher.suppressDuplicates: true
producer: $brooklyn:child("drbd-node")
propagating:
- $brooklyn:sensor("started")
- $brooklyn:sensor("is.active.primary")
- type: org.apache.brooklyn.enricher.stock.Aggregator
brooklyn.config:
enricher.suppressDuplicates: true
uniqueTag: hostaddress-aggregator
enricher.producer: $brooklyn:child("user-nodes")
enricher.sourceSensor: $brooklyn:sensor($brooklyn:config("propagatingSensor"))
enricher.targetSensor: $brooklyn:sensor("propagatingSensor.list")
enricher.aggregating.fromMembers: true
enricher.aggregator.excludeBlank: true
- type: org.apache.brooklyn.enricher.stock.Joiner
brooklyn.config:
enricher.suppressDuplicates: true
uniqueTag: hostaddress-joiner
enricher.sourceSensor: $brooklyn:sensor("propagatingSensor.list")
enricher.targetSensor: $brooklyn:sensor("propagatingSensor.value")
enricher.joiner.quote: false
- type: org.apache.brooklyn.enricher.stock.Transformer
brooklyn.config:
enricher.suppressDuplicates: true
enricher.triggerSensors:
- $brooklyn:sensor("is.active.primary")
- $brooklyn:sensor("propagatingSensor.value")
enricher.sourceSensor: $brooklyn:sensor("is.active.primary")
enricher.targetSensor: $brooklyn:sensor($brooklyn:config("propagatingSensor"))
enricher.transformation:
$brooklyn:object:
type: "com.google.guava:com.google.common.base.Functions"
factoryMethod.name: "forMap"
factoryMethod.args:
- true: $brooklyn:attributeWhenReady("propagatingSensor.value")
- null
brooklyn.children:
- type: drbd-node
- type: cluster
id: user-nodes
name: "DRBD User entity"
brooklyn.config:
cluster.initial.size: 1
dynamiccluster.firstmemberspec: $brooklyn:parent().config("nodeSpecification")
dynamiccluster.memberspec: $brooklyn:parent().config("nodeSpecification")
- id: drbd-pair
name: "DRBD Pair"
itemType: entity
iconUrl: *drbdIconUrl
item:
type: cluster
id: drbd-pair
name: "DRBD Pair"
brooklyn.parameters:
- name: drbd.version
label: "DRBD Version"
description: |
The version of DRBD to install
type: string
#default: 90
default: 84
- name: drbd.mountpoint
label: "DRBD Mount Point"
description: |
The place to mount the DRBD filesystem
type: string
default: /mnt
- name: drbd.filesystem
label: "DRBD Filesystem"
description: |
The type of filesystem to format the DRBD volume with
type: string
default: ext4
- name: drive.initial.mountpoint
label: "Initial Drive Mount Point"
description: |
The inital mount point of drive to use
type: string
default: /mount/brooklyn/h
- name: drive.capacity
label: "Drive Capacity"
description: |
The drive capacity in gigabytes
type: string
default: 1
- name: drbd.nodes
label: "Number of DRBD Nodes"
description: |
The number of DRBD nodes
type: string
default: 2
- name: drbd.skip.install
label: "Skip the DRBD install"
description: |
Should we skip the DRBD install
type: boolean
default: false
brooklyn.config:
#cluster.initial.size: 4
cluster.initial.size: $brooklyn:config("drbd.nodes")
dynamiccluster.zone.enable: true
dynamiccluster.firstmemberspec:
$brooklyn:entitySpec:
type: drbd-parent-entity
brooklyn.config:
is.primary: true
nodeSpecification: $brooklyn:parent().config("initialNodeSpecification")
dynamiccluster.memberspec:
$brooklyn:entitySpec:
type: drbd-parent-entity
brooklyn.config:
is.primary: false
nodeSpecification: $brooklyn:parent().config("nodeSpecification")
brooklyn.enrichers:
# propagating sensor
- type: org.apache.brooklyn.enricher.stock.Aggregator
brooklyn.config:
uniqueTag: drbd-propagatingSensor-aggregator
enricher.sourceSensor: $brooklyn:sensor($brooklyn:config("propagatingSensor"))
enricher.targetSensor: $brooklyn:sensor("propagatingSensor.list")
enricher.aggregating.fromMembers: true
enricher.aggregator.excludeBlank: true
enricher.suppressDuplicates: true
- type: org.apache.brooklyn.enricher.stock.Joiner
brooklyn.config:
uniqueTag: drbd-propagatingSensor-joiner
enricher.sourceSensor: $brooklyn:sensor("propagatingSensor.list")
enricher.targetSensor: $brooklyn:sensor($brooklyn:config("propagatingSensor"))
enricher.joiner.quote: false
enricher.suppressDuplicates: true
# DRBD node management
- type: org.apache.brooklyn.enricher.stock.Aggregator
brooklyn.config:
uniqueTag: drbd-hostaddress-aggregator
enricher.sourceSensor: $brooklyn:sensor("host.subnet.address")
enricher.targetSensor: $brooklyn:sensor("drbd.monitor.hostaddress.list")
enricher.aggregating.fromMembers: true
enricher.aggregator.excludeBlank: true
enricher.suppressDuplicates: true
- type: org.apache.brooklyn.enricher.stock.Joiner
brooklyn.config:
uniqueTag: drbd-hostaddress-joiner
enricher.sourceSensor: $brooklyn:sensor("drbd.monitor.hostaddress.list")
enricher.targetSensor: $brooklyn:sensor("drbd.monitor.hostaddresses")
enricher.joiner.quote: false
enricher.suppressDuplicates: true
- type: org.apache.brooklyn.enricher.stock.Aggregator
brooklyn.config:
uniqueTag: drbd-hostname-aggregator
enricher.sourceSensor: $brooklyn:sensor("host.subnet.hostname")
enricher.targetSensor: $brooklyn:sensor("drbd.monitor.hostname.list")
enricher.aggregating.fromMembers: true
enricher.aggregator.excludeBlank: true
enricher.suppressDuplicates: true
- type: org.apache.brooklyn.enricher.stock.Joiner
brooklyn.config:
uniqueTag: drbd-hostname-joiner
enricher.sourceSensor: $brooklyn:sensor("drbd.monitor.hostname.list")
enricher.targetSensor: $brooklyn:sensor("drbd.monitor.hostnames")
enricher.joiner.quote: false
enricher.suppressDuplicates: true
- type: org.apache.brooklyn.enricher.stock.Aggregator
brooklyn.config:
uniqueTag: drbd-isUp-aggregator
enricher.sourceSensor: $brooklyn:sensor("service.isUp")
enricher.targetSensor: $brooklyn:sensor("drbd.isUp.list")
enricher.aggregating.fromMembers: true
enricher.aggregator.excludeBlank: true
- type: org.apache.brooklyn.enricher.stock.Joiner
brooklyn.config:
uniqueTag: drbd-isUp-joiner
enricher.sourceSensor: $brooklyn:sensor("drbd.isUp.list")
enricher.targetSensor: $brooklyn:sensor("drbd.isUps")
enricher.joiner.quote: false
enricher.suppressDuplicates: true
- type: org.apache.brooklyn.enricher.stock.Aggregator
brooklyn.config:
uniqueTag: drbd-started-aggregator
enricher.sourceSensor: $brooklyn:sensor("started")
enricher.targetSensor: $brooklyn:sensor("drbd.started.list")
enricher.aggregating.fromMembers: true
enricher.aggregator.excludeBlank: true
enricher.suppressDuplicates: true
- type: org.apache.brooklyn.enricher.stock.Joiner
brooklyn.config:
uniqueTag: drbd-started-joiner
enricher.sourceSensor: $brooklyn:sensor("drbd.started.list")
enricher.targetSensor: $brooklyn:sensor("drbd.started")
enricher.joiner.quote: false
enricher.suppressDuplicates: true
- type: org.apache.brooklyn.enricher.stock.Transformer
brooklyn.config:
enricher.suppressDuplicates: true
enricher.sourceSensor: $brooklyn:sensor("drbd.started")
enricher.targetSensor: $brooklyn:sensor("drbd.all.started")
enricher.transformation:
$brooklyn:object:
type: "com.google.guava:com.google.common.base.Functions"
factoryMethod.name: "forMap"
factoryMethod.args:
- "started,started" : true
- false
brooklyn.policies:
- type: org.apache.brooklyn.policy.ha.ServiceReplacer