Вход на сайт

Просмотр новости

Найдите то, что Вас интересует

Linux Container with Incus for focmm unit testing

Дата публикации: 13-10-2022 17:11:40

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 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

Схожие новости

#Наименование новостиТональностьИнформативностьДата публикации
1Deploying Tarantool Cartridge Applications with Zero Effort (Part 2)08.101-04-2020
2Meghan Markle Slammed As ‘Shameless’ And ‘Pathetic’ After Correcting Mindy Kaling On Her Show: ‘You Know I’m Sussex Now’0006-03-2025
3Re: Creating topography/terrain in civil 3D from Google earth data0015-01-2020
4AMD Radeon RX 9000 Series Works Best with UEFI-Only Systems0004-03-2025
5Message to community0023-02-2025
6«Тайна третьей планеты» — советский полнометражный научно-фантастический мультфильм Романа Качанова, ...0008-03-2023
7Georgia is a country with a high level of security ...0012-02-2025
8Россиян пригласят заботиться о птицах в холодное время года0018-01-2019
9Спецоперация в дагестанских судах продолжается0023-02-2020
10Бывший заместитель главы Котласа Елена Коряхина предстанет перед судом за растрату0001-11-2024

Классификация: . Схожих патентов: 0. Схожих новостей: 10. Тональность: 0. Информативность: 4.86. Источник: mariadb.org.