Skip to content

tomalok/mariadb

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MariaDB Docker Container Image

Build Status Docker Pulls Docker Stars Docker Layers

❗Known issue with bind mounts on macOS and Windows

Latest MariaDB will fail to start on macOS and Windows with Probably out of disk space if you use bind mounts (volumes mounted from host). This (likely) happens because of recent changes in InnoDB, this bug addressed in MariaDB JIRA.

Solutions:

  • Use MariaDB 10.1 with stability tag 3.2.1 or higher
  • Not to use bind mounts, let docker manage volumes, since docker-ce 17.06 it won't clean up your volumes with docker system prune unless you specify --volumes flag

Docker Images

❗For better reliability we release images with stability tags (wodby/mariadb:10.4-X.X.X) which correspond to git tags. We strongly recommend using images only with stability tags.

Overview:

Supported tags and respective Dockerfile links:

Credits to Alpine Linux team for patches for better musl compatibility of MariaDB. Patches taken from Alpine's packages repository.

Environment Variables

Variable 10.4 10.3 10.2 10.1
MARIADB_PLUGIN_LOAD
MYSQL_BACK_LOG 100 100 100 100
MYSQL_CHARACTER_SET_FILESYSTEM utf8 utf8 utf8 utf8
MYSQL_CHARACTER_SET_SERVER utf8 utf8 utf8 utf8
MYSQL_CLIENT_DEFAULT_CHARACTER_SET utf8 utf8 utf8 utf8
MYSQL_COLLATION_SERVER utf8_unicode_ci utf8_unicode_ci utf8_unicode_ci utf8_unicode_ci
MYSQL_CONNECT_TIMEOUT 10 10 10 10
MYSQL_DATABASE
MYSQL_DEFAULT_STORAGE_ENGINE InnoDB InnoDB InnoDB InnoDB
MYSQL_DUMP_MAX_ALLOWED_PACKET 1G 1G 1G 1G
MYSQL_GENERAL_LOG 1 1 1 1
MYSQL_INIT_CONNECT SET NAMES utf8 SET NAMES utf8 SET NAMES utf8 SET NAMES utf8
MYSQL_INNODB_BUFFER_POOL_INSTANCES 1 1 1 1
MYSQL_INNODB_BUFFER_POOL_SIZE 128M 128M 128M 128M
MYSQL_INNODB_DEFAULT_ROW_FORMAT dynamic dynamic dynamic dynamic
MYSQL_INNODB_FAST_SHUTDOWN 1 1 1 1
MYSQL_INNODB_FILE_FORMAT - - - barracuda
MYSQL_INNODB_FILE_PER_TABLE 1 1 1 1
MYSQL_INNODB_FLUSH_LOG_AT_TRX_COMMIT 2 2 2 2
MYSQL_INNODB_FLUSH_METHOD O_DIRECT O_DIRECT O_DIRECT O_DIRECT
MYSQL_INNODB_FORCE_LOAD_CORRUPTED 0 0 0 0
MYSQL_INNODB_FORCE_RECOVERY 0 0 0 0
MYSQL_INNODB_IO_CAPACITY 200 200 200 200
MYSQL_INNODB_LARGE_PREFIX - - - 1
MYSQL_INNODB_LOCK_WAIT_TIMEOUT 50 50 50 50
MYSQL_INNODB_LOG_BUFFER_SIZE 8M 8M 8M 8M
MYSQL_INNODB_LOG_FILE_SIZE 128M 128M 128M 128M
MYSQL_INNODB_LOG_FILES_IN_GROUP 2 2 2 2
MYSQL_INNODB_OLD_BLOCKS_TIME 1000 1000 1000 1000
MYSQL_INNODB_OPEN_FILES 1024 1024 1024 1024
MYSQL_INNODB_PURGE_THREADS 4 4 4 1
MYSQL_INNODB_READ_IO_THREADS 4 4 4 4
MYSQL_INNODB_STATS_ON_METADATA OFF OFF OFF OFF
MYSQL_INNODB_STRICT_MODE OFF OFF OFF OFF
MYSQL_INNODB_WRITE_IO_THREADS 4 4 4 4
MYSQL_INTERACTIVE_TIMEOUT 420 420 420 420
MYSQL_JOIN_BUFFER_SIZE 8M 8M 8M 8M
MYSQL_LOG_WARNINGS 2 2 2 2
MYSQL_LONG_QUERY_TIME 2 2 2 2
MYSQL_MAX_ALLOWED_PACKET 256M 256M 256M 256M
MYSQL_MAX_CONNECT_ERRORS 100000 100000 100000 100000
MYSQL_MAX_CONNECTIONS 50 50 50 50
MYSQL_MAX_HEAP_TABLE_SIZE 16M 16M 16M 16M
MYSQL_NET_READ_TIMEOUT 90 90 90 90
MYSQL_NET_WRITE_TIMEOUT 90 90 90 90
MYSQL_OPEN_FILES_LIMIT 0 0 0 0
MYSQL_OPTIMIZER_PRUNE_LEVEL 1 1 1 1
MYSQL_OPTIMIZER_SEARCH_DEPTH 62 62 62 62
MYSQL_PASSWORD
MYSQL_PERFORMANCE_SCHEMA OFF OFF OFF OFF
MYSQL_PORT 3306 3306 3306 3306
MYSQL_QUERY_CACHE_LIMIT 1M 1M 1M 1M
MYSQL_QUERY_CACHE_MIN_RES_UNIT 2K 2K 2K 2K
MYSQL_QUERY_CACHE_SIZE 128M 128M 128M 128M
MYSQL_QUERY_CACHE_TYPE ON ON ON ON
MYSQL_RELAY_LOG_RECOVERY 0 0 0 0
MYSQL_ROOT_PASSWORD
MYSQL_SLOW_QUERY_LOG 0 0 0 0
MYSQL_SORT_BUFFER_SIZE 2M 2M 2M 2M
MYSQL_TABLE_DEFINITION_CACHE 400 400 400 400
MYSQL_TABLE_OPEN_CACHE 4096 4096 4096 4096
MYSQL_THREAD_CACHE_SIZE 75 75 75 75
MYSQL_TMP_TABLE_SIZE 16M 16M 16M 16M
MYSQL_USER
MYSQL_WAIT_TIMEOUT 420 420 420 420
MYSQL_TRANSACTION_ISOLATION REPEATABLE-READ REPEATABLE-READ REPEATABLE-READ REPEATABLE-READ

"-" - Not available for this version

Additional environment variables

MYSQL_INNODB_DATA_FILE_PATH:

Default value for all versions:

ibdata1:10M:autoextend:max:10G"

Performance Tuning Recommendations

Optimizer search depth

Decrease the value of MYSQL_OPTIMIZER_SEARCH_DEPTH to 7-8 if you have many queries with more than 15 tables (source)

Calculating the optimal size of innodb_buffer_pool_size

Run the following query to get the recommend innodb buffer pool size:

SELECT CONCAT(CEILING(RIBPS/POWER(1024,pw)),SUBSTR(' KMGT',pw+1,1))
Recommended_InnoDB_Buffer_Pool_Size FROM
(
    SELECT RIBPS,FLOOR(LOG(RIBPS)/LOG(1024)) pw
    FROM
    (
        SELECT SUM(data_length+index_length)*1.1*growth RIBPS
        FROM information_schema.tables AAA,
        (SELECT 1.25 growth) BBB
        WHERE ENGINE='InnoDB'
    ) AA
) A;

Source: from stack exchange.

Orchestration Actions

Usage:

make COMMAND [params ...]
 
commands:
    import source=</path/to/dump.zip or http://example.com/url/to/dump.sql.gz> [db root_password host ignore="table1;table2;cache_%"] 
    backup filepath=</path/to/backup.sql.gz> [root_password host db] 
    query query [db user password host] 
    query-silent query [db user password host] 
    query-root query [db root_password host]
    check-ready [root_password host max_try wait_seconds]  
    mysql-upgrade [root_password host]  
    mysql-check [root_password host db]  
    
default params values:
    user $MYSQL_USER
    password $MYSQL_PASSWORD
    db $MYSQL_DATABASE
    root_password $MYSQL_ROOT_PASSWORD
    host localhost
    max_try 1
    wait_seconds 1
    ignore ""

Deployment

Deploy MariaDB to your own server via Wodby Wodby.

About

MariaDB docker container image

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 61.3%
  • Dockerfile 25.5%
  • Makefile 13.2%