本文共 4013 字,大约阅读时间需要 13 分钟。
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.tarshell> tar -xf mariadb-10.1.34-rhel-6-x86_64-rpms.tarshell> cat sys/kernel/mm/transparent_hugepage/enabled ##需要关闭大页传输always madvise [never] ## 是never是正确的shell> echo never > /sys/kernel/mm/transparent_hugepage/enabledshell> echo never > /sys/kernel/mm/transparent_hugepage/defragshell> cd mariadb-10.1.34-rhel-6-x86_64-rpmsshell> ./setup_repositoryshell> yum install Mariadb-Server
查看是否支持TokuDB
......*************************** 5. row *************************** Engine: TokuDB Support: DEFAULT Comment: Percona TokuDB Storage Engine with Fractal Tree(tm) TechnologyTransactions: YES XA: YESSavepoints: 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 notexecute 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'smaster 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
转载于:https://blog.51cto.com/11819159/2147347