Mysql相关配置:
a、mysql版本:
percona-custom-5.1.57-12.8 采用icc编译。
b、mysql配置文件新增:
my.cnf在原有的增加percona,xtradb相关配置
# New
innodb_support_xa = OFF
transaction_isolation = READ-COMMITTED
# innodb plugin
innodb_read_io_threads = 1
innodb_write_io_threads = 16
innodb_io_capacity = 40000
innodb_file_format = barracuda
innodb_file_format_check = ON
innodb_strict_mode = 1
# Percona
innodb_page_size = 4K |4k ssd or 8k sas |16k 大字段,压缩表或者全表扫描应用。
innodb_extra_rsegments = 32 (根据并发情况可调整至64)
innodb_use_purge_thread = 8
innodb_stats_update_need_lock = 0
innodb_fast_checksum = 1
# percona For SSD
innodb_adaptive_checkpoint = 3
innodb_flush_neighbor_pages = 0
innodb_adaptive_flushing = false
# Hander Socket
#loose_handlersocket_port = 9998
#loose_handlersocket_port_wr = 9999
#loose_handlersocket_threads = 1
#loose_handlersocket_threads_wr = 1
#loose_handlersocket_readsize = 1M
#loose_handlersocket_rcvbuf = 4M
#loose_handlersocket_sndbuf = 4M
#open_files_limit = 65535
c、报警和状态监控增加:无
linux操作系统配置:
杂项
a、sys 文件系统设置
echo ’16′ > /sys/block/sdb/queue/read_ahead_kb
echo ’512′ > /sys/block/sdb/queue/nr_requests
echo ‘deadline’ > /sys/block/sdb/queue/scheduler
echo ’16′ > /sys/block/sdc/queue/read_ahead_kb
echo ’512′ > /sys/block/sdc/queue/nr_requests
echo ‘deadline’ > /sys/block/sdc/queue/scheduler
Fusion io attach上来就是noop,其他参数不修改。
在rc.local添加开机自动设置。
b、ulimit限制
打开文件限制。open file limit。目前是10240
max locked memory限制。Unlimited
c、大页使用以及内存swap
使用大页的系统,为连接和操作系统预留8G以上。
sysctl.conf增加swappness=0
d、报警和状态监控增加:无
xfs配置:
a、mkfs操作
mkfs.xfs -f -i size=512,attr=2 -l lazy-count=1 -d su=1M,sw=2 -L /data1 /dev/sdb1
mkfs.xfs -f -i size=512,attr=2 -l lazy-count=1 -d su=1M,sw=10 -L /data2 /dev/sdc1
不采用flashcache的机器su采用raid 条带大小一般为64k.
采用flashcache的su使用raid卡条带大小(1M),sw采用读的时候磁盘数(比如10块盘,raid 1+0则为10,raid5则为9)。
b、mount文件系统
mount -o defaults,rw,noatime,nodiratime,noikeep,nobarrier,allocsize=512M,attr2,largeio,inode64,swalloc LABEL=/redo /redo
mount -o defaults,rw,noatime,nodiratime,noikeep,nobarrier,allocsize=8M,attr2,largeio,inode64,swalloc LABEL=/ibddata /ibddata
/redo中存放:binlog,innodb_log,innodb_ts,log,sock,relaylog,slowlog
/ibddata中存放数据文件:mydata,tmpdir
mysql的主文件目录/data/mysqldata 采用链接的方式链接到/redo和/ibddata目录的各个子目录。
c、sysctl配置
xfs sysctl参数采用默认值,下面列出目前的xfs参数列表及默认值
#sysctl fs.xfs
fs.xfs.stats_clear = 0
fs.xfs.filestream_centisecs = 3000
fs.xfs.inherit_nodefrag = 1
fs.xfs.rotorstep = 1
fs.xfs.inherit_nosymlinks = 0
fs.xfs.age_buffer_centisecs = 1500
fs.xfs.xfsbufd_centisecs = 100
fs.xfs.inherit_noatime = 1
fs.xfs.inherit_nodump = 1
fs.xfs.inherit_sync = 1
fs.xfs.xfssyncd_centisecs = 3000
fs.xfs.error_level = 3
fs.xfs.panic_mask = 0
fs.xfs.irix_symlink_mode = 0
fs.xfs.irix_sgid_inherit = 0
fs.xfs.restrict_chown = 1
d、报警和状态监控增加:无
flashcache 配置
a、创建cache以及开机载入cache
第一次创建:flashcache_create mysql_data_cache /dev/fioa /dev/sdc1
开机重启时载入:flashcache_load mysql_data_cache /dev/fioa /dev/sdc1
blocksize设置为4k,为默认值。该值采用和percona的page_size一致大小
b、sysctl配置:
需要修改的四个参数:
dev.flashcache.fast_remove = 1
dev.flashcache.reclaim_policy = 1
dev.flashcache.dirty_thresh_pct = 90
dev.flashcache.cache_all = 1
这些参数直接在/etc/sysctl.conf中修改。
下面列出flashcache所有的sysctl参数:
#sysctl dev.flashcache
dev.flashcache.cache_all = 0
dev.flashcache.fast_remove = 1
dev.flashcache.reclaim_policy = 0
dev.flashcache.pid_expiry_secs = 60
dev.flashcache.max_pids = 100
dev.flashcache.do_pid_expiry = 0
dev.flashcache.max_clean_ios_set = 2
dev.flashcache.max_clean_ios_total = 4
dev.flashcache.dirty_thresh_pct = 90
以下三个是用于控制flashcache的命令,可以利用这三个参数
dev.flashcache.stop_sync = 0
dev.flashcache.do_sync = 0
dev.flashcache.zero_stats = 0
c、报警和状态监控:
命令:
dmsetup status mysql_data_cache
性能监控状态值为:
read hit percent(99) write hit percent(51) dirty write hit percent(44)
命令:
dmsetup table mysql_data_cache
性能监控状态值为:
cache percent(98) dirty percent(88)
上面五个百分比在一张图中展示。
fusion io 配置
a、内核参数调整:
use_workqueue=0
disable-msi=0
use_large_pcie_rx_buffer=1
其他内核模块参数值采用默认。
这些内核参数直接通过在/etc/modprobe.d/iomemory-vsl.conf配置中新增:
options iomemory-vsl use_workqueue=0
options iomemory-vsl disable-msi=0
options iomemory-vsl use_large_pcie_rx_buffer=1
来添加,文件中其他参数不予调整
列出flashcache所有内核参数如下:
parm: enable_ecc:int
parm: enable_two_plane:int
parm: disable_msi:int
parm: bypass_ecc:int
parm: force_soft_ecc:int
parm: bypass_whitening:int
parm: dont_whiten:int
parm: force_sw_read_completions:int
parm: ecc_correction_target_threshold:int
parm: ecc_correction_per_pad_retire:int
parm: ecc_correction_retire_threshold:int
parm: preallocate_memory:Cards for which to preallocate memory
(card <serial> serial number required) (array of charp)
parm: preallocate_mb:int
parm: expected_io_size:int
parm: iodrive_load_midprom:int
parm: iodrive_load_eb_map:int
parm: iodrive_scan_nv_data:int
parm: tcmd0:int
parm: tcmd1:int
parm: tread0:int
parm: tread1:int
parm: twrite0:int
parm: twrite1:int
parm: taddr0:int
parm: taddr1:int
parm: tintr_hw_wait:int
parm: iodrive_tread_hw_wait:int
parm: iodrive_tread_hw_wait_mlc:int
parm: iodrive_tstat_hw_wait:int
parm: iodrive_tstat_hw_wait_mlc:int
parm: iodrive_dma_delay:int
parm: use_large_pcie_rx_buffer:int
parm: use_workqueue:int
parm: default_gc_low_water:int
parm: default_gc_high_water:int
parm: always_rebuild_md:int
parm: auto_attach:int
parm: auto_attach_cache:int
parm: parallel_attach:int
parm: disable_groomer:int
parm: groomer_backoff:int
parm: use_new_io_sched:int
parm: max_md_blocks_per_device:int
parm: strict_sync:int
parm: use_command_timeouts:int
parm: fio_dont_init:int
parm: max_requests:int
parm: reduced_write_threshold:int
parm: capacity_warning_threshold:int
parm: read_only_threshold:int
parm: iodrive_read_retire_threshold:int
parm: disable_rle:int
parm: force_minimal_mode:int
parm: early_oom_threshold:int
parm: flashback_mode:int
parm: flashback_warning_as_failure:int
parm: fio_dev_wait_timeout_secs:int
parm: fio_dev_optimal_blk_size:int
parm: exclude_devices:PCI addresses of devices to exclude during initialization
(full <domain>:<bus>:<slot>.<func> address required) (array of charp)
parm: include_devices:Only initialize devices with these PCI addresses
(full <domain>:<bus>:<slot>.<func> address required) (precedence over exclude_devices) (array of charp)
parm: thermal_throttle_disable:int
parm: compaction_timeout_ms:int
parm: persistent_discard:int
parm: debug_DBGS_DIGEST:uint
parm: debug_DBGS_DMA:uint
parm: debug_DBGS_ECC:uint
parm: debug_DBGS_GENERAL:uint
parm: debug_DBGS_GROOM:uint
parm: debug_DBGS_INJECT:uint
parm: debug_DBGS_LOG_FILE:uint
parm: debug_DBGS_LRBTREE:uint
parm: debug_DBGS_MEDIA_ERROR:uint
parm: debug_DBGS_METADATA:uint
parm: debug_DBGS_PCIE:uint
parm: debug_DBGS_PTRIM:uint
parm: debug_DBGS_REQUEST:uint
parm: debug_DBGS_SHOW_INJECT:uint
parm: debug_FIND_BUG_DA:uint
parm: debug_FIO_PRINT_DANGLING:uint
parm: debug_FIO_PRINT_DIGEST:uint
parm: debug_FIO_PRINT_OBJECT:uint
parm: debug_PRINT_APPEND_FAILURES:uint
parm: debug_PRINT_APPEND_POINT:uint
parm: debug_PRINT_DEPACKETIZER:uint
parm: debug_PRINT_DMA:uint
parm: debug_PRINT_DMA_READ:uint
parm: debug_PRINT_DMA_WRITE:uint
parm: debug_PRINT_ECC_READ:uint
parm: debug_PRINT_ECC_WRITE:uint
parm: debug_PRINT_GROOM_RANGES:uint
parm: debug_PRINT_GROOM_SCAN:uint
parm: debug_PRINT_IDLE_GROOM:uint
parm: debug_PRINT_LEB_OPERATIONS:uint
parm: debug_PRINT_NAND_READ:uint
parm: debug_PRINT_NAND_READ_DETAILS:uint
parm: debug_PRINT_NAND_WRITE:uint
parm: debug_PRINT_PACKETIZER:uint
parm: debug_PRINT_PARITY_OPERATIONS:uint
parm: debug_PRINT_PROGRESS:uint
parm: debug_PRINT_REATTACH:uint
parm: debug_PRINT_REQUESTS:uint
parm: debug_PRINT_REQUEST_LIST:uint
parm: debug_PRINT_RESOURCES:uint
parm: debug_PRINT_SCAN:uint
parm: debug_PRINT_SCAN_ENTRIES:uint
b、报警和状态监控:
命令:
fio-status -fk -an /dev/fct0
报警监控:
media_status=Healthy。非healthy报警
性能监控:
logical_written_bytes=2664888862208
logical_read_bytes=171877629608448
physical_written_bytes=27684857382680
physical_read_bytes=223401928291768
监控每隔一段时间的变化量而不是这个总量。
命令:
fio-get-erase-count -s /dev/fct0 :
性能监控:
Max: 149
Avg: 79.00
监控活动的block刷写的最大次数以及平均刷写次数
fio-get-erase-count -b -s /dev/fct0
Total blocks: 29
监控坏块的个数。
硬件相关配置
网卡配置:
a、网卡绑定和IP分配
两块网卡,两两交叉配置bond,
机器上有几个MySQL实例配置几个IP。各个IP在两个bond0上平均分配
另外增加一个专门的主机监控IP
b、网卡中断
网卡中断不绑定到CPU上。
c、报警和状态监控:
主机监控IP主要用来做mysql_host主机监控
各个实例IP监控用来监控数据库状态。
Numactl配置:
a、单机单实例关闭numa。在内核中直接关闭
多实例情况下,numa内存分配采用bind ,
采用在my.cnf中的[mysqld_safe]组中添加
mysqld=mysqld_using_numactl
来使用多实例MySQL绑定CPU的目的。
这里列出numa可能的配置选项:
default bind interleave preferred,
b、增加的报警和状态监控:无
raid配置:
a、条带大小
在raid配置界面,提交装机申请的时候指定,
flashcache设置条带设置为1M。SAS盘采用默认64K。
b、LSI raid卡设置
/opt/MegaRAID/MegaCli/MegaCli -LDSetProp -CachedBadBBU -Lall -aALL
/opt/MegaRAID/MegaCli/MegaCli -LDSetProp -DisDskCache -Lall -aALL
/opt/MegaRAID/MegaCli/MegaCli -LDSetProp -NORA -Lall -aALL
/opt/MegaRAID/MegaCli/MegaCli -LDSetProp -WB -Lall -aALL
/opt/MegaRAID/MegaCli/MegaCli -LDSetProp -Direct -Lall -aALL
设置电池断电的时候仍然使用cache;不使用磁盘cache;不进行预读;设置为write back;设置为direct。
(hp的机器暂时不管)
增加报警和状态监控:无
drac卡配置:
运行local_hw_oob_init.sh脚本,使得机器可以通过ipmi连接屏幕并通过ipmitool工具重启。
报警和状态监控:无
linux内核模块:
在/etc/sysconfig/modules新增脚本:
fio.modules flashcache.modules xfs.modules
使得xfs,iomemory-vsl,flashcache开机自动载入
附:
block size设置规则:
从mySQL到raid卡,目前我们需要设置:
a、percona的page size(ssd机器为4k , sas则设为8k ,大字段,压缩表或者全表扫描应用则设置为16k)
b、flash cache的flashcache_create创建cache时的 block size(默认为4k)
c、fusion io的 fio-format block size(默认不使用fio-format重新格式化fusion io卡)
d、xfs的su条带大小(xfs建议自己指定su条带大小,默认值一般不好)
e、raid卡条带大小(默认值64K)
block size的相互关系如下:
1、percona page size根据机器类型和应用类型来设置。
2、flashcache_create的block size指定为percona page size一样的大小
3、一般情况下不使用fio-format重新格式化fusion io卡
4、raid卡条带大小flashcache机器设置条带设置为1M,如果是SAS盘采用默认64K。
5、xfs的su条带大小跟raid卡条带大小一样,并且应该为percona page size的整数倍。sw采用读的时候磁盘数(比如10块盘,raid 1+0则为10,raid5则为9)