MySQL5.7 Parameter Optimization

https://www.cnblogs.com/zhjh256/p/9260636.html

the query_cache_size = 0
the query_cache_type = 0
innodb_undo_tablespaces = 16 (the command line contains first the time required to initialize MySQL)
innodb_undo_directory = (specific redo disk file system path)
the innodb_thread_concurrency = (the number of cpu + number of physical disks)
innodb_strict_mode = to true
TMPDIR = / tmp
the character_set_server = gbk or utf8mb4 (Most systems should default gbk, recommended for special requirements in the field. 8-level to UTF)
the autocommit = 0
innodb_buffer_pool_size = 60% -75% of physical memory
innodb_flush_method = O_DIRECT (if not using hardware RAID control or a use of a SAN, not set)
the innodb_flush_log_at_trx_commit (core transaction system is set to 1, the default is 1, 2 or other 0)
transaction-Isolation-= the READ COMMITTED
innodb_autoinc_lock_mode = 2
Skip-name-Resolve
Large-Pages (not seen in the test clearly benefited mainly the memory is not enough pressure, it is not currently recommended setting)
the Back-log = 500
InnoDB-File-Status = TRUE (recommended setting)
= Storage-Engine-default InnoDB
MEMLOCK = to true (for mysql dedicated server, it is recommended to disable swap, this parameter can not be provided at this time, on a shared server, if set, then when the memory is not enough, it can lead to Mysql because of insufficient memory unable to start)
innodb_fast_shutdown = 0
sync_binlog (core transaction system is set to 1, the default is 1, 2 or other 0)
log-bin = MySQL-bin
binlog_format (OLTP for the row, DSS system is mixed, If in doubt, use row)
binlog_checksum = NONE
binlog_row_image = Full (MariaDB no parameters, sets startup error)
the binlog_cache_size = 8M 
max_binlog_size = 500M 
max_binlog_cache_size = 100M
expire_logs_days =. 7
the innodb_log_file_size = 512M
InnoDB-log-Buffer-size = 8M
InnoDB-log-Files-in-Group = (3-5, depending on the amount of generated log may be)
innodb_log_group_home_dir = / usr / local / MySQL / redo (redo specific disk file system path)
innodb_flush_neighbors (default is 1, SSD is set to 0, Neighbors refers to the extent of a part of all pages, a extent of 64 pages, written order for the hard disk IO considerations, InnoDB usually refresh all pages in a extent, because there is no additional load on the SSD random IO, there is no need to enable the feature)
innodb_page_size (SSD to 4KB)
the innodb_data_home_dir = / usr / local / MySQL / data (dedicated data disk file system path)
# = ibdata1 the innodb_data_file_path: 2000M; ibdata2 : 10M: autoextend (special disk file system data path, the storage system table space is not recommended explicitly set, should otherwise, the size and the actual needs of the same size ibdata1)
innodb_change_buffer_max_size (InnoDB Change buffering to minimize the use of random IO, once the change buffer full, subsequent DMLs will be directly on the corresponding table changes, change buffer at a fixed frequency (5.5 can not be changed, whereby 5.6 parameter control, change buffer closer this value is, the more frequently the background, the amount of each combined innodb_io_capacity controlled by the (default is 200, Representative 10K RPM hard drive 5400 or 7200 RPM for a hard disk, can be set to 100, 100 may be executed on behalf of each IOPS (configurable size of each test, it should be said here is based on the size of 16KB, refer to http: / /elf8848.iteye.com/blog/1731301). for RAID or SSD, increase, be helpful, modern system should be adjusted)) the merger of the background process to the data page, writing and reading frequencies close to the system can be set 50, the default is 25, 25% represents the buffer pool sizes, please consult DBA)
innodb_lock_wait_timeout = 86400 (according to the actual situation)
default-tmp-Storage-Engine = the InnoDB
InnoDB-AUTOEXTEND-INCREMENT = 16M
InnoDB-Buffer-the pool-instances = min (. 8, nGB / 1GB)
InnoDB-File-IO-Threads = max (. 4, nGB / 4GB)
innodb_io_capacity = IOPS MySQL available for use (Oracle ORION recommended test)
InnoDB-per-File-to true = Table
innodb_rollback_on_timeout to true =
InnoDB-Old-Time-Blocks (hybrid system can be adjusted to 60,000 or higher, please consult DBA)
InnoDB-Print-to true All-Deadlocks =
InnoDB-the Sort-Buffer-size = (use this option to create an index, no set)
dynamically adjusts the sort-buffer-size (DSS statement level may , such as the SET a sTATEMENT sort_buffer_size = 100000 the FOR the SELECT name the FROM name the ORDER BY name;)
the Join-Buffer-size = (the DSS may statement-level dynamic adjustment)
Open-Files-limit = 32767
innodb_open_files = 32767
tmp-Table-size (the DSS may statements dynamic level adjustment)
SQL-MODE = the STRICT_TRANS_TABLES, the STRICT_ALL_TABLES, PIPES_AS_CONCAT, ONLY_FULL_GROUP_BY, NO_ENGINE_SUBSTITUTION, the ERROR_FOR_DIVISION_BY_ZERO, ANSI_QUOTES then, NO_UNSIGNED_SUBTRACTION, PAD_CHAR_TO_FULL_LENGTH, the NO_ZERO_DATE, the NO_ZERO_IN_DATE
log-Output = the FILE
SLOW-Query-log = to true
log-Queries-Not-the using-Indexes = to true (for mysql, it should set the parameters, specific look at the situation, there are many small tables may soon be making soon slow_query_log growth)
log_slow_filter
log_slow_sp_statements
log_slow_verbosity
innodb_show_verbose_locks = 1
innodb_print_lock_wait_timeout_info = ON
Server-the above mentioned id = 1
Port = 3306
read_rnd_buffer_size (DSS required statement dynamic adjustment level)
thread_handling-of-the pool = Threads
thread_pool_max_threads = 100
thread_pool_size = 50
the thread_cache_size 64 =
max-Connections = 3000
= the ON event_scheduler
#GTID 5.6 introduced primarily to address the current transaction to determine the progress of the main switching master node from the master node down mode (because of the different points of the log is not necessarily the same example, the format of the log GTID source_id + transaction id , it is possible to ensure consistent progress all logical transaction node, which makes the difficulty of switching greatly reduced).
gtid-mode = ON # (Group Replication requirements must be open GTID, MariaDB Without this parameter, after setting an error, but the default is to enable GTID, binlog difference GTID based https://www.percona.com/sites/default/ Files / presentations / Failover_GTID_MySQL_56_Fosdem.pdf
https://pdfs.semanticscholar.org/presentation/3036/b68bcb8bd2f4fed590fd85607e37bf511858.pdf)
log_slave_updates the oN = (GTID mode must begin log_slave_updates, have some impact on performance)
Enforce the oN-gtid-Consistency = (MariaDB Without this parameter, after setting an error, but the default is to enable GTID)
Relay-log-info-Repository = TABLE (MariaDB Without this parameter, after setting an error, but the default is to enable GTID)
Master-info-Repository = TABLE (MariaDB Without this parameter, after setting an error, but the default is GTID enabled)
slave_parallel_workers = 4 - turn-based multi-threaded replication library does not open by default 0 (MariaDB Without this parameter, after setting an error, but the default is to enable GTID)
innodb_lru_scan_depth (1024 default, this parameter controls how much page_cleaner threads scan the dirty LRU list page, writing for the nervous system, lower the value, even if the memory is too large; if IO sufficient capacity, increase the value; large-scale systems typically need to change this parameter)
innodb_use_global_flush_log_at_trx_commit = 0
userstat = ON
thread_statistics = ON

Guess you like

Origin www.cnblogs.com/suminem/p/10973936.html