For improved reliability, MariaDB can be used in a cluster for production sites.
This example, when placed in
.lagoon.yml will enable Galera on the
environments: production: types: mariadb: mariadb-galera
also you will need to change your service definition in your
mariadb: image: amazeeio/mariadb-galera-drupal labels: lagoon.type: mariadb ports: - "3306" # exposes the port 3306 with a random local port, find it with `docker-compose port mariadb 3306` environment: << : *default-environment
It is recommended to configure the environment before the initial deploy of the production site, otherwise manual intervention may be needed from your lagoon administrator.
Additional MariaDB Logging¶
During the course of development, it may be necessary to enable either query
logging or slow query logging. To do so just set the environment variables
MARIADB_LOG_QUERIES. This can be done in
Connecting to MySQL's container from the host¶
Get published MySQL port from the container¶
By default, Docker assigns a randomly published port for MySQL during each container start. This is done to prevent port collisions.
To get the published port via
$ docker port drupal_example_mariadb_1 3306/tcp -> 0.0.0.0:32797
docker-compose inside a Drupal repository
docker-compose port [service_name] [interal_port]
$ docker-compose port mariab 3306 0.0.0.0:32797
Setting a static port (not recommended)¶
During development, if you are using an external database tool it may become cumbersome to continually check and set MySQL connection port.
To set a static port; edit your service definition in your
mariadb: ... ports: - "33772:3306" # exposes port 3306 with a 33772 on the host port. Note by doing this you are responsible for managing port collisions`
By setting a static port you become responsible for maniging port collisions.
Connect to MySQL¶
|IP/Host||ip from container||
|Port||published port from container||published port from container|