mysqldump備份命令:html
mysqldump -S/var/lib/mysql/mysql.sock -uroot -p --single-transaction --master-data=2 zst > 20180719_zst.sql
實驗環境:mysql
安裝MariaDB(master和slave都需安裝)git
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
查看是否支持TokuDBgithub
...... *************************** 5. row *************************** Engine: TokuDB Support: DEFAULT Comment: Percona TokuDB Storage Engine with Fractal Tree(tm) Technology Transactions: YES XA: YES Savepoints: YES *************************** 6. row *************************** ......
搭建主從sql
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上面運行)shell
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的備份工具centos
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