Site Tools


New release available: 2022-07-31 "Igor". upgrade now! [52.2] (what's this?)
docker_gxfs_ha_adm

DOCKER setup on GxFS Admin Server

As prerequirement the system needs to be ready and the following tools need to be installed: - docker - drbdmanage - drbd docker plugin

inital layout for the repository disk managed by DRBD:

docker icinga2
==============
share icinga2_icinga2
size 20GB

docker icingaweb2
=================
share icngwb2_etc_icingaweb2
size 20GB

docker mariadb
==============
share mariadb_var_lib_mysql_data
size 200 GB

repository
==========
share repo
size 400GB

commands to setup the docker volumes managed by drbd and generic drbd managed volumes:

[root@gxfsadm1-0 ~]# docker volume create --driver=drbdmanage --opt fs=xfs --opt size=20480 icinga2_icinga2
icinga2_icinga2
[root@gxfsadm1-0 ~]# docker volume ls
DRIVER              VOLUME NAME
drbdmanage          icinga2_icinga2
[root@gxfsadm1-0 ~]# drbdmanage list-volumes
+------------------------------------------------------------------------------------------------------------+
| Name               | Vol ID |   Size | Minor |                                                     | State |
|------------------------------------------------------------------------------------------------------------|
| icinga2_icinga2    |      0 | 20 GiB |   106 |                                                     |    ok |
+------------------------------------------------------------------------------------------------------------+
[root@gxfsadm1-0 ~]# docker volume create --driver=drbdmanage --opt fs=xfs --opt size=20480 icngwb2_etc_icingaweb2
icngwb2_etc_icingaweb2
[root@gxfsadm1-0 ~]# docker volume create --driver=drbdmanage --opt fs=xfs --opt size=204800 mariadb_var_lib_mysql_data
mariadb_var_lib_mysql_data
[root@gxfsadm1-0 ~]# drbdmanage list-volumes
+------------------------------------------------------------------------------------------------------------+
| Name                       | Vol ID |    Size | Minor |                                            | State |
|------------------------------------------------------------------------------------------------------------|
| icinga2_icinga2            |      0 |  20 GiB |   106 |                                            |    ok |
| icngwb2_etc_icingaweb2     |      0 |  20 GiB |   108 |                                            |    ok |
| mariadb_var_lib_mysql_data |      0 | 200 GiB |   109 |                                            |    ok |
+------------------------------------------------------------------------------------------------------------+
[root@gxfsadm1-0 ~]#
[root@gxfsadm1-0 ~]# drbdmanage mv -m 100 icinga2_icinga2 0
Operation completed successfully
[root@gxfsadm1-0 ~]# drbdmanage list-volumes
+------------------------------------------------------------------------------------------------------------+
| Name                       | Vol ID |    Size | Minor |                                            | State |
|------------------------------------------------------------------------------------------------------------|
| icinga2_icinga2            |      0 |  20 GiB |   100 |                                            |    ok |
| icngwb2_etc_icingaweb2     |      0 |  20 GiB |   108 |                                            |    ok |
| mariadb_var_lib_mysql_data |      0 | 200 GiB |   109 |                                            |    ok |
+------------------------------------------------------------------------------------------------------------+
[root@gxfsadm1-0 ~]# drbdmanage mv -m 101 icngwb2_etc_icingaweb2 0
Operation completed successfully
[root@gxfsadm1-0 ~]# drbdmanage mv -m 102 mariadb_var_lib_mysql_data 0
Operation completed successfully
[root@gxfsadm1-0 ~]# drbdmanage list-volumes
+------------------------------------------------------------------------------------------------------------+
| Name                       | Vol ID |    Size | Minor |                                            | State |
|------------------------------------------------------------------------------------------------------------|
| icinga2_icinga2            |      0 |  20 GiB |   100 |                                            |    ok |
| icngwb2_etc_icingaweb2     |      0 |  20 GiB |   101 |                                            |    ok |
| mariadb_var_lib_mysql_data |      0 | 200 GiB |   102 |                                            |    ok |
+------------------------------------------------------------------------------------------------------------+
[root@gxfsadm1-0 ~]#
[root@gxfsadm1-0 ~]# drbdmanage add-volume -m 200 repo 400GiB
Operation completed successfully
[root@gxfsadm1-0 ~]# drbdmanage list-volumes
+------------------------------------------------------------------------------------------------------------+
| Name                       | Vol ID |    Size | Minor |                                            | State |
|------------------------------------------------------------------------------------------------------------|
| icinga2_icinga2            |      0 |  20 GiB |   100 |                                            |    ok |
| icngwb2_etc_icingaweb2     |      0 |  20 GiB |   101 |                                            |    ok |
| mariadb_var_lib_mysql_data |      0 | 200 GiB |   102 |                                            |    ok |
| repo                       |      0 | 400 GiB |   200 |                                            |    ok |
+------------------------------------------------------------------------------------------------------------+
[root@gxfsadm1-0 ~]#

check volumes handled by docker itself:

[root@gxfsadm1-0 ~]# docker volume ls
DRIVER              VOLUME NAME
drbdmanage          icinga2_icinga2
drbdmanage          icngwb2_etc_icingaweb2
drbdmanage          mariadb_var_lib_mysql_data
[root@gxfsadm1-0 ~]#

After the volumes have been created the mountpoints defined in the docker-compose yaml definition files need to be chmod'ed to enable the docker container to write to it.

[root@gxfsadm1-0 ~]# ls -l /drbd
insgesamt 0
drwxr-xr-x. 2 root root 6 27. Mär 19:03 mariadb_var_lib_mysql_data
[root@gxfsadm1-0 ~]# chmod go+w /drbd/mariadb_var_lib_mysql_data/
[root@gxfsadm1-0 ~]# ls -l /drbd
insgesamt 0
drwxrwxrwx. 2 root root 6 27. Mär 19:03 mariadb_var_lib_mysql_data
[root@gxfsadm1-0 ~]#

MariaDB DOCKER contaier

To run the MariaDB Docker container the following yaml file for docker-compose need to be created. Th environment definition is used to define the users of the

mariadb_database:
  container_name: mariadb
  image: registry.access.redhat.com/rhscl/mariadb-102-rhel7
  ports:
    - "192.168.2.130:3306:3306"
  environment:
    TZ: "Europe/Berlin"
    MYSQL_USER: "dbuser"
    MYSQL_PASSWORD: "necINST."
    MYSQL_DATABASE: "db"
    MYSQL_ROOT_PASSWORD: "necINST."
  volume_driver: drbdmanage
  volumes:
    - /drbd/mariadb_var_lib_mysql_data:/var/lib/mysql/data

The given IP address in the compose file must exist before the container is fired up. THe container can only be bound to an existing IPaddress.

MariaDB initial setup

needs to be done manually after creation of the docker mariadb container.<br> <br> login to the database as root and issue the follwing commands:

[root@gpfs-master ~]# mysql -h 192.168.2.130 -u root -pnecINST. test
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 15
Server version: 10.2.8-MariaDB MariaDB Server

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [test]> create database icingaweb;
Query OK, 1 row affected (0.00 sec)

MariaDB [test]> create database ido_db;
Query OK, 1 row affected (0.00 sec)

MariaDB [test]> create database director;
Query OK, 1 row affected (0.00 sec)

MariaDB [test]> GRANT ALL PRIVILEGES ON director.* to dbuser;
Query OK, 0 rows affected (0.00 sec)

MariaDB [test]> GRANT ALL PRIVILEGES ON icingaweb.* to dbuser;
Query OK, 0 rows affected (0.00 sec)

MariaDB [test]> GRANT ALL PRIVILEGES ON ido_db.* to dbuser;
Query OK, 0 rows affected (0.00 sec)

MariaDB [test]> show databases;
+--------------------+
| Database           |
+--------------------+
| director           |
| icinga2            |
| icingaweb          |
| ido_db             |
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
8 rows in set (0.00 sec)

MariaDB [test]>
docker_gxfs_ha_adm.txt · Last modified: 2022/07/10 09:34 by 127.0.0.1