简体   繁体   English

将数据库还原到新集群

[英]Restoring database to new cluster

we are using Percona 5.7.16-10 server. 我们正在使用Percona 5.7.16-10服务器。 I would like to expand current solution with XtraDB cluster. 我想用XtraDB集群扩展当前的解决方案。 So meanwhile I created other machines and started cluster (running on 5.7.17-11-57 Percona XtraDB Cluster version) and I did some testing there (everything seems to be working fine). 因此,与此同时,我创建了其他机器并启动了集群(在5.7.17-11-57 Percona XtraDB集群版本上运行),并且在那里进行了一些测试(一切似乎都正常工作)。 Now I would like to dump current database from running server and insert it into cluster. 现在,我想从正在运行的服务器中转储当前数据库并将其插入集群。 There is no problem to stop the cluster (since it is for testing). 停止群集没有问题(因为它是用于测试的)。 But when I create mysqldump as I was used to, I'm not able to insert it into cluster because of pcx_strict_mode (info here ) - with enforcing Percona-XtraDB-Cluster prohibits use of LOCK TABLE/FLUSH TABLE <table> WITH READ LOCK with pxc_strict_mode = ENFORCING because the mysqldump creates script which contains table lock which is prohibited. 但是当我像以前那样创建mysqldump时,由于pcx_strict_mode(无法在此处查看信息),所以无法将其插入群集中-强制执行Percona-XtraDB-Cluster prohibits use of LOCK TABLE/FLUSH TABLE <table> WITH READ LOCK with pxc_strict_mode = ENFORCING因为mysqldump创建的脚本包含禁止的表锁。 So I've tested several more options, like MASTER which should don't check this rule, but it didn't help, because the insert query from the dump get stuck and nothing is happening. 因此,我测试了更多选项,例如MASTER,该选项不检查此规则,但没有帮助,因为转储中的插入查询卡住了,什么也没发生。

Is there any mysqldump option to avoid table locking queries, or do I have to restore it somehow via XtraBackup and use XtraBackup for current running server? 是否有任何mysqldump选项来避免表锁定查询,还是我必须通过XtraBackup以某种方式还原它并将XtraBackup用于当前正在运行的服务器?

I've read several topics here , but didn't match anyone with the same issue. 我在这里阅读了几个主题,但没有一个人遇到同样的问题。 Everyone is solving how to restore cluster from some fail, not from the scratch. 每个人都在解决如何从某些失败而不是从零开始恢复群集的问题。

I will be glad for any suggestion for mysqldump or what is proper way to "insert" old database into cluster. 我对mysqldump的任何建议或将旧数据库“插入”集群的正确方法感到高兴。

If you can take down your current machine, and if you are building the cluster from scratch, then I think these (on mysqldump ) would avoid that strict_mode, and possibly some other hiccups: 如果您可以关闭当前计算机,并且从头开始构建集群,那么我认为这些(在mysqldump )将避免使用strict_mode,并且可能还会引起其他一些麻烦:

--skip_add_locks --skip-lock-tables

And do not use 而且不要使用

--single-transaction --lock-all-tables

It might also be wise to get the first node in the cluster loaded with the data, then add on the other nodes, letting them use SST to load themselves. 在集群中的第一个节点上加载数据, 然后添加其他节点,让它们使用SST加载自身,这也可能是明智的。

If you need to keep the current server alive, then we need to discuss making it a Master and one node of the new cluster be a Slave. 如果需要使当前服务器保持活动状态,那么我们需要讨论使其成为主服务器,而新集群的一个节点成为从服务器。 Plus XtraBackup would probably be better suited. 再加上XtraBackup可能更适合。 But now, the locks and single-transaction would be necessary. 但是现在,锁和单笔交易将是必需的。 So setting that strict_mode to DISABLED seems right since the cluster is being built, and not yet live. 因此,由于正在构建群集且尚未启用群集,因此将strict_mode设置为DISABLED似乎是正确的。

(Caveat: I have no experience performing your task; if someone else provides a more convincing Answer, go with them.) (注意:我没有执行您的任务的经验;如果其他人提供了更令人信服的答案,请与他们一起去。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM