[client] #password = [your_password] port = 3306 socket = /opt/mysql/tmp/mysql.sock # *** Application-specific options follow here *** # # The MySQL server # [mysqld] # *** generic configuration options *** port = 3306 socket = /opt/mysql/tmp/mysql.sock pid-file = /opt/mysql/var/mysqld.pid user = mysql basedir = /opt/mysql datadir = /opt/mysql/var skip-name-resolve default-time-zone='+08:00' default_authentication_plugin=mysql_native_password character-set-server = utf8mb4 open_files_limit = 65535 back_log = 1024 max_connections = 2000 max_connect_errors = 100000 table_open_cache = 2048 table_definition_cache = 2048 table_open_cache_instances = 8 lower_case_table_names = 1 thread_stack = 512K external-locking = FALSE max_allowed_packet = 32M sort_buffer_size = 16M join_buffer_size = 16M thread_cache_size = 512 interactive_timeout = 7200 wait_timeout = 7200 tmp_table_size = 96M max_heap_table_size = 96M slow_query_log = 1 slow_query_log_file = /opt/mysql/var/slow.log log-error = /opt/mysql/var/error.log long_query_time = 3 log_queries_not_using_indexes = 0 min_examined_row_limit = 1000 log_slow_admin_statements = 1 log_slow_slave_statements = 1 log_timestamps=SYSTEM server-id = 1 log-bin = mysql-bin #relay-log = /opt/mysql/var/relay-log sync_binlog = 1 binlog_cache_size = 4M #binlog-ignore-db = mysql,information_schema max_binlog_cache_size = 2G max_binlog_size = 1G binlog_expire_logs_seconds = 2592000 master_info_repository = TABLE relay_log_info_repository = TABLE gtid_mode = on enforce_gtid_consistency = 1 log_slave_updates slave-rows-search-algorithms = 'INDEX_SCAN,HASH_SCAN' binlog_format = row binlog_checksum = CRC32 relay_log_recovery = 1 relay-log-purge = 1 key_buffer_size = 32M read_buffer_size = 8M read_rnd_buffer_size = 16M bulk_insert_buffer_size = 64M myisam_sort_buffer_size = 128M myisam_max_sort_file_size = 10G lock_wait_timeout = 3600 explicit_defaults_for_timestamp = 1 innodb_thread_concurrency = 0 innodb_sync_spin_loops = 100 innodb_spin_wait_delay = 30 transaction_isolation = REPEATABLE-READ #innodb_additional_mem_pool_size = 16M innodb_buffer_pool_size = 12G innodb_buffer_pool_instances = 4 innodb_buffer_pool_load_at_startup = 1 innodb_buffer_pool_dump_at_shutdown = 1 #innodb_data_file_path = ibdata1:1G:autoextend innodb_flush_log_at_trx_commit = 1 innodb_log_buffer_size = 32M innodb_redo_log_capacity = 4294967296 innodb_max_undo_log_size = 2G #innodb_undo_directory = undolog #innodb_undo_tablespaces = 95 # 根据您的服务器IOPS能力适当调整 innodb_io_capacity = 4000 innodb_io_capacity_max = 8000 innodb_flush_neighbors = 0 innodb_write_io_threads = 4 innodb_read_io_threads = 4 innodb_purge_threads = 4 innodb_page_cleaners = 4 innodb_open_files = 65535 innodb_max_dirty_pages_pct = 50 innodb_flush_method = O_DIRECT innodb_lru_scan_depth = 4000 innodb_checksum_algorithm = crc32 innodb_lock_wait_timeout = 10 innodb_rollback_on_timeout = 1 innodb_print_all_deadlocks = 1 innodb_file_per_table = 1 innodb_online_alter_log_max_size = 4G innodb_stats_on_metadata = 0 [mysqldump] quick max_allowed_packet = 32M