MySQL最优配置模板( 5.6&5.7转)
[client]
user = root --用户
password = 1111aaA_ -- 密码 [mysql]
prompt = [\\u@\\p][\\d]>\\_ -- cmd控制台前显示: node1 [localhost] {sa} (mysql) 而不是就是 mysql>
no-auto-rehash --开启命令自动补全功能 [mysqld_safe]
malloc-lib=tcmalloc --合适的内存分配算法tcmalloc,是谷歌提供的内存分配管理模块 [mysqldump]
single-transaction [mysqld]
# basic settings #
user = mysql
sql_mode = "STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER"
autocommit = 1 --自动提交事务
server-id = 8888 --服务器ID
character_set_server=utf8mb4 --服务器数据库的字符集合
datadir=/mysql_data/data --数据目录
transaction_isolation = READ-COMMITTED --数据库隔离级别 ,已提交读
explicit_defaults_for_timestamp = 1 --
max_allowed_packet = 64M --最大控制其通信缓冲区的server接受的数据包大小(lob字段)
event_scheduler = 1 --开启事件调度 # connection #
interactive_timeout = 1800
wait_timeout = 1800
lock_wait_timeout = 1800
skip_name_resolve = 1
max_connections = 1024
max_user_connections = 256
max_connect_errors = 1000000 # table cache performance settings
table_open_cache = 4096
table_definition_cache = 4096
table_open_cache_instances = 64 # session memory settings #
read_buffer_size = 16M
read_rnd_buffer_size = 32M
sort_buffer_size = 32M
tmp_table_size = 64M
join_buffer_size = 128M
thread_cache_size = 64 # log settings #
log_error = error.log
log_bin = binlog
log_error_verbosity = 2
general_log_file = general.log
slow_query_log = 1 --开启慢sql日志
slow_query_log_file = slow.log --慢日志文件名
log_queries_not_using_indexes = 1
log_slow_admin_statements = 1
log_slow_slave_statements = 1
log_throttle_queries_not_using_indexes = 10
expire_logs_days = 90 --日志过期天数
long_query_time = 2 --超过2秒的慢sql记录
min_examined_row_limit = 100
log-bin-trust-function-creators = 1
log-slave-updates = 1 --从库产生binlog日志,从库就可以做主库 # innodb settings #
innodb_page_size = 16384
innodb_buffer_pool_size = 160G
innodb_buffer_pool_instances = 16
innodb_buffer_pool_load_at_startup = 1
innodb_buffer_pool_dump_at_shutdown = 1
innodb_lru_scan_depth = 4096
innodb_lock_wait_timeout = 5
innodb_io_capacity = 10000
innodb_io_capacity_max = 20000
innodb_flush_method = O_DIRECT
innodb_undo_logs = 128
innodb_undo_tablespaces = 3
innodb_flush_neighbors = 0
innodb_log_file_size = 16G
innodb_log_files_in_group = 2
innodb_log_buffer_size = 64M
innodb_purge_threads = 4
innodb_large_prefix = 1
innodb_thread_concurrency = 64
innodb_print_all_deadlocks = 1
innodb_strict_mode = 1
innodb_sort_buffer_size = 128M
innodb_write_io_threads = 16
innodb_read_io_threads = 16
innodb_file_per_table = 1
innodb_stats_persistent_sample_pages = 64
innodb_autoinc_lock_mode = 2
innodb_online_alter_log_max_size=1G
innodb_open_files=4096 # replication settings #
master_info_repository = TABLE --master_info存放到数据库表里
relay_log_info_repository = TABLE --relay_log_info存放到数据库表里
sync_binlog = 1 --异步日志提交
gtid_mode = on
enforce_gtid_consistency = 1
log_slave_updates
binlog_format = ROW --binlog使用row模式
binlog_rows_query_log_events = 1
relay_log = relay.log
relay_log_recovery = 1 --relay_log出错或者中断,重新从master服务器抽取
slave_skip_errors = ddl_exist_errors
slave-rows-search-algorithms = 'INDEX_SCAN,HASH_SCAN' # semi sync replication settings #
plugin-load = "group_replication.so;validate_password.so;semisync_master.so;semisync_slave.so"
loose_rpl_semi_sync_master_enabled = 1
loose_rpl_semi_sync_master_timeout = 3000
loose_rpl_semi_sync_slave_enabled = 1 # password plugin #
validate_password_policy = STRONG
validate-password = FORCE_PLUS_PERMANENT # perforamnce_schema settings
performance-schema-instrument='memory/%=COUNTED'
performance_schema_digests_size = 40000
performance_schema_max_table_instances = 40000
performance_schema_max_sql_text_length = 4096
performance_schema_max_digest_length = 4096 [mysqld-5.6]
# metalock performance settings
metadata_locks_hash_instances = 64 [mysqld-5.7]
# new innodb settings #
loose_innodb_numa_interleave = 1
innodb_buffer_pool_dump_pct = 40
innodb_page_cleaners = 16
innodb_undo_log_truncate = 1
innodb_max_undo_log_size = 2G
innodb_purge_rseg_truncate_frequency = 128 # new replication settings #
slave-parallel-type = LOGICAL_CLOCK --开启组提交
slave-parallel-workers = 16 --组提交线程数16个
slave_preserve_commit_order = 1
slave_transaction_retries = 128
# other change settings #
binlog_gtid_simple_recovery = 1
log_timestamps = system
show_compatibility_56 = on # group replication settings
plugin-load = "group_replication.so;validate_password.so;semisync_master.so;semisync_slave.so"
transaction-write-set-extraction = XXHASH64 # report_host = 127.0.0.1 # optional for group replication
# binlog_checksum = NONE # only for group replication
loose_group_replication = FORCE_PLUS_PERMANENT
loose_group_replication_group_name = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
loose_group_replication_compression_threshold = 100
loose_group_replication_flow_control_mode = 0
loose_group_replication_single_primary_mode = 0
loose_group_replication_enforce_update_everywhere_checks = 1
loose_group_replication_transaction_size_limit = 10485760
loose_group_replication_unreachable_majority_timeout = 120
loose_group_replication_start_on_boot = 0
MySQL最优配置模板( 5.6&5.7转)的更多相关文章
- MySQL最优配置模板( 5.6&5.7)(运维那点事)
MySQL 5.6&5.7配置文件(姜总提供) [mysql] default-character-set=utf8mb4 user = root password = 123456 port ...
- MySQL最优配置文件模板·2016-11-28
小伙伴们大爱的MySQL最优配置文件模板更新啦.对之前的MySQL最优配置文件·20160901做了一些修正,更为名至实归.可以通过此链接进行下载.当然,更欢迎同学们提出意见和建议,共同打造一个最优M ...
- MySQL 5.6 & 5.7最优配置模板
摘自:http://mp.weixin.qq.com/s?__biz=MjM5MjIxNDA4NA==&mid=207854835&idx=1&sn=c998031ae6816 ...
- MySQL监控模板说明-Percona MySQL Monitoring Template for Cacti
http://blog.chinaunix.net/uid-16844903-id-3535535.html https://www.percona.com/doc/percona-monitorin ...
- zabbix使用percona的mysql监控模板监控
安装第三方插件仓库源: [root@iZ9j3yrx43sb5sZ ~]# yum install https://www.percona.com/redir/downloads/percona-re ...
- 【转载】mysql配置模板(my-*.cnf)参数详细说明
原文:https://yq.aliyun.com/ziliao/142086 mysql 性能优化分享,好文章: http://www.jb51.net/article/28363.htm mysql ...
- mysql使用模板解决旧数据处理,默认初始化数据的通用方法!
一 业务介绍 先来看看我这得大致业务需求,这次业务比较简单: 即从现在开始,每次new一个爷爷都需要默认初始化给这个爷爷三个儿子(子表,爷爷id去关联),并在初始化每个儿子的同时再给每个儿子初始化若干 ...
- Zabbix MySQL监控模板添加
zabbix自带的mysql监控指标很少,所以需要新增一些监控项 1.下载知数堂维护的percona-monitoring-plugin-zabbix代码 # cd /opt # wget https ...
- MySql配置文件模板
写在开篇: 这个mysql得配置文件my.cnf,是我现在环境里常用得,包含基础配置及一些优化,本来一直在我得有道笔记里记录着,之前一直没有写博客的习惯,最近刚开始注册博客,就将这些东西 ...
随机推荐
- pythonCharm 破解
操作步骤和IDEA是一样的 只是jar 包不一样 //激活拷贝-javaagent:E:\PythonCharm\PyCharm Community Edition 2017.3.4\bin\Jetb ...
- 轮滑基础(一)(前摔,葫芦步,推步,A字转弯,弓步转弯)
轮滑新手入门推荐? [柚子陪你学轮滑轮滑教学]第一集 轮滑安全 1,站: 站立:脚可以成v字,或者平行,手放膝盖或者前伸.平行站立 膝盖相距一拳头左右,两腿间距略小于肩宽.膝盖略弯,腰下压,抬头挺胸 ...
- d4
# s = '132a4b5c'# s1 = s[0]+s[2]+s[1]# print(s1)#使用while和for循环分别打印字符串s=’asdfer’中每个元素.s = 'fkld'# for ...
- 洛谷P1908 逆序对【递归】
题目:https://www.luogu.org/problemnew/show/P1908 题意:给定一个数组,求逆序对个数. 思路: 是一个很经典的题目了.通过归并排序可以求逆序对个数. 现在有一 ...
- [No0000C8]英特尔快速存储IRST要不要装
IRST (英特尔快速存储技术)Intel Rapid Storage Technology(简称IRST)又称英特尔快速存储技术. Intel Rapid Start Technolog同样是简称( ...
- hdu6397 Character Encoding 母函数解约束条件下多重集
http://acm.hdu.edu.cn/showproblem.php?pid=6397 原问题的本质是问m个元素的多重集S,每一种类型的对象至多出现n-1次的S的k组合的个数是多少? 等价于 x ...
- Django:模型model和数据库mysql(一)
以一个栗子尝试来记录: 两个表存储在数据库中,BookInfo表示书,HeroInfo表示人物.一本书中有多个人物 在MySQL中新建一个数据库Django1,不用创建表,用Django模型来配置数据 ...
- Exception 01 : org.hibernate.engine.jndi.JndiException: Error parsing JNDI name [foo]
异常名称 org.hibernate.engine.jndi.JndiException: Error parsing JNDI name [foo] 异常截屏 异常详细信息 org.hibernat ...
- 用NFS挂载root出现:NFS: failed to create MNT RPC client, status=-101(-110)
2014-02-18 08:06:17 By Ly #Linux 阅读(78) 评论(0) 错误信息如下: Root-NFS: nfsroot=/home/zenki/nfs/rootfs NFS ...
- 单调性 [1 + 1 / (n)]^n
def f(n): n += 0.0 s = 1 + 1 / (n) r = pow(s, n) print(n, ',', r) return r l = []for i in range(1, 1 ...