From 2448ac41393cdad5fdd4fb396e8f2b95232dfecb Mon Sep 17 00:00:00 2001 From: root Date: Fri, 26 Nov 2021 20:36:49 +0900 Subject: [PATCH] mariadb latest for ko_KR --- centos8_mariadb/Dockerfile | 16 +-- centos8_mariadb/docker_run.sh | 6 + centos8_mariadb/mysql/debian-start | 47 +++++++ centos8_mariadb/mysql/debian.cnf | 14 +++ centos8_mariadb/mysql/mariadb.cnf | 33 +++++ .../mysql/mariadb.conf.d/50-client.cnf | 19 +++ .../mysql/mariadb.conf.d/50-mysql-clients.cnf | 22 ++++ .../mysql/mariadb.conf.d/50-mysqld_safe.cnf | 28 +++++ .../mysql/mariadb.conf.d/50-server.cnf | 117 ++++++++++++++++++ .../mysql/mariadb.conf.d/60-galera.cnf | 21 ++++ .../enable_encryption.preset | 20 +++ centos8_mariadb/mysql/my.cnf | 74 +++++++++++ centos8_mariadb/supervisord.conf | 14 +++ 13 files changed, 420 insertions(+), 11 deletions(-) create mode 100644 centos8_mariadb/docker_run.sh create mode 100755 centos8_mariadb/mysql/debian-start create mode 100644 centos8_mariadb/mysql/debian.cnf create mode 100644 centos8_mariadb/mysql/mariadb.cnf create mode 100644 centos8_mariadb/mysql/mariadb.conf.d/50-client.cnf create mode 100644 centos8_mariadb/mysql/mariadb.conf.d/50-mysql-clients.cnf create mode 100644 centos8_mariadb/mysql/mariadb.conf.d/50-mysqld_safe.cnf create mode 100644 centos8_mariadb/mysql/mariadb.conf.d/50-server.cnf create mode 100644 centos8_mariadb/mysql/mariadb.conf.d/60-galera.cnf create mode 100644 centos8_mariadb/mysql/mariadb.conf.d/99-enable-encryption.cnf.preset/enable_encryption.preset create mode 100644 centos8_mariadb/mysql/my.cnf create mode 100644 centos8_mariadb/supervisord.conf diff --git a/centos8_mariadb/Dockerfile b/centos8_mariadb/Dockerfile index e23a2f9..b63dc28 100644 --- a/centos8_mariadb/Dockerfile +++ b/centos8_mariadb/Dockerfile @@ -14,21 +14,15 @@ RUN echo 'set encoding=utf-8' >> /etc/vimrc RUN echo 'set encoding=utf-8' >> /etc/virc RUN echo 'set fileencodings=utf-8,cp949' >> /etc/vimrc RUN echo 'set fileencodings=utf-8,cp949' >> /etc/virc -RUN echo 'set softtabstop=4' >> /etc/vimrc -RUN echo 'set softtabstop=4' >> /etc/virc -RUN echo 'set shiftwidth=4' >> /etc/vimrc -RUN echo 'set shiftwidth=4' >> /etc/virc -RUN echo 'set tabstop=4' >> /etc/vimrc -RUN echo 'set tabstop=4' >> /etc/virc -RUN echo 'set paste' >> /etc/vimrc -RUN echo 'set paste' >> /etc/virc - RUN echo 'export LANG="$LANG"' >> /etc/bashrc RUN echo 'export LANGUAGE="$LANG"' >> /etc/bashrc RUN source /etc/bashrc RUN echo '2. Install need Package' -RUN dnf -y install mariadb-server +RUN dnf -y install mariadb-server supervisor + +RUN echo '3. Setting Supervisor for Web' +COPY supervisord.conf /etc/supervisord.conf EXPOSE 3306 -CMD ["/usr/libexec/mysqld","--basedir=/usr"] +CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"] diff --git a/centos8_mariadb/docker_run.sh b/centos8_mariadb/docker_run.sh new file mode 100644 index 0000000..0a1db8d --- /dev/null +++ b/centos8_mariadb/docker_run.sh @@ -0,0 +1,6 @@ +docker run --name mariadb \ +-e MYSQL_ROOT_PASSWORD=12clqkidc@! \ +-e TZ=Asia/Seoul \ +-v /home/container/centos8_mariadb/data:/var/lib/mysql \ +-v /home/container/centos8_mariadb/mysql:/etc/mysql \ +-p 3306:3306 -d mariadb:latest diff --git a/centos8_mariadb/mysql/debian-start b/centos8_mariadb/mysql/debian-start new file mode 100755 index 0000000..ffe635d --- /dev/null +++ b/centos8_mariadb/mysql/debian-start @@ -0,0 +1,47 @@ +#!/bin/bash +# +# This script is executed by both SysV init /etc/init.d/mariadb and +# systemd mariadb.service on every (re)start. +# +# Changes to this file will be preserved when updating the Debian package. +# + +source /usr/share/mysql/debian-start.inc.sh + +# Read default/mysql first and then default/mariadb just like the init.d file does +if [ -f /etc/default/mysql ]; then + . /etc/default/mysql +fi + +if [ -f /etc/default/mariadb ]; then + . /etc/default/mariadb +fi + +MYSQL="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf" +MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf" +# Don't run full mysql_upgrade on every server restart, use --version-check to do it only once +MYUPGRADE="/usr/bin/mysql_upgrade --defaults-extra-file=/etc/mysql/debian.cnf --version-check" +MYCHECK="/usr/bin/mysqlcheck --defaults-file=/etc/mysql/debian.cnf" +MYCHECK_SUBJECT="WARNING: mysqlcheck has found corrupt tables" +MYCHECK_PARAMS="--all-databases --fast --silent" +MYCHECK_RCPT="${MYCHECK_RCPT:-root}" + +## Checking for corrupt, not cleanly closed (only for MyISAM and Aria engines) and upgrade needing tables. + +# The following commands should be run when the server is up but in background +# where they do not block the server start and in one shell instance so that +# they run sequentially. They are supposed not to echo anything to stdout. +# If you want to disable the check for crashed tables comment +# "check_for_crashed_tables" out. +# (There may be no output to stdout inside the background process!) + +# Need to ignore SIGHUP, as otherwise a SIGHUP can sometimes abort the upgrade +# process in the middle. +trap "" SIGHUP +( + upgrade_system_tables_if_necessary; + check_root_accounts; + check_for_crashed_tables; +) >&2 & + +exit 0 diff --git a/centos8_mariadb/mysql/debian.cnf b/centos8_mariadb/mysql/debian.cnf new file mode 100644 index 0000000..3ea673f --- /dev/null +++ b/centos8_mariadb/mysql/debian.cnf @@ -0,0 +1,14 @@ +# THIS FILE IS OBSOLETE. STOP USING IT IF POSSIBLE. +# This file exists only for backwards compatibility for +# tools that run '--defaults-file=/etc/mysql/debian.cnf' +# and have root level access to the local filesystem. +# With those permissions one can run 'mariadb' directly +# anyway thanks to unix socket authentication and hence +# this file is useless. See package README for more info. +[client] +host = localhost +#user = root +[mysql_upgrade] +host = localhost +#user = root +# THIS FILE WILL BE REMOVED IN A FUTURE DEBIAN RELEASE. diff --git a/centos8_mariadb/mysql/mariadb.cnf b/centos8_mariadb/mysql/mariadb.cnf new file mode 100644 index 0000000..d6b8609 --- /dev/null +++ b/centos8_mariadb/mysql/mariadb.cnf @@ -0,0 +1,33 @@ +# The MariaDB configuration file +# +# The MariaDB/MySQL tools read configuration files in the following order: +# 0. "/etc/mysql/my.cnf" symlinks to this file, reason why all the rest is read. +# 1. "/etc/mysql/mariadb.cnf" (this file) to set global defaults, +# 2. "/etc/mysql/conf.d/*.cnf" to set global options. +# 3. "/etc/mysql/mariadb.conf.d/*.cnf" to set MariaDB-only options. +# 4. "~/.my.cnf" to set user-specific options. +# +# If the same option is defined multiple times, the last one will apply. +# +# One can use all long options that the program supports. +# Run program with --help to get a list of available options and with +# --print-defaults to see which it would actually understand and use. +# +# If you are new to MariaDB, check out https://mariadb.com/kb/en/basic-mariadb-articles/ + +# +# This group is read both by the client and the server +# use it for options that affect everything +# +[client-server] +# Port or socket location where to connect +# port = 3306 +socket = /run/mysqld/mysqld.sock + +# Import all .cnf files from configuration directory +[mariadbd] +skip-host-cache +skip-name-resolve + +!includedir /etc/mysql/mariadb.conf.d/ +!includedir /etc/mysql/conf.d/ diff --git a/centos8_mariadb/mysql/mariadb.conf.d/50-client.cnf b/centos8_mariadb/mysql/mariadb.conf.d/50-client.cnf new file mode 100644 index 0000000..1fd4685 --- /dev/null +++ b/centos8_mariadb/mysql/mariadb.conf.d/50-client.cnf @@ -0,0 +1,19 @@ +# +# This group is read by the client library +# Use it for options that affect all clients, but not the server +# + +[client] +# Example of client certificate usage +#ssl-cert = /etc/mysql/client-cert.pem +#ssl-key = /etc/mysql/client-key.pem +# +# Allow only TLS encrypted connections +#ssl-verify-server-cert = on + +# This group is *never* read by mysql client library, though this +# /etc/mysql/mariadb.cnf.d/client.cnf file is not read by Oracle MySQL +# client anyway. +# If you use the same .cnf file for MySQL and MariaDB, +# use it for MariaDB-only client options +[client-mariadb] diff --git a/centos8_mariadb/mysql/mariadb.conf.d/50-mysql-clients.cnf b/centos8_mariadb/mysql/mariadb.conf.d/50-mysql-clients.cnf new file mode 100644 index 0000000..2f5a360 --- /dev/null +++ b/centos8_mariadb/mysql/mariadb.conf.d/50-mysql-clients.cnf @@ -0,0 +1,22 @@ +# +# These groups are read by MariaDB command-line tools +# Use it for options that affect only one utility +# + +[mysql] + +[mysql_upgrade] + +[mysqladmin] + +[mysqlbinlog] + +[mysqlcheck] + +[mysqldump] + +[mysqlimport] + +[mysqlshow] + +[mysqlslap] diff --git a/centos8_mariadb/mysql/mariadb.conf.d/50-mysqld_safe.cnf b/centos8_mariadb/mysql/mariadb.conf.d/50-mysqld_safe.cnf new file mode 100644 index 0000000..e24f96a --- /dev/null +++ b/centos8_mariadb/mysql/mariadb.conf.d/50-mysqld_safe.cnf @@ -0,0 +1,28 @@ +# NOTE: THIS FILE IS READ ONLY BY THE TRADITIONAL SYSV INIT SCRIPT, NOT SYSTEMD. +# MARIADB SYSTEMD DOES _NOT_ UTILIZE MYSQLD_SAFE NOR READ THIS FILE. +# +# For similar behavior, systemd users should create the following file: +# /etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf +# +# To achieve the same result as the default 50-mysqld_safe.cnf, please create +# /etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf +# with the following contents: +# +# [Service] +# User = mysql +# StandardOutput = syslog +# StandardError = syslog +# SyslogFacility = daemon +# SyslogLevel = err +# SyslogIdentifier = mysqld +# +# For more information, please read https://mariadb.com/kb/en/mariadb/systemd/ + +[mysqld_safe] +# This will be passed to all mysql clients +# It has been reported that passwords should be enclosed with ticks/quotes +# especially if they contain "#" chars... + +nice = 0 +skip_log_error +syslog diff --git a/centos8_mariadb/mysql/mariadb.conf.d/50-server.cnf b/centos8_mariadb/mysql/mariadb.conf.d/50-server.cnf new file mode 100644 index 0000000..588c331 --- /dev/null +++ b/centos8_mariadb/mysql/mariadb.conf.d/50-server.cnf @@ -0,0 +1,117 @@ +# +# These groups are read by MariaDB server. +# Use it for options that only the server (but not clients) should see + +# this is read by the standalone daemon and embedded servers +[server] + +# this is only for the mysqld standalone daemon +[mysqld] + +# +# * Basic Settings +# + +#user = mysql +pid-file = /run/mysqld/mysqld.pid +basedir = /usr +datadir = /var/lib/mysql +tmpdir = /tmp +lc-messages-dir = /usr/share/mysql +lc-messages = en_US +skip-external-locking + +# Broken reverse DNS slows down connections considerably and name resolve is +# safe to skip if there are no "host by domain name" access grants +#skip-name-resolve + +# Instead of skip-networking the default is now to listen only on +# localhost which is more compatible and is not less secure. +#bind-address = 127.0.0.1 + +# +# * Fine Tuning +# + +#key_buffer_size = 128M +#max_allowed_packet = 1G +#thread_stack = 192K +#thread_cache_size = 8 +# This replaces the startup script and checks MyISAM tables if needed +# the first time they are touched +#myisam_recover_options = BACKUP +#max_connections = 100 +#table_cache = 64 + +# +# * Logging and Replication +# + +# Both location gets rotated by the cronjob. +# Be aware that this log type is a performance killer. +# Recommend only changing this at runtime for short testing periods if needed! +#general_log_file = /var/log/mysql/mysql.log +#general_log = 1 + +# When running under systemd, error logging goes via stdout/stderr to journald +# and when running legacy init error logging goes to syslog due to +# /etc/mysql/conf.d/mariadb.conf.d/50-mysqld_safe.cnf +# Enable this if you want to have error logging into a separate file +#log_error = /var/log/mysql/error.log +# Enable the slow query log to see queries with especially long duration +#slow_query_log_file = /var/log/mysql/mariadb-slow.log +#long_query_time = 10 +#log_slow_verbosity = query_plan,explain +#log-queries-not-using-indexes +#min_examined_row_limit = 1000 + +# The following can be used as easy to replay backup logs or for replication. +# note: if you are setting up a replication slave, see README.Debian about +# other settings you may need to change. +#server-id = 1 +#log_bin = /var/log/mysql/mysql-bin.log +expire_logs_days = 10 +#max_binlog_size = 100M + +# +# * SSL/TLS +# + +# For documentation, please read +# https://mariadb.com/kb/en/securing-connections-for-client-and-server/ +#ssl-ca = /etc/mysql/cacert.pem +#ssl-cert = /etc/mysql/server-cert.pem +#ssl-key = /etc/mysql/server-key.pem +#require-secure-transport = on + +# +# * Character sets +# + +# MySQL/MariaDB default is Latin1, but in Debian we rather default to the full +# utf8 4-byte character set. See also client.cnf +character-set-server = utf8mb4 +collation-server = utf8mb4_general_ci + +# +# * InnoDB +# + +# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/. +# Read the manual for more InnoDB related options. There are many! +# Most important is to give InnoDB 80 % of the system RAM for buffer use: +# https://mariadb.com/kb/en/innodb-system-variables/#innodb_buffer_pool_size +#innodb_buffer_pool_size = 8G + +# this is only for embedded server +[embedded] + +# This group is only read by MariaDB servers, not by MySQL. +# If you use the same .cnf file for MySQL and MariaDB, +# you can put MariaDB-only options here +[mariadb] + +# This group is only read by MariaDB-10.6 servers. +# If you use the same .cnf file for MariaDB of different versions, +# use this group for options that older servers don't understand +[mariadb-10.6] diff --git a/centos8_mariadb/mysql/mariadb.conf.d/60-galera.cnf b/centos8_mariadb/mysql/mariadb.conf.d/60-galera.cnf new file mode 100644 index 0000000..274891b --- /dev/null +++ b/centos8_mariadb/mysql/mariadb.conf.d/60-galera.cnf @@ -0,0 +1,21 @@ +# +# * Galera-related settings +# +# See the examples of server wsrep.cnf files in /usr/share/mysql +# and read more at https://mariadb.com/kb/en/galera-cluster/ + +[galera] +# Mandatory settings +#wsrep_on = ON +#wsrep_cluster_name = "MariaDB Galera Cluster" +#wsrep_cluster_address = gcomm:// +#binlog_format = row +#default_storage_engine = InnoDB +#innodb_autoinc_lock_mode = 2 + +# Allow server to accept connections on all interfaces. +#bind-address = 0.0.0.0 + +# Optional settings +#wsrep_slave_threads = 1 +#innodb_flush_log_at_trx_commit = 0 diff --git a/centos8_mariadb/mysql/mariadb.conf.d/99-enable-encryption.cnf.preset/enable_encryption.preset b/centos8_mariadb/mysql/mariadb.conf.d/99-enable-encryption.cnf.preset/enable_encryption.preset new file mode 100644 index 0000000..722db7e --- /dev/null +++ b/centos8_mariadb/mysql/mariadb.conf.d/99-enable-encryption.cnf.preset/enable_encryption.preset @@ -0,0 +1,20 @@ +# +# !include this file into your my.cnf (or any of *.cnf files in /etc/my.cnf.d) +# and it will enable data at rest encryption. This is a simple way to +# ensure that everything that can be encrypted will be and your +# data will not leak unencrypted. +# +# DO NOT EDIT THIS FILE! On MariaDB upgrades it might be replaced with a +# newer version and your edits will be lost. Instead, add your edits +# to the .cnf file after the !include directive. +# +# NOTE that you also need to install an encryption plugin for the encryption +# to work. See https://mariadb.com/kb/en/mariadb/data-at-rest-encryption/#encryption-key-management +# +[mariadb] +aria-encrypt-tables +encrypt-binlog +encrypt-tmp-disk-tables +encrypt-tmp-files +loose-innodb-encrypt-log +loose-innodb-encrypt-tables diff --git a/centos8_mariadb/mysql/my.cnf b/centos8_mariadb/mysql/my.cnf new file mode 100644 index 0000000..be51066 --- /dev/null +++ b/centos8_mariadb/mysql/my.cnf @@ -0,0 +1,74 @@ +# The MariaDB configuration file +# +# The MariaDB/MySQL tools read configuration files in the following order: +# 0. "/etc/mysql/my.cnf" symlinks to this file, reason why all the rest is read. +# 1. "/etc/mysql/mariadb.cnf" (this file) to set global defaults, +# 2. "/etc/mysql/conf.d/*.cnf" to set global options. +# 3. "/etc/mysql/mariadb.conf.d/*.cnf" to set MariaDB-only options. +# 4. "~/.my.cnf" to set user-specific options. +# +# If the same option is defined multiple times, the last one will apply. +# +# One can use all long options that the program supports. +# Run program with --help to get a list of available options and with +# --print-defaults to see which it would actually understand and use. +# +# If you are new to MariaDB, check out https://mariadb.com/kb/en/basic-mariadb-articles/ + +# +# This group is read both by the client and the server +# use it for options that affect everything +# +[client-server] +# Port or socket location where to connect +# port = 3306 +socket = /run/mysqld/mysqld.sock + +# Import all .cnf files from configuration directory +[mariadbd] +skip-host-cache +skip-name-resolve + +!includedir /etc/mysql/mariadb.conf.d/ +!includedir /etc/mysql/conf.d/ + +#UTF-8 +#CharacterSet +character_set_server = utf8 +collation_server = utf8_unicode_ci +init_connect = 'SET NAMES utf8' +skip-character-set-client-handshake + +#EUC-KR +#init_connect=SET collation_connection=euckr_korean_ci +#init_connect=SET NAMES euckr +#character-set-server=euckr +#collation-server=euckr_korean_ci + +#Engine +#default-storage-engine = InnoDB +#innodb = FORCE + +#Slowlog +slow_query_log = on +slow_query_log_file = /var/lib/mysql/slowquery-log_error.log +long_query_time = 3 +log_queries_not_using_indexes = off +#innodb_force_recovery=1 + +#Tunning +key_buffer_size = 128M +max_allowed_packet = 16M +query_cache_size = 32M +sort_buffer_size = 5M +join_buffer_size = 64M +read_rnd_buffer_size = 8M +max_heap_table_size = 381M +table_open_cache = 2048 +table_definition_cache = 1024 +tmp_table_size=64M +thread_cache_size = 16 + +# Try number of CPU's*2 for thread_concurrency +#thread_concurrency = 8 +explicit_defaults_for_timestamp = TRUE diff --git a/centos8_mariadb/supervisord.conf b/centos8_mariadb/supervisord.conf new file mode 100644 index 0000000..121ea4c --- /dev/null +++ b/centos8_mariadb/supervisord.conf @@ -0,0 +1,14 @@ +[supervisord] +nodaemon=true +logfile=/dev/null +logfile_maxbytes=0 +pidfile=/run/supervisord.pid + +[program:mariadb] +command=/usr/bin/mysqld_safe --user=mysql +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 +autorestart=false +startretries=0