Skip to content

Instantly share code, notes, and snippets.

@rickrussell
Created June 18, 2012 06:03
Show Gist options
  • Save rickrussell/2947075 to your computer and use it in GitHub Desktop.
Save rickrussell/2947075 to your computer and use it in GitHub Desktop.
Tuned MySQL Master Config File
#
# The MySQL database server configuration file.
#
[mysqld]
# GENERAL #
bind-address = 0.0.0.0
user = mysql
socket = /var/run/mysqld/mysqld.sock
pid_file = /var/run/mysqld/mysqld.pid
# MyISAM #
key_buffer_size = 32M
myisam_recover = FORCE,BACKUP
# SAFETY #
back_log = 128
default_storage_engine = InnoDB
max_allowed_packet = 1G
max_connect_errors = 4294967295
sysdate_is_now = 1
skip-external-locking
memlock
# DATA STORAGE #
datadir = /opt/mysql # Primary Raid Set
# BINARY LOGGING #
expire_logs_days = 20
sync_binlog = 1
# CACHES AND LIMITS #
tmp_table_size = 1G
max_heap_table_size = 1G
query_cache_type = 0
query_cache_size = 0
max_connections = 1024
thread_cache_size = 128
open_files_limit = 65535
table_definition_cache = 1024
table_open_cache = 2048
# INNODB #
default-storage-engine = INNODB
innodb_buffer_pool_size = 32G
innodb_additional_mem_pool_size = 64M
innodb_flush_method = O_DIRECT
innodb_flush_log_at_trx_commit = 1
innodb_thread_concurrency = 49 # (2n+d) / n=proc, d=disk
innodb_log_buffer_size = 16M
# LOGGING #
log_error = /var/log/mysql/error.log
slow_query_log = 1
slow_query_log_file = /opt/mysql/slow.log
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
max_allowed_packet = 1G
# Include confs in this dir
!includedir /etc/mysql/conf.d/
# http://dev.mysql.com/doc/refman/5.1/en/replication-howto-existingdata.html
# http://dev.mysql.com/doc/refman/5.1/en/replication-howto-slaveinit.html
[mysqld]
server-id = 10001
auto_increment_increment = 10
auto_increment_offset = 4
expire_logs_days = 20
max_binlog_size = 1G
binlog_format = MIXED
log-slave-updates = TRUE
sync_binlog = 1
innodb_flush_log_at_trx_commit = 1
relay_log_purge = 1
# should be no less than 2x max_binlog_size/max_relay_log_size
relay_log_space_limit = 10G
# Send binlogs to /mnt/ (Secondary Raid Set)
log_bin = /mnt/mysql/binlog/mysql-bin
relay-log = /mnt/mysql/binlog/relay-bin
relay-log-index = /mnt/mysql/binlog/relay-bin.index
relay-log-info-file = /mnt/mysql/binlog/relay-bin.info
replicate-wild-ignore-table = mysql.%,mysqlslap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment