1 如下为128G内存32线程处理器的mariadb配置参数优化:

[client]
#password= your_password
port= 3306
socket= /tmp/mysql.sock
!includedir /opt/local/mysql/wsrep
# The MySQL server
[mysqld]
port= 3306
socket= /tmp/mysql.sock
basedir = /opt/local/mysql
datadir=/opt/local/mysql/data #数据库存放目录
relay-log=/opt/local/mysql/relaylog/s74-relay-bin
pid-file = /opt/local/mysql/mysql.pid
log-error = /opt/local/mysql/logs/mysqld.log
open_files_limit = 65535 #
#skip-locking
skip-external-locking #跳过外部锁定
back_log=3000 #暂存的连接数量
skip-name-resolve #关闭mysql的dns反查功能
memlock #将mysqld 进程锁定在内存中
lower_case_table_names = 1
#query_response_time_stats=1
#core-file
#core-file-size = unlimited
query_cache_type=1 #查询缓存 (0 = off、1 = on、2 = demand)
performance_schema=0 #收集数据库服务器性能参数
net_read_timeout=3600 #连接繁忙阶段(query)起作用
net_write_timeout=3600 #连接繁忙阶段(query)起作用
key_buffer_size = 32M #设置索引块缓存大小
max_allowed_packet = 128M #通信缓冲大小
table_open_cache = 1024 #table高速缓存的数量
sort_buffer_size = 12M #每个connection(session)第一次需要使用这个buffer的时候,一次性分配设置的内存
read_buffer_size = 8M #顺序读取数据缓冲区使用内存
#sort_buffer_size = 32M
#read_buffer_size = 32M
read_rnd_buffer_size = 32M #随机读取数据缓冲区使用内存
myisam_sort_buffer_size = 32M #MyISAM表发生变化时重新排序所需的缓冲
thread_cache_size = 120 #重新利用保存在缓存中线程的数量
query_cache_size = 64M
join_buffer_size = 8M #Join操作使用内存
bulk_insert_buffer_size = 32M #批量插入数据缓存大小
delay_key_write=ON #在表关闭之前,将对表的update操作指跟新数据到磁盘,而不更新索引到磁盘,把对索引的更改记录在内存。这样MyISAM表可以使索引更新更快。在关闭表的时候一起更新索引到磁盘
delayed_insert_limit=4000
delayed_insert_timeout=600
delayed_queue_size=4000
# Try number of CPU's*2 for thread_concurrency
# The variable only affects Solaris!
thread_concurrency = 64 #CPU核数 * 2
max_connections=1500 #最大连接(用户)数。每个连接MySQL的用户均算作一个连接
max_connect_errors=30 #最大失败连接限制
interactive_timeout=600 #服务器关闭交互式连接前等待活动的秒数
wait_timeout=3600 #服务器关闭非交互连接之前等待活动的秒数
slow_query_log #慢查询记录日志
long_query_time = 0.1 #慢查询记录时间 0.1秒
slow_query_log_file=/opt/local/mysql/logs/slow_query.log #慢查询日志路径
#log_slow_verbosity=full
log_slow_verbosity=query_plan #
# Replication Master Server (default)
# binary logging is required for replication
log-bin=/opt/local/mysql/binlog/mysql-bin #binlog 名称
log-slave-updates #从master取得并执行的二进制日志写入自己的二进制日志文件中
replicate-ignore-db=mysql #不同步的表
# binary logging format - mixed recommended
binlog_format=row #binlog 格式 分别为 row=行格式 丶 mixed=混合格式 丶 STATEMENT=SQL语句复制模式
event_scheduler=1 #计划任务 事件调度器
# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id= 1 #
# Point the following paths to different dedicated disks
#tmpdir= /tmp/
#log-update = /path-to-dedicated-directory/hostname
# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /data/mysql-5.1.48/mysql-data/
#innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend
#innodb_log_group_home_dir = /data/mysql-5.1.48/mysql-data/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
innodb_file_format=barracuda
innodb_file_format_max=barracuda
innodb_file_per_table=1
innodb_fast_shutdown=0
innodb_buffer_pool_size = 90000M
innodb_buffer_pool_instances = 4
#innodb_additional_mem_pool_size = 20M
#innodb_use_sys_malloc = 20M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 512M
#innodb_log_buffer_size = 8M
innodb_log_files_in_group = 3
innodb_flush_log_at_trx_commit = 2
innodb_lock_wait_timeout = 3
innodb_rollback_on_timeout = on
innodb_flush_method=O_DIRECT
transaction-isolation=READ-COMMITTED
innodb_thread_concurrency=0
innodb_io_capacity=800
innodb_purge_threads=1
innodb_open_files=65535
#innodb_stats_update_need_lock=0
#innodb_flush_neighbor_pages=0
#innodb_aio_pending_ios_per_thread=256
#for binlog_format=row
innodb_autoinc_lock_mode=2
#innodb_fast_checksum = 1
innodb_read_io_threads = 8
innodb_write_io_threads = 12
innodb_stats_on_metadata = 0
#使用线程池处理连接
thread_handling=pool-of-threads
thread_pool_oversubscribe=30
thread_pool_size=64
thread_pool_idle_timeout=7200
thread_pool_max_threads=2000
#查询优化器开关
#optimizer_switch='index_condition_pushdown=on'
#optimizer_switch='mrr=on'
#optimizer_switch='mrr_sort_keys=on'
#optimizer_switch='mrr_cost_based=off'
#mrr_buffer_size=32M
#optimizer_switch='join_cache_incremental=on'
#optimizer_switch='join_cache_hashed=on'
#optimizer_switch='join_cache_bka=on'
#join_cache_level=4
#join_buffer_size=32M
#join_buffer_space_limit=32M
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
[myisamchk]
key_buffer_size = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M
[isamchk]
key_buffer_size = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout

2 如下为256G内存64线程处理器的mariadb配置参数优化:

[client]
#password= your_password
port= 3306
socket= /tmp/mysql.sock
!includedir /opt/local/mysql/wsrep
# The MySQL server
[mysqld]
port= 3306
socket= /tmp/mysql.sock
basedir = /opt/local/mysql
datadir=/opt/local/mysql/data #数据库存放目录
relay-log=/opt/local/mysql/relaylog/s74-relay-bin
pid-file = /opt/local/mysql/mysql.pid
log-error = /opt/local/mysql/logs/mysqld.log
open_files_limit = 65535 #
#skip-locking
skip-external-locking #跳过外部锁定
back_log=3000 #暂存的连接数量
skip-name-resolve #关闭mysql的dns反查功能
memlock #将mysqld 进程锁定在内存中
lower_case_table_names = 1
#query_response_time_stats=1
#core-file
#core-file-size = unlimited
query_cache_type=1 #查询缓存 (0 = off、1 = on、2 = demand)
performance_schema=0 #收集数据库服务器性能参数
net_read_timeout=3600 #连接繁忙阶段(query)起作用
net_write_timeout=3600 #连接繁忙阶段(query)起作用
key_buffer_size = 32M #设置索引块缓存大小
max_allowed_packet = 128M #通信缓冲大小
table_open_cache = 1024 #table高速缓存的数量
sort_buffer_size = 12M #每个connection(session)第一次需要使用这个buffer的时候,一次性分配设置的内存
read_buffer_size = 8M #顺序读取数据缓冲区使用内存
#sort_buffer_size = 32M
#read_buffer_size = 32M
read_rnd_buffer_size = 32M #随机读取数据缓冲区使用内存
myisam_sort_buffer_size = 32M #MyISAM表发生变化时重新排序所需的缓冲
thread_cache_size = 120 #重新利用保存在缓存中线程的数量
query_cache_size = 64M
join_buffer_size = 8M #Join操作使用内存
bulk_insert_buffer_size = 32M #批量插入数据缓存大小
delay_key_write=ON #在表关闭之前,将对表的update操作指跟新数据到磁盘,而不更新索引到磁盘,把对索引的更改记录在内存。这样MyISAM表可以使索引更新更快。在关闭表的时候一起更新索引到磁盘
delayed_insert_limit=4000
delayed_insert_timeout=600
delayed_queue_size=4000
# Try number of CPU's*2 for thread_concurrency
# The variable only affects Solaris!
thread_concurrency = 96 #CPU核数 * 2
max_connections=1500 #最大连接(用户)数。每个连接MySQL的用户均算作一个连接
max_connect_errors=30 #最大失败连接限制
interactive_timeout=600 #服务器关闭交互式连接前等待活动的秒数
wait_timeout=3600 #服务器关闭非交互连接之前等待活动的秒数
slow_query_log #慢查询记录日志
long_query_time = 0.1 #慢查询记录时间 0.1秒
slow_query_log_file=/opt/local/mysql/logs/slow_query.log #慢查询日志路径
#log_slow_verbosity=full
log_slow_verbosity=query_plan #
# Replication Master Server (default)
# binary logging is required for replication
log-bin=/opt/local/mysql/binlog/mysql-bin #binlog 名称
log-slave-updates #从master取得并执行的二进制日志写入自己的二进制日志文件中
replicate-ignore-db=mysql #不同步的表
# binary logging format - mixed recommended
binlog_format=row #binlog 格式 分别为 row=行格式 丶 mixed=混合格式 丶 STATEMENT=SQL语句复制模式
event_scheduler=1 #计划任务 事件调度器
# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id= 1 #
# Point the following paths to different dedicated disks
#tmpdir= /tmp/
#log-update = /path-to-dedicated-directory/hostname
# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /data/mysql-5.1.48/mysql-data/
#innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend
#innodb_log_group_home_dir = /data/mysql-5.1.48/mysql-data/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
innodb_file_format=barracuda
innodb_file_format_max=barracuda
innodb_file_per_table=1
innodb_fast_shutdown=0
innodb_buffer_pool_size = 180000M
innodb_buffer_pool_instances = 4
#innodb_additional_mem_pool_size = 20M
#innodb_use_sys_malloc = 20M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 512M
#innodb_log_buffer_size = 8M
innodb_log_files_in_group = 3
innodb_flush_log_at_trx_commit = 2
innodb_lock_wait_timeout = 3
innodb_rollback_on_timeout = on
innodb_flush_method=O_DIRECT
transaction-isolation=READ-COMMITTED
innodb_thread_concurrency=0
innodb_io_capacity=800
innodb_purge_threads=1
innodb_open_files=65535
#innodb_stats_update_need_lock=0
#innodb_flush_neighbor_pages=0
#innodb_aio_pending_ios_per_thread=256
#for binlog_format=row
innodb_autoinc_lock_mode=2
#innodb_fast_checksum = 1
innodb_read_io_threads = 8
innodb_write_io_threads = 12
innodb_stats_on_metadata = 0
#使用线程池处理连接
thread_handling=pool-of-threads
thread_pool_oversubscribe=30
thread_pool_size=64
thread_pool_idle_timeout=7200
thread_pool_max_threads=2000
#查询优化器开关
#optimizer_switch='index_condition_pushdown=on'
#optimizer_switch='mrr=on'
#optimizer_switch='mrr_sort_keys=on'
#optimizer_switch='mrr_cost_based=off'
#mrr_buffer_size=32M
#optimizer_switch='join_cache_incremental=on'
#optimizer_switch='join_cache_hashed=on'
#optimizer_switch='join_cache_bka=on'
#join_cache_level=4
#join_buffer_size=32M
#join_buffer_space_limit=32M
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
[myisamchk]
key_buffer_size = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M
[isamchk]
key_buffer_size = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout

mysql优化参数 (汇总)的更多相关文章

  1. 互联网金融MySQL优化参数标准

    InnoDB配置 从MySQL 5.5版本开始,InnoDB就是默认的存储引擎并且它比任何其它存储引擎的使用要多得多.那也是为什么它需要小心配置的原因. innodb_file_per_table 表 ...

  2. mysql优化参数thread_cache_size

    thread_cache_size功能在mysql数据库配置文件中是非常重要的一项功能了,如果对thread_cache_size优化做得好我们可以让服务器跑得非常快,设置不好就会发现很小访问量就非常 ...

  3. mysql优化问题汇总

    sql优化-->分区-->分表-->垂直分库-->水平分库-->读写分离 分区 关于分区的博客推荐这个:https://blog.csdn.net/youzhouliu/ ...

  4. MySQL优化#参数配置优化

    ( 1).查看mysql里的线程,观察是否有长期运行或阻塞的sql: show full processlist 经查看,没有发现相关线程,可排除该原因 (2).疑似mysql连接使用完成后没有真正释 ...

  5. (转)MySQL配置文件mysql.ini参数详解、MySQL性能优化

    本文转自:http://www.cr173.com/html/18331_1.html my.ini(Linux系统下是my.cnf),当mysql服务器启动时它会读取这个文件,设置相关的运行环境参数 ...

  6. MySQL配置文件mysql.ini参数详解、MySQL性能优化

    my.ini(Linux系统下是my.cnf),当mysql服务器启动时它会读取这个文件,设置相关的运行环境参数. my.ini分为两块:Client Section和Server Section.  ...

  7. MySQL优化二 缓存参数优化

    数据库属于 IO密集型的应用程序,其主要职责就是数据的管理及存储工作.而我们知道,从内存中读取一个数据库的时间是微秒级别,而从一块普通硬盘上读取一个IO是在毫秒级别,二者相差3个数量级.所以,要优化数 ...

  8. MySQL缓存参数优化(转)

    MySQL 数据库性能优化之缓存参数优化 数据库属于 IO 密集型的应用程序,其主要职责就是数据的管理及存储工作.而我们知道,从内存中读取一个数据库的时间是微秒级别,而从一块普通硬盘上读取一个IO是在 ...

  9. Mysql优化系列(1)--Innodb重要参数优化

    1.简单介绍InnoDB给MySQL提供了具有提交,回滚和崩溃恢复能力的事务安全(ACID兼容)存储引擎.InnoDB锁定在行级并且也在SELECT语句提供一个Oracle风格一致的非锁定读.这些特色 ...

随机推荐

  1. 【AGC035D】Add and Remove(脑洞 DP 分治)

    题目链接 大意 给出\(N\)个数的序列,每次操作可以选择连续的三个数,将中间的那个数抽出,将另外两个数的数值加上中间那个数的数值. 一直执行以上操作直到只剩最后两个数,求最后两个数的所有可能的和的最 ...

  2. 程序员的情人节「GitHub 热点速览 v.22.07」

    又是一年情人日,刚好还是发文的今天.也没什么好送的,送点程序员的浪漫--代码和开源项目吧.记得在本周特推查收这份来自程序员的独有浪漫. 本周 GitHub 霸榜的项目基本上都是老项目,从老项目中挖点新 ...

  3. Pandas中Series与Dataframe的初始化

    (一)Series初始化 1.通过列表,index自动生成 se = pd.Series(['Tom', 'Nancy', 'Jack', 'Tony']) print(se) 2.通过列表,指定in ...

  4. CopyOnWriteList揭秘

    List的并发容器-CopyOnWriteList Vector和SynchronizedList ArrayList是用来代替Vector,Vector是线程安全的容器,因为它在方法上都加上了syn ...

  5. 04.python语法入门--基本数据类型

    # python是一门解释型的.强类型的.动态语言​​# 一:数字类型# 1.1 整型int:记录人的年龄.等级.号码.个数# age = 18# print(type(age))​# 1.2 浮点数 ...

  6. 操作系统发展史 & 进程

    今日内容 UDP协议 操作系统发展史 进程 单核情况下的进程调度 进程三状态图 同步异步 阻塞非阻塞 内容详细 一.UDP协议 1.什么是UDP协议 UDP是传输层的协议,功能即为在IP的数据报服务之 ...

  7. vue methods中的函数调用时带括号与不带括号的区别

    @click='getList(id)',但是为什么有时候明明没有传参的需要,却要加上()呢? 百思不得其解,于是去查阅了相关的资料,意思就是,当不加括号直接调用这个函数是可以直接获取到这个事件对象的 ...

  8. MySQL explain结果Extra中"Using Index"与"Using where; Using index"区别探究

    问题背景 最近用explain命令分析查询sql执行计划,时而能看到Extra中显示为"Using index"或者"Using where; Using Index&q ...

  9. ensp上防火墙上配置nat

    博文大纲:一.华为防火墙NAT的六个分类:二.解决NAT转换时的环路及无效ARP:三.server-map表的作用:四.NAT对报文的处理流程:五.各种常用NAT的配置方法: 一.华为防火墙NAT的六 ...

  10. 【C# 线程】数据槽 LocalDataStoreSlot简称DataSlot

    背景 为了确保在线程中声明特定类型的变量,在每个线程中的值都是唯一的,不受到其他线程对该变量读写的影响.也就是俗称的线程本地存储 (TLS),可用于存储对线程和应用程序域唯一的数据. 例如:主线程中声 ...