标签:mode nec myisam AC 说明 lob nsis files class
gtid主主
====================配置如下==================== [client] port = 3306 socket=/tmp/my3306.sock [mysql] no-auto-rehash [mysqld] user = mysql port = 3306 bind_address = * socket=/tmp/my3306.sock character_set_server = utf8 log-error = /home/mysql/3306/logs/my3306_error.log pid-file=/home/mysql/3306/logs/my3306.pid homedir=/home/mysql/3306/data basedir=/opt/mysql default-storage-engine=InnoDB #MyISAM open_files_limit = 10240 autocommit = 1 sql_mode = "STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER" secure_file_priv=‘‘ lower_case_table_names=1 skip-grant skip-name-resolve =on #说明:主库必须配置的参数 #server-id (主从的server-id必须不同)、log_bin、log-slave-updates、gtid_mode、enforce_gtid_consistency server-id=1921685533 gtid_mode=on #开启gtid模式 enforce_gtid_consistency=on #强制gtid一致性,开启后对于特定create table不被支持 log-slave-updates=1 #slave 更新是否记入日志 skip_slave_start=1 #复制进程就不会随着数据库的启动而启动(想要随数据库启动而启动 注释掉) relay-log = /home/mysql/3306/binlog/relay relay_log_purge = on log-bin = /home/mysql/3306/binlog/binlog binlog_cache_size = 32M binlog_format = ROW #MIXED binlog_row_image = FULL max_binlog_cache_size = 2048M max_binlog_size = 512M expire_logs_days = 90 key_buffer_size = 1024M max_allowed_packet = 1024M table_open_cache = 1024 sort_buffer_size = 8M read_buffer_size = 8M read_rnd_buffer_size = 8M join_buffer_size = 8M myisam_sort_buffer_size = 128M thread_cache_size = 128 query_cache_size= 128M thread_concurrency = 8 interactive_timeout = 1800 wait_timeout = 1800 max_connections = 1000 max_user_connections = 1000 max_connect_errors = 6000 back_log = 600 long_query_time=3 slow_query_log=1 slow_query_log_file=/home/mysql/3306/logs/my3306-slow-query.log skip_external_locking=1 innodb_file_per_table = on innodb_buffer_pool_size = 2048M innodb_thread_concurrency = 8 innodb_flush_log_at_trx_commit = 1 注意: 除了 server_id不一样外 其它的都一样。 主库必须配置的参数: server-id (主从的server-id必须不同)、log_bin、log-slave-updates、gtid_mode、enforce_gtid_consistency 从库必须配置的参数:双主read-only 是不需要配置的 server-id、log_bin、relay-log、read-only、log-slave-updates =============================================== 1.启动数据库 2.创建同步账号 grant replication slave on *.* to ‘slave‘@‘%‘ identified by ‘123123‘; 3.备份数据库(-A 备份所有库,该备份文件会包含一条语句需要注意set @@global.gtid_purged="a57a3eb0-5d40-11e6-9609-080027f7e774:1-3") mysqldump -uroot --default-character-set=utf8 -p -R --opt --triggers --hex-blob --single-transaction -A -S /tmp/my31306.sock > /tmp/back.sql 4.另外一台恢复数据库 mysql -uroot --default-character-set=utf8 -p < /data/tmp.sql(指定字符集恢复) 以下操作两台都需要操作。 5. 停止slave stop slave; 6.进行同步 CHANGE TO 操作() change master to master_host="192.168.1.100",master_port=3306,master_user=‘repl‘, master_password=‘repl4slave‘,master_auto_position=1; #参数解释: MASTER_HOST : 设置要连接的主服务器的ip地址 MASTER_USER : 设置要连接的主服务器的用户名 master_port:设置要连接的主服务器的端口 MASTER_PASSWORD : 设置要连接的主服务器的密码 MASTER_AUTO_POSITION : GTID模式,基于事务ID复制 7. 启动slave start slave 8.查看slave状态 (Slave_IO_Running:YES 并且Slave_SQL_Running: Yes ) show slave status\G;
slave常用命令
show master status;
show slave status\G;
stop slave;
start slave;
标签:mode nec myisam AC 说明 lob nsis files class
原文地址:https://www.cnblogs.com/hanxiaohui/p/9130078.html