Currently we are in the testing phase of the next release of our Ops Center (focmm). This testing is quite complex because it includes testing the interaction of various different components like a MariaDB Galera Cluster, a Galera Load Balancer, a virtual IP, etc.
Recently I was in the Linuxhotel for a Galera Cluster Training and there one of the other trainers was romanticising about Linux Containers and Incus. So I had a short look, if Incus could be useful to simplify our unit testing. Some old knowledge from a previous Docker PoC was quite helpful to start with…
Prepare an Incus container for Galera Load Balancer
This did NOT work as expected because the Debian image was lacking IPv4 addresses and I did not find on the quick how to change that. So I used the Ubuntu 22.04 image.
$ incus remote list
$ incus image list images: ubuntu/22.04 amd64
$ INSTANCE=\'qa-glb\'
$ incus launch images:ubuntu/jammy ${INSTANCE}
$ incus list *glb*
+--------+---------+-----------------------+----------------------------------------------+------------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+--------+---------+-----------------------+----------------------------------------------+------------+-----------+
| qa-glb | RUNNING | 10.139.158.183 (eth0) | fd42:1730:178f:78c:216:3eff:fe3f:2948 (eth0) | PERSISTENT | 0 |
+--------+---------+-----------------------+----------------------------------------------+------------+-----------+
Now we should remember the IPv4 address for later use. I am sure this can be done more elegant but for now this is fine…
Install Galera Load Balancer in the Incus container
$ incus exec ${INSTANCE} -- /bin/bash
container > apt-get update
container > apt-get install wget
container > wget https://support.fromdual.com/admin/download/glb_1.0.1-Ubuntu12.04-x86_64.deb
container > apt-get install ./glb_1.0.1-Ubuntu12.04-x86_64.deb
container > rm -f glb_1.0.1-Ubuntu12.04-x86_64.deb
Then we have to add the unit file:
#
# /etc/systemd/system/glb.service
#
[Unit]
Description=Galera Load Balancer Service
After=network.target
[Service]
EnvironmentFile=/etc/default/glbd
Type=simple
ExecStart=/usr/local/sbin/glbd --daemon --threads $THREADS --max_conn $MAX_CONN $OTHER_OPTIONS --control $CONTROL_ADDR $LISTEN_ADDR $DEFAULT_TARGETS
[Install]
WantedBy=multi-user.target
enable the unit file, configure the Galera Load Balancer and start it:
container > systemctl enable glb
# Galera Load Balancer Configuration
# Redhat: /etc/sysconfig/glbd
# Debian: /etc/default/glbd
LISTEN_ADDR=\"3306\"
CONTROL_ADDR=\"10.139.158.183:8011\"
CONTROL_FIFO=\"/var/run/glbd.fifo\"
THREADS=\"2\"
MAX_CONN=151
DEFAULT_TARGETS=\"10.139.158.1:3330:1 10.139.158.1:3331:1 10.139.158.1:3332:1\"
OTHER_OPTIONS=\"--round\"
container > systemctl start glb
container > apt-get remove wget
## Container testing
To be sure everything works fine we should do some basic tests:
$ incus stop ${INSTANCE}
$ incus start ${INSTANCE}
$ echo getinfo | nc -q 1 10.139.158.183 8011
Unit testing focmm against Galera Load Balancer in the Incus container
And finally we did the unit testing of focmm against the Galera Local Balancer which is in the Incus container:
$ ./tst/run_all_tests.php --instance=qamariadb106 --module=LoadBalancer shell >/dev/null
Environment is: qamariadb106
Logfile is: /tmp/focmm_tst_qamariadb106.log
Tests are: module=LoadBalancer and function=all
OK stopLoadBalancerRemote
OK startLoadBalancerRemote
OK restartLoadBalancerRemote
OK readLoadBalancerTypes
OK createLoadBalancer
OK updateLoadBalancer
OK readLoadBalancers
OK parseGlbConfiguration
OK openSocket
OK writeReadSocket
OK parseGlbGetInfo
OK parseGlbGetStats
OK changeLoadBalancerBackendWeightRemote
OK deleteLoadBalancer
Linux Container with Incus for focmm unit testing appeared first on MariaDB.org
Currently we are in the testing phase of the next release of our Ops Center (focmm). This testing is quite complex because it includes testing the interaction of various different components like a MariaDB Galera Cluster, a Galera Load Balancer, a virtual IP, etc.
Recently I was in the Linuxhotel for a Galera Cluster Training and there one of the other trainers was romanticising about Linux Containers and Incus. So I had a short look, if Incus could be useful to simplify our unit testing. Some old knowledge from a previous Docker PoC was quite helpful to start with…
Prepare an Incus container for Galera Load BalancerThis did NOT work as expected because the Debian image was lacking IPv4 addresses and I did not find on the quick how to change that. So I used the Ubuntu 22.04 image.
$ incus remote list
$ incus image list images: ubuntu/22.04 amd64
$ INSTANCE='qa-glb'
$ incus launch images:ubuntu/jammy ${INSTANCE}
$ incus list *glb*
+--------+---------+-----------------------+----------------------------------------------+------------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+--------+---------+-----------------------+----------------------------------------------+------------+-----------+
| qa-glb | RUNNING | 10.139.158.183 (eth0) | fd42:1730:178f:78c:216:3eff:fe3f:2948 (eth0) | PERSISTENT | 0 |
+--------+---------+-----------------------+----------------------------------------------+------------+-----------+
Now we should remember the IPv4 address for later use. I am sure this can be done more elegant but for now this is fine…
Install Galera Load Balancer in the Incus container$ incus exec ${INSTANCE} -- /bin/bash
container> apt-get update
container> apt-get install wget
container> wget https://support.fromdual.com/admin/download/glb_1.0.1-Ubuntu12.04-x86_64.deb
container> apt-get install ./glb_1.0.1-Ubuntu12.04-x86_64.deb
container> rm -f glb_1.0.1-Ubuntu12.04-x86_64.deb
Then we have to add the unit file:
#
# /etc/systemd/system/glb.service
#
[Unit]
Description=Galera Load Balancer Service
After=network.target
[Service]
EnvironmentFile=/etc/default/glbd
Type=simple
ExecStart=/usr/local/sbin/glbd --daemon --threads $THREADS --max_conn $MAX_CONN $OTHER_OPTIONS --control $CONTROL_ADDR $LISTEN_ADDR $DEFAULT_TARGETS
[Install]
WantedBy=multi-user.target
enable the unit file, configure the Galera Load Balancer and start it:
container> systemctl enable glb
# Galera Load Balancer Configuration
# Redhat: /etc/sysconfig/glbd
# Debian: /etc/default/glbd
LISTEN_ADDR="3306"
CONTROL_ADDR="10.139.158.183:8011"
CONTROL_FIFO="/var/run/glbd.fifo"
THREADS="2"
MAX_CONN=151
DEFAULT_TARGETS="10.139.158.1:3330:1 10.139.158.1:3331:1 10.139.158.1:3332:1"
OTHER_OPTIONS="--round"
container> systemctl start glb
container> apt-get remove wget
## Container testing
To be sure everything works fine we should do some basic tests:
$ incus stop ${INSTANCE}
$ incus start ${INSTANCE}
$ echo getinfo | nc -q 1 10.139.158.183 8011
Unit testing focmm against Galera Load Balancer in the Incus containerAnd finally we did the unit testing of focmm against the Galera Local Balancer which is in the Incus container:
$ ./tst/run_all_tests.php --instance=qamariadb106 --module=LoadBalancer shell>/dev/null
Environment is: qamariadb106
Logfile is: /tmp/focmm_tst_qamariadb106.log
Tests are: module=LoadBalancer and function=all
OK stopLoadBalancerRemote
OK startLoadBalancerRemote
OK restartLoadBalancerRemote
OK readLoadBalancerTypes
OK createLoadBalancer
OK updateLoadBalancer
OK readLoadBalancers
OK parseGlbConfiguration
OK openSocket
OK writeReadSocket
OK parseGlbGetInfo
OK parseGlbGetStats
OK changeLoadBalancerBackendWeightRemote
OK deleteLoadBalancer
| # | Наименование новости | Тональность | Информативность | Дата публикации |
|---|---|---|---|---|
| 1 | Deploying Tarantool Cartridge Applications with Zero Effort (Part 2) | 0 | 8.1 | 01-04-2020 |
| 2 | Meghan Markle Slammed As ‘Shameless’ And ‘Pathetic’ After Correcting Mindy Kaling On Her Show: ‘You Know I’m Sussex Now’ | 0 | 0 | 06-03-2025 |
| 3 | Re: Creating topography/terrain in civil 3D from Google earth data | 0 | 0 | 15-01-2020 |
| 4 | AMD Radeon RX 9000 Series Works Best with UEFI-Only Systems | 0 | 0 | 04-03-2025 |
| 5 | Message to community | 0 | 0 | 23-02-2025 |
| 6 | «Тайна третьей планеты» — советский полнометражный научно-фантастический мультфильм Романа Качанова, ... | 0 | 0 | 08-03-2023 |
| 7 | Georgia is a country with a high level of security ... | 0 | 0 | 12-02-2025 |
| 8 | Россиян пригласят заботиться о птицах в холодное время года | 0 | 0 | 18-01-2019 |
| 9 | Спецоперация в дагестанских судах продолжается | 0 | 0 | 23-02-2020 |
| 10 | Бывший заместитель главы Котласа Елена Коряхина предстанет перед судом за растрату | 0 | 0 | 01-11-2024 |