...
Codeblock |
---|
|
[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci
sort_buffer_size=1M
innodb_lru_scan_depth=128
innodb_ft_max_token_size=84
innodb_ft_result_cache_limit=2000000000
innodb_ft_total_cache_size=640000000
innodb_io_capacity=150000
innodb_io_capacity_max=150000
innodb_open_files=40960
open_files_limit=40960
max_allowed_packet=1073741824
tmp_table_size=128M
max_heap_table_size=128M
query_cache_limit=16777216
query_cache_size=134217728
ssl=1
ssl-ca=/etc/mysql/conf.d/ca.crt.pem
ssl-cert=/etc/mysql/conf.d/server.crt.pem
ssl-key=/etc/mysql/conf.d/server.key.pem |
Logging
Es ist möglich, über Einträge in der my.cnf das Query-Log und das Slow-Log zu aktivieren:
Codeblock |
---|
|
general_log = 1
general_log_file = /var/log/mysql/query.log
slow_query_log=1
long_query_time=0.1
slow_query_log_file = /var/log/mysql/slow.log
log_queries_not_using_indexes |
Über einen Custom-Entrypoint können diese Logdateien in die Standardausgabe (stdout) geschrieben werden, damit sie über docker logs bzw. Graylog ausgewertet werden können:
Codeblock |
---|
language | yml |
---|
title | docker-compose.yml (Auszug) |
---|
|
database:
image: mariadb:10.11
volumes:
- db_data:/var/lib/mysql
- ./mariadb/conf:/etc/mysql/conf.d
env_file:
- brandbox.docker.env
environment:
MYSQL_HOST: database.${COMPOSE_PROJECT_NAME}
entrypoint: /etc/mysql/conf.d/entrypoint.sh # >> Custom-Entrypoint definieren
labels:
traefik.enable: "false"
healthcheck:
test: ["CMD", "mysql", "-u", "root", "-proot", "-e", "SELECT version();"]
interval: 1m
timeout: 10s
retries: 3
ports:
- "3306"
cpus: 0.75
mem_limit: 1000M
networks:
internal:
aliases:
- database.${COMPOSE_PROJECT_NAME} |
Cluster-Konfiguration (Kubernetes)