[mysqld] character-set-client-handshake=FALSE character_set_server=utf8mb4 collation-server = utf8mb4_unicode_ci port=3306 innodb_file_per_table=1 basedir=/usr/local/mysql5 datadir=/data/data/mysql #basedir=/usr/local/mysql5.6 #datadir=/data/data/mysql5.6 #basedir=/usr/local/mysql5.5 #datadir=/data/data/mysql5.5 #socket=/tmp/mysql.sock socket=/var/lib/mysql/mysql.sock secure-file-priv="/tmp" core_file #skip-grant-tables innodb_force_recovery=0 innodb_purge_threads=0 innodb_file_format=Barracuda max_allowed_packet=100M connect_timeout =2880000 wait_timeout=2880000 skip-name-resolve back_log = 1024 max_connections = 1024 max_connect_errors = 6000 open_files_limit = 65535 table_open_cache = 128 #max_allowed_packet = 4M binlog_cache_size = 1M max_heap_table_size = 8M tmp_table_size = 16M read_buffer_size = 2M read_rnd_buffer_size = 8M sort_buffer_size = 8M join_buffer_size = 8M key_buffer_size = 32M thread_cache_size = 64 query_cache_type = 1 query_cache_size = 8M query_cache_limit = 2M ft_min_word_len = 4 log_bin = mysql-bin binlog_format = mixed expire_logs_days = 30 server-id=1 log-bin = mysql-bin #log-bin=mysql-bin.log #binlog-do-db =microcosm #replicate-do-db =microcosm binlog-ignore-db=mysql replicate-ignore-db=mysql default-storage-engine=INNODB sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" #server-id=1 #max_connections=151 query_cache_size=0 event_scheduler = 1 ft_min_word_len = 1 # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 # Settings user and group are ignored when systemd is used. # If you need to run mysqld under a different user or group, # customize your systemd unit file for mariadb according to the # instructions in http://fedoraproject.org/wiki/Systemd [mysqld_safe] log-error=/data/data/mysql/mariadb.log pid-file=/data/data/mysql/mariadb.pid #log-error=/data/data/mysql5.6/mariadb.log #pid-file=/data/data/mysql5.6/mariadb.pid #log-error=/data/data/mysql5.5/mariadb.log #pid-file=/data/data/mysql5.5/mariadb.pid [client] default-character-set=utf8mb4 #socket=/tmp/mysql.sock socket=/var/lib/mysql/mysql.sock [mysql] default-character-set=utf8mb4 #socket=/tmp/mysql.sock socket=/var/lib/mysql/mysql.sock
上边这些基本都是优化项:
server-id=1
log-bin = mysql-bin
#log-bin=mysql-bin.log
#binlog-do-db =microcosm --binlog-do-db:指定mysql的binlog日志记录哪个db
#replicate-do-db =microcosm
binlog-ignore-db=mysql
replicate-ignore-db=mysql
default-storage-engine=INNODB
Replicate_Do_DB:参数是在slave上配置,指定slave要复制哪个库
在master上设置binlog_do_弊端:
1、过滤操作带来的负载都在master上
2、无法做基于时间点的复制(利用binlog)。
这里有个文章讲解释https://blog.csdn.net/hgffhh/article/details/86792051