Skip to content

Instantly share code, notes, and snippets.

@linhxhust
Created February 22, 2019 08:52
Show Gist options
  • Save linhxhust/0eb1c0cc2e8f89085c8ecb6dfea79d9f to your computer and use it in GitHub Desktop.
Save linhxhust/0eb1c0cc2e8f89085c8ecb6dfea79d9f to your computer and use it in GitHub Desktop.
[client]
port = 3306
socket = /data/mysql/data/mysqld.sock
[mysqld_safe]
socket = /data/mysql/data/mysqld.sock
nice = 0
[mysqld]
# TODO: change here
server-id = 1
#
# * Basic Settings
#
user = mysql
pid-file = /data/mysql/data/mysqld.pid
socket = /data/mysql/data/mysqld.sock
port = 3306
basedir = /usr
datadir = /data/mysql/data
tmpdir = /tmp
lc_messages_dir = /usr/share/mysql
lc_messages = en_US
skip-external-locking
character_set_server=utf8
# TODO: change here
bind-address = 10.144.32.139
# If applications support it, this stricter sql_mode prevents some
# mistakes like inserting invalid dates etc.
#sql_mode = NO_ENGINE_SUBSTITUTION,TRADITIONAL
# Rocksdb
plugin-load-add=ha_rocksdb.so
#
# * Fine Tuning
#
max_connections = 300
connect_timeout = 5
wait_timeout = 600
max_allowed_packet = 64M
sort_buffer_size = 4M
bulk_insert_buffer_size = 16M
tmp_table_size = 64M
max_heap_table_size = 64M
#
# * Thread Tuning
#
thread_handling = pool-of-threads
thread_cache_size = 128
thread_stack = 262144
# TODO: change here
thread_pool_size = 16
thread-pool-max-threads = 24
thread_pool_stall_limit = 6000
#
# * MyISAM
#
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched. On error, make copy and try a repair.
myisam_recover_options = BACKUP
key_buffer_size = 128M
#open-files-limit = 2000
table_open_cache = 400
myisam_sort_buffer_size = 512M
concurrent_insert = 2
read_buffer_size = 2M
read_rnd_buffer_size = 1M
#
# * Query Cache Configuration
#
# Cache only tiny result sets, so we can fit more in the query cache.
query_cache_limit = 256K
query_cache_size = 64M
# for more write intensive setups, set to DEMAND or OFF
#query_cache_type = DEMAND
#
# * Logging
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1
#
# Error logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf.
#
# we do want to know about network errors and such
log_warnings = 2
#
# Enable the slow query log to see queries with especially long duration
#slow_query_log[={0|1}]
slow_query_log_file = /data/mysql/log/mysql/mariadb-slow.log
long_query_time = 60
#log_slow_rate_limit = 1000
log_slow_verbosity = query_plan
log-queries-not-using-indexes = 1
log_slow_admin_statements = 1
#
# * Replication
#
# masters
log_basename = mariadb
log_bin = /data/mysql/log/mariadb-bin
log_bin_index = /data/mysql/log/mariadb-bin.index
expire_logs_days = 10
max_binlog_size = 200M
#report_host = master1
#auto_increment_increment = 2
#auto_increment_offset = 1
# not fab for performance, but safer
#sync_binlog = 1
# slaves
relay_log = /data/mysql/log/relay-bin
relay_log_index = /data/mysql/log/relay-bin.index
relay_log_info_file = /data/mysql/log/relay-bin.info
#log_slave_updates
#read_only
# TODO: change here
slave_parallel_workers = 16
slave_parallel_mode = optimistic
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /data/mysql/data/.
# Read the manual for more InnoDB related options. There are many!
default_storage_engine = InnoDB
# you can't just change log file size, requires special procedure
innodb_log_buffer_size = 8M
innodb_file_per_table = 2
innodb_open_files = 400
innodb_io_capacity = 400
innodb_flush_method = O_DIRECT
# TODO: change here
innodb_log_file_size = 256M
innodb_buffer_pool_size = 16G
innodb_buffer_pool_instances = 32
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /data/mysql/data/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
#
# * Galera-related settings
#
[galera]
# Mandatory settings
#wsrep_on=ON
#wsrep_provider=
#wsrep_cluster_address=
#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 setting
#wsrep_slave_threads=1
#innodb_flush_log_at_trx_commit=0
[mysqldump]
quick
quote-names
max_allowed_packet = 64M
[mysql]
#no-auto-rehash # faster start of mysql but no tab completion
[isamchk]
key_buffer = 16M
#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
# !includedir /etc/mysql/conf.d/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment