Skip to content

Instantly share code, notes, and snippets.

@peerax peerax/my.cnf
Created Aug 28, 2014

Embed
What would you like to do?
mySQL config file for ram 8GB
# my.cnf for TAKIS Server
# BEGIN CONFIG INFO
# DESCR: 8 GB RAM, InnoDB only, ACID, few connections, heavy queries
# TYPE: SYSTEM
# END CONFIG INFO
[client]
port = 7000
socket = /var/lib/mysql/mysql.sock
default-character-set=utf8
[mysqld]
port = 7000
socket = /var/lib/mysql/mysql.sock
### *** Comment 1 *** ###
#character-set=utf8
init-connect='SET NAMES utf8'
character-set-server = utf8
collation-server = utf8_unicode_ci
### *** Comment 2 *** ###
# Set the event ON
event_scheduler=1
### *** Comment 3 *** ###
# Make table names case sensitive.
lower_case_table_names=1
skip-external-locking
skip-log-warnings
back_log = 50
max_connections=1024
max_connect_errors = 10
max_allowed_packet = 256M
table_open_cache = 1280
# Turn on MySQL query cache to speed up query performance
query-cache-type = 1
# (32MB for every 1GB of RAM)
query_cache_size = 256M
query_cache_limit = 256M
### *** Comment 4 *** ###
# RAM 4GB use 1M
binlog_cache_size = 2M
# RAM 4GB use 64M
max_heap_table_size = 384M
# RAM 4GB use 8
thread_cache_size = 8
# USE RAM
# join_buffer_size - 1M for 1GB, 2M for 2GB, 4M for 4GB
join_buffer_size = 16M
# sort_buffer_size - 1M for 1GB, 2M for 2GB, 4M for 4GB
sort_buffer_size = 8M
# key_buffer - 64M for 1GB, 128M for 2GB, 256M for 4GB
key_buffer_size = 256M
# read_buffer_size - 1M for 1GB, 2M for 2GB, 4M for 4GB
read_buffer_size = 6M
# When reading rows in sorted order after a sort, the rows are read
# through this buffer to avoid disk seeks. You can improve ORDER BY
# performance a lot, if set this to a high value.
read_rnd_buffer_size = 16M
# MyISAM uses special tree-like cache to make bulk inserts (that is,
# INSERT ... SELECT, INSERT ... VALUES (...), (...), ..., and LOAD DATA
# INFILE) faster. This variable limits the size of the cache tree in
# bytes per thread. Setting it to 0 will disable this optimisation. Do
bulk_insert_buffer_size = 64M
### *** Comment 5 *** ###
# thread_concurrency = 2 * (no. of CPU)
thread_concurrency = 4
# Fast connection and datatransfer
skip-name-resolve
#query_cache_size= 384M
#thread_cache_size = 16384
####################################
### *** Set Plugin InnoDB *** ###
####################################
# Run Plugin Maria and skip-innodb
# Important very much
# skip-innodb
# xtradb = 0
# Run Plugin Innodb
# ignore_builtin_innodb
### *** Comment 6 *** ###
default_storage_engine=Innodb
innodb_file_per_table = 1
innodb_file_format=barracuda
innodb_strict_mode=1
# Thread stack size to use. This amount of memory is always reserved at
# connection time. MySQL itself usually needs no more than 64K of
# memory, while if you use your own stack hungry UDF functions or your
# OS requires more stack for some operations, you might need to set this
# to a higher value.
thread_stack = 192K
# Set the default transaction isolation level. Levels available are:
# READ-UNCOMMITTED, READ-COMMITTED, REPEATABLE-READ, SERIALIZABLE
transaction_isolation = REPEATABLE-READ
# Maximum size for internal (in-memory) temporary tables. If a table
# grows larger than this value, it is automatically converted to disk
# based table This limitation is for a single table. There can be many
# of them. RAM 4GB use 64M
tmp_table_size = 384M
#log-slow-queries = /www/temp/logs/slow.log
#long_query_time = 10
### *** Comment 7 *** ###
### Enabling the Plugin NoSQL protocol for MySQL ###
big-tables
# the port number to bind to for read requests
loose_handlersocket_port = 6800
# the port number to bind to for write requests
loose_handlersocket_port_wr = 6900
# the number of worker threads for read requests
loose_handlersocket_threads = 16
# the number of worker threads for write requests
loose_handlersocket_threads_wr = 1
# *** Replication related settings ***
# Unique server identification number between 1 and 2^32-1. This value
# is required for both master and slave hosts. It defaults to 1 if
# "master-host" is not set, but will MySQL will not function as a master
# if it is omitted.
server-id = 1
# Replication Slave (comment out master section to use this)
# To configure this host as a replication slave, you can choose between
# two methods :
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
# the syntax is:
# CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
# MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
# where you replace <host>, <user>, <password> by quoted strings and
# <port> by the master's port number (3306 by default).
# Example:
#
# CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
# MASTER_USER='joe', MASTER_PASSWORD='secret';
# OR
#
# 2) Set the variables below. However, in case you choose this method, then
# start replication for the first time (even unsuccessfully, for example
# if you mistyped the password in master-password and the slave fails to
# connect), the slave will create a master.info file, and any later
# changes in this file to the variable values below will be ignored and
# overridden by the content of the master.info file, unless you shutdown
# the slave server, delete master.info and restart the slaver server.
# For that reason, you may want to leave the lines below untouched
# (commented) and instead use CHANGE MASTER TO (see above)
#
# required unique id between 2 and 2^32 - 1
# (and different from the master)
# defaults to 2 if master-host is set
# but will not function as a slave if omitted
# server-id = 2
#
# The replication master for this slave - required
# master-host = <hostname>
#
# The username the slave will use for authentication when connecting
# to the master - required
# master-user = <username>
#
# The password the slave will authenticate with when connecting to
# the master - required
# master-password = <password>
#
# The port the master is listening on.
# optional - defaults to 3306
# master-port = <port>
# Make the slave read-only. Only users with the SUPER privilege and the
# replication slave thread will be able to modify data on it. You can
# use this to ensure that no applications will accidently modify data on
# the slave instead of the master
# read_only
####################################
#*** MyISAM Specific options***
####################################
# 50 percent of RAM
#myisam_sort_buffer_size = 2560M
# MyISAM tables, you should still set it to 8-64M
#myisam_sort_buffer_size = 256M
#myisam_max_sort_file_size = 10G
#myisam_repair_threads = 1
# Automatically check and repair not properly closed MyISAM tables.
#myisam_recover
####################################
### *** Comment 8 *** ###
# *** INNODB Specific options ***
# Use this option if you have a MySQL server with InnoDB support enabled
# but you do not plan to use it. This will save memory and disk space
# and speed up some things.
# skip-innodb
innodb_data_home_dir = /var/lib/mysql/
#interactive_timeout = 600
#wait_timeout = 1200
innodb_data_file_path = ibdata1:1024M;ibdata2:1024M;ibdata3:1024M;ibdata4:1024M;ibdata5:1024M;ibdata6:1024M;ibdata7:1024M;ibdata8:1024M;ibdata9:1024M;ibdata10:50M:autoextend:max:2048M
innodb_log_group_home_dir = /var/lib/mysql/
### *** Comment 9 *** ### mysql 5.1.X not use
# innodb_log_arch_dir = /var/lib/mysql/
### *** Comment 10 *** ###
# might be limited to 75% - 80% of total system memory ,user level memory per process, so do not
# set it too high.
innodb_buffer_pool_size = 1G
#daemon_memcached_w_batch_size=1000
#daemon_memcached_r_batch_size=1
### *** Comment 11 *** ###
#innodb_doublewrite = 1
#skip-innodb-doublewrite
# writes from 20,000 writes/sec
innodb_doublewrite = 0
# value. SHOW INNODB STATUS will display the current amount used.
innodb_additional_mem_pool_size = 16M
# The size of the buffer InnoDB uses for buffering log data. As soon as
# it is full, InnoDB will have to flush it to disk. As it is flushed
# once per second anyway, it does not make sense to have it very large
# (even with long transactions).
innodb_log_buffer_size = 8M
# If set to 1, InnoDB will flush (fsync) the transaction logs to the
# disk at each commit, which offers full ACID behavior. If you are
# willing to compromise this safety, and you are running small
# transactions, you may set this to 0 or 2 to reduce disk I/O to the
# logs. Value 0 means that the log is only written to the log file and
# the log file flushed to disk approximately once per second. Value 2
# means the log is written to the log file at each commit, but the log
# file is only flushed to disk approximately once per second.
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 180
# There is results for workload as in previous post, 256 threads and with innodb_thread_concurrency=0,4,8,16,32,64
innodb_thread_concurrency = 8
innodb_sync_spin_loops = 100
#If 8 or more cpu cores, test with this 0, it can be a bottleneck, more likely at 16-32+
innodb_adaptive_hash_index = ON
innodb_checksums = 1
innodb_read_ahead = 0
#innodb_flush_method = O_DIRECT
innodb_locks_unsafe_for_binlog = 1
innodb_log_file_size = 128M
# Total number of files in the log group. A value of 2-3 is usually good
# enough.
innodb_log_files_in_group = 3
innodb_support_xa = 1
#recomment 20 and 90 set small enough so that crash recovery time is OK
innodb_max_dirty_pages_pct = 90
innodb_ibuf_max_size=120M
innodb_ibuf_active_contract=1
innodb_ibuf_accel_rate=200
# Number of IO threads to use for async IO operations. This value is
# hardcoded to 4 on Unix, but on Windows disk I/O may benefit from a
# larger number.
innodb_file_io_threads = 3
innodb_write_io_threads = 3
innodb_read_io_threads = 3
innodb_io_capacity = 20000
[mysqldump]
# Do not buffer the whole result set in memory before writing it to
# file. Required for dumping very large tables
quick
max_allowed_packet = 1280M
allow-keywords
[mysql]
no-auto-rehash
default-character-set=utf8
# Only allow UPDATEs and DELETEs that use keys.
#safe-updates
[myisamchk]
#key_buffer - 64M for 1GB, 128M for 2GB, 256M for 4GB
key_buffer_size = 512M
#sort_buffer - 64M for 1GB, 128M for 2GB, 256M for 4GB
sort_buffer_size = 512M
#read_buffer - 16M for 1GB, 32M for 2GB, 64M for 4GB
read_buffer = 64M
#write_buffer - 16M for 1GB, 32M for 2GB, 64M for 4GB
write_buffer = 64M
[mysqlhotcopy]
interactive-timeout
[safe_mysqld]
# to allow handlersocket to accept many concurrent
# connections, make open_files_limit as large as
# possible.
open_files_limit = 25600
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.