标签:
#配置多实例声明
[mysqld_multi]
mysqld = /data/mysql_bin/bin/mysqld_safe
mysqladmin = /data/mysql_bin/bin/mysqladmin
user = user
password = 123456
[mysqld1]
#端口
port = 3306
user = mysql
#External-locking用于多进程条件下为MyISAM数据表进行锁定 跳过
skip-external-locking
character_set_server = utf8
#定时任务 日志库使用
event_scheduler = ON
#是否支持目录软连接
symbolic-links = 0
#这个选项可以配置MYISAM表允许在创建索引的过程中,能够往磁盘创建一个临时索引文件的大小
myisam_max_sort_file_size = 10G
#如果该值大于1,在Repair by sorting过程中并行创建MyISAM表索引(每个索引在自己的线程内)
myisam_repair_threads = 1
#自动检查和修复没有适当关闭的MyISAM表
myisam_recover
#连接时间 单位秒 10小时
wait_timeout = 36000
#交互式连接时间 单位秒
interactive_timeout = 1200
#每次交互最大传输量 128M
max_allowed_packet = 134217728
#慢查询日志 log库设置为2
long_query_time = 1
#文件目录
datadir=/data/mysql_data/mysql1
basedir=/data/mysql_bin
socket=/tmp/mysql.sock1
#指定一个日志输出文件,如果文件存在则在文件末尾处添加日志信息
#log=/data/mysql_logs/logs1/mysqld.log
pid-file=/data/mysql_data/mysql1/db-app1.pid
#慢查询日志
log-slow-queries=/data/mysql_logs/logs1/slowquery.log
#binlog地址
log-bin=/data/mysql_data/mysql1/app-net1_1-bin
tmpdir=/data/mysql_data/mysql1/tmp
#设置每个主机的连接请求异常中断的最大次数,当超过该次数,MYSQL服务器将禁止host的连接请求,直到mysql服务器重启或通过flush hosts命令清空此host的相关信息
max_connect_errors = 10000000
##binlog配置
#主从配置
server-id = 1
#2进制模式
binlog_format = MIXED
#文件大小
max_binlog_size = 1G
#过期时间
expire_logs_days = 1
#忽略的库
replicate-ignore-db = mysql
replicate-ignore-db = information_schema
#内存相关
#允许的连接数
max_connections = 500
#缓存表描述的数量
table_cache = 2048
#未生效 mysql5.6才有该值
table_open_cache = 4096
#要缓存的线程数量
thread_cache_size = 300
#并发数量 核心数x2
thread_concurrency = 32
##全局
#mysql查询缓存
query_cache_size= 1024M
#临时表,超出几率千分比 实例2平均值稍微超出5
tmp_table_size = 256M
#key_buffer_size 只对MyISAM表起作用
key_buffer_size = 1024M
##线程
#默认值128M,
#innodb_buffer_pool_size = 256M
#binlog_cache_size 默认32K. 服务器1大小
#binlog 能够使用的最大cache 内存大小
max_binlog_cache_size = 64M
#MySql读入缓冲区大小 默认值2M 优化为4M
read_buffer_size = 8M
# 随机读取数据缓冲区使用内存 默认值8M 优化为32M
read_rnd_buffer_size = 128M
#排序缓存 默认值2M 优化为4M
sort_buffer_size = 8M
#联合查询 1M
join_buffer_size = 1048576
#设置、恢复、修改表的时候使用的缓冲大小
myisam_sort_buffer_size = 512M
#批量插入 默认值8M
bulk_insert_buffer_size = 8388608
[mysqld2]
port = 3307
user = mysql
skip-external-locking
character_set_server = utf8
symbolic-links = 0
myisam_max_sort_file_size = 10G
myisam_repair_threads =1
myisam_recover
wait_timeout = 36000
interactive_timeout = 1200
max_allowed_packet = 134217728
long_query_time = 1
datadir=/data/mysql_data/mysql2
basedir=/data/mysql_bin
socket=/tmp/mysql.sock2
#log=/data/mysql_logs/logs2/mysqld.log
pid-file=/data/mysql_data/mysql2/db-app2.pid
log-slow-queries=/data/mysql_logs/logs2/slowquery.log
log-bin=/data/mysql_data/mysql2/app-net1_2-bin
tmpdir=/data/mysql_data/mysql2/tmp
max_connect_errors = 10000000
server-id = 2
binlog_format = MIXED
max_binlog_size = 1G
expire_logs_days = 1
replicate-ignore-db = mysql
replicate-ignore-db = test
replicate-ignore-db = information_schema
max_connections = 2400
table_cache = 2048
table_open_cache = 4096
thread_cache_size = 300
thread_concurrency = 32
query_cache_size= 1024M
tmp_table_size = 256M
key_buffer_size = 1024M
max_binlog_cache_size = 64M
read_buffer_size = 32M
read_rnd_buffer_size = 128M
sort_buffer_size = 24M
join_buffer_size = 24M
myisam_sort_buffer_size = 512M
bulk_insert_buffer_size=8388608
#只读模式
read-only=1
#清除
relay-log-purge=1
[mysqldump]
quick
#优化为64M
max_allowed_packet = 32M
[mysql]
#自动补全功能
no-auto-rehash
[myisamchk]
#优化128M
key_buffer_size = 256M
#优化128M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
标签:
原文地址:http://www.cnblogs.com/Aike/p/5946806.html