标签:star poi art binlog get 报错 dup nsa 引擎
记一次MariaDB主从复制的搭建mysqldump备份命令:
mysqldump -S/var/lib/mysql/mysql.sock -uroot -p --single-transaction --master-data=2 zst > 20180719_zst.sql
实验环境:
安装MariaDB(master和slave都需安装)
shell> wget https://downloads.mariadb.com/MariaDB/mariadb-10.1.34/yum/rhel/mariadb-10.1.34-rhel-6-x86_64-rpms.tar
shell> tar -xf mariadb-10.1.34-rhel-6-x86_64-rpms.tar
shell> cat sys/kernel/mm/transparent_hugepage/enabled ##需要关闭大页传输
always madvise [never] ## 是never是正确的
shell> echo never > /sys/kernel/mm/transparent_hugepage/enabled
shell> echo never > /sys/kernel/mm/transparent_hugepage/defrag
shell> cd mariadb-10.1.34-rhel-6-x86_64-rpms
shell> ./setup_repository
shell> yum install Mariadb-Server
查看是否支持TokuDB
......
*************************** 5. row ***************************
Engine: TokuDB
Support: DEFAULT
Comment: Percona TokuDB Storage Engine with Fractal Tree(tm) Technology
Transactions: YES
XA: YES
Savepoints: YES
*************************** 6. row ***************************
......
搭建主从
mysql> change master to
-> master_host=‘172.16.3.5‘,
-> master_user=‘rpl‘,
-> master_password=‘new_password‘,
-> master_port=3306,
-> master_log_file=‘mysql-bin.000010‘,
-> master_log_pos=258482739;
sysbench压测(sysbench_host上面运行)
sysbench oltp_insert.lua --threads=10 --report-interval=5 --db-driver=mysql --mysql-host=172.16.3.5 --mysql-port=3306 --mysql-user=root --mysql-password=‘new_password‘ --mysql-db=zst --mysql_storage_engine=tokudb --tables=10 --table_size=2000000 prepare
实验结果
......
......
Last_SQL_Errno: 1062
Last_SQL_Error: Could not
execute Write_rows event on table zst.sbtest1; Duplicate entry ‘8‘ for key
‘PRIMARY‘, Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event‘s
master log mysql-bin.000005, end_log_pos 2678
......
......
tokudb的备份工具
mysqldump has also been extended with a new option, lock-for-backup (disabled by default). When used together with the --single-transaction option, the option makes mysqldump issue LOCK TABLES FOR BACKUP before starting the dump operation to prevent unsafe statements that would normally result in an inconsistent backup.
When used without the single-transaction option, lock-for-backup is automatically converted to lock-all-tables.
Option lock-for-backup is mutually exclusive with lock-all-tables, i.e. specifying both on the command line will lead to an error.
If the backup locks feature is not supported by the target server, but lock-for-backup is specified on the command line, mysqldump aborts with an error.
https://github.com/XeLabs/tokudb-xtrabackup
【20180719】记录一次MariaDB主从复制由于tokudb出现主键1062错误问题
标签:star poi art binlog get 报错 dup nsa 引擎
原文地址:http://blog.51cto.com/11819159/2147347