Added my.cnf with openstack recommended settings.

This commit is contained in:
Egon Rijpkema 2017-06-22 09:19:08 +02:00
parent 13064a8e7e
commit aa535dc3d4
3 changed files with 88 additions and 5 deletions

View File

@ -0,0 +1,68 @@
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
skip-host-cache
skip-name-resolve
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc_messages_dir = /usr/share/mysql
lc_messages = en_US
skip-external-locking
connect_timeout = 5
wait_timeout = 600
max_allowed_packet = 16M
thread_cache_size = 128
sort_buffer_size = 4M
bulk_insert_buffer_size = 16M
tmp_table_size = 32M
max_heap_table_size = 32M
myisam_recover_options = BACKUP
key_buffer_size = 128M
table_open_cache = 400
myisam_sort_buffer_size = 512M
concurrent_insert = 2
read_buffer_size = 2M
read_rnd_buffer_size = 1M
query_cache_limit = 128K
query_cache_size = 64M
slow_query_log_file = /var/log/mysql/mariadb-slow.log
long_query_time = 10
expire_logs_days = 10
max_binlog_size = 100M
default_storage_engine = InnoDB
innodb_buffer_pool_size = <t_CO>M
innodb_log_buffer_size = 8M
innodb_file_per_table = 1
innodb_open_files = 400
innodb_io_capacity = 400
innodb_flush_method = O_DIRECT
default-storage-engine = innodb
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
[galera]
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
[mysql]
[isamchk]
key_buffer = 16M

View File

@ -2,15 +2,17 @@
Description=Mariadb Container Description=Mariadb Container
After=docker.service After=docker.service
Requires=docker.service Requires=docker.service
[Service] [Service]
TimeoutStartSec=0 TimeoutStartSec=0
Restart=always Restart=always
ExecStartPre=-/usr/bin/docker stop %n ExecStartPre=-/usr/bin/docker stop %n
ExecStartPre=-/usr/bin/docker rm %n ExecStartPre=-/usr/bin/docker rm %n
ExecStartPre=/usr/bin/docker pull mariadb:10.2 ExecStartPre=/usr/bin/docker pull mariadb:10.2
ExecStart=/usr/bin/docker run -p 3306:3306 --name %n -v /srv/lib/mysql:/var/lib/mysql \ ExecStart=/usr/bin/docker run -p 3306:3306 --name %n \
-v /srv/mariadb/lib/mysql:/var/lib/mysql \
-v /srv/mariadb/etc/mysql:/etc/mysql \
-e MYSQL_ROOT_PASSWORD=geheim mariadb:10.2 -e MYSQL_ROOT_PASSWORD=geheim mariadb:10.2
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@ -8,8 +8,21 @@
mode: 644 mode: 644
owner: root owner: root
group: root group: root
- name: install service file
command: systemctl daemon-reload - name: make mariadb settings volume
file:
path: /srv/mariadb/etc/mysql
state: directory
mode: 0777
- name: place settings file
copy:
src: files/my.cnf
dest: /srv/mariadb/etc/mysql
mode: 660
- command: systemctl daemon-reload
- name: make sure service is started - name: make sure service is started
systemd: systemd:
name: mysql.service name: mysql.service