Что я могу действительно сделать с pt-table-sync percona инструментария?

После того как Вы покупаете доменное имя, Вы просто добавляете запись DNS (хост, Запись), чтобы то доменное имя указало на Ваш IP-адрес. Например, при покупке доменного имени (foo.com) у Godaddy (где когда-либо Вы купили его у), затем будет раздел их веб-сайта, который позволяет Вам создать записи DNS.

Ищите раздел справки или ищите веб-сайт поставщиков.

Записи MX для почтовых серверов.

Записи для веб-серверов.

Надежда, которая помогает

3
задан 19 November 2012 в 21:04
3 ответа

Answer to Question 1

MySQL Replication suffers from two major problems

  • MySQL Replication is Asynchronous. This may introduce replication delay. This manifests itself with communication problems between a Master and the Slave via the Slave I/O Thread. This may logically and numerically be seen in Seconds_Behind_Master.

  • Data Drift. This is a intermittent condition where a Master and Slave are simply out-of-sync because of factors outside the realm of MySQL Replication. For example, please note one way to better synchronize replication: use the option sync-binlog. When you set sync-binlog to 1, mysqld will perform a flush of the current binary log for every entry you record in the binary log. That can ridiculously slow down a Master. By default, sync-binlog is 0.

    • Here is a question: With sync-binlog=0, who is responsible for flushing the binary log to disk?
    • Answer (please sit down for this one): THE OPERATING SYSTEM !!!
    • With that answer, it puts the Slave as a terrible disadvantage because its I/O Thread is at the mercy of the Master's Operating System. When the Master's OS gets around to flushing the binary log changes to disk and the Slave's I/O Thread can detect the next incoming SQL statement, then the statement is shipped over the I/O Thread to the Slave.
    • Percona has a nice PDF on dealing with Data Drift

Answer to Question 2

The direct answer here is no because pt-table-sync was designed to detect the I/O thread of a Slave by means of the --sync-to-master option.

Answer to Question 3

The direct answer here is no because MySQL Replication demands to know

  • what is the current binary log on the Master? (this is Master_Log_File from SHOW SLAVE STATUS\G)
  • what is the latest position the Slave has read from Master's current binary log? (this is Read_Master_Log_Pos from SHOW SLAVE STATUS\G)

If you simply want your binary logs to get out of the way, you can do one of two things

  • OPTION 1 : On the Master, set expire-logs-days to 3 to keep the last 3 days worth of binary logs
    • Добавьте expire-logs-days = 3 в /etc/my.cnf
    • Не требуется перезапуска: просто запустите SET GLOBAL expire_logs_days = 3;
  • ВАРИАНТ 2: Запустить ПОКАЗАТЬ СТАТУС ПОДЧИНЕННОГО \ G на ведомом. Возьмите значение Relay_Master_Log_File . и используйте его для очистки двоичных журналов на Мастере до этого файла журнала.
    • Suppose you run SHOW SLAVE STATUS\G on the Slave
    • You get this Relay_Master_Log_File: mysql-bin.000035
    • Run this on the Master : PURGE BINARY LOGS TO 'mysql-bin.000035';

SUGGESTION

If you want to have more faith in pt-table-sync, try using the --print option and redirecting to a text file instead of the --execute option. This will generate the SQL that would normally execute on the Master. You could just run the SQL directly on that Slave thereafter. Think of it as a dress rehearsal for --execute.

7
ответ дан 3 December 2019 в 04:46

но я думал, что весь смысл репликации состоит в том, чтобы позаботиться о synchronization of data for you

Yes, MySQL replication does try to synchronize a replicated database. However, MySQL replication is tricky and the replication can fail for various reasons. Replication errors in my experience are rare, but they do happen during unexpected server crashes, when users hit "Control-C" in the middle of a big insert on the master, etc. MySQL.com does not provide good tools to deal with many of these problems. Luckily, a few engineers such as Baron Schwartz (Original author of the Percona Toolkit (formerly known as Maatkit) have developed tools to make MySQL administration easier.

For example, I currently have a table with 50 million rows. A handful of rows are out of sync due to a server crash a few weeks ago. I need to discover which rows are out of sync, but that would be painful to do manually. I use pt-table-checksum to check for replication errors on the replica, and pt-table-sync to discover which rows are missing on the replica.

If you are considering MySQL replication, I highly recommend that you investigate and use the Percona Toolkit. If we had started off with the Percona Toolkit, the administration of our MySQL databases would have been much simpler.

I read the documentation and got confused:

The documentation for Percona Toolkit is written like a technical manual. It unfortunately does not do a good job at describing how to use the tools, how do they help you, etc. http://www.mysqlperformanceblog.com has some of this information, but it's largely focused on the Percona fork of MySQL (This is how they make a living), which requires the reader to do some translation.

3
ответ дан 3 December 2019 в 04:46

Ответ на вопрос 1

pt-table-sync (вместе с контрольная сумма pt-table ) может использоваться для исправления ошибок репликации, таких как повреждение данных. , кто-то напрямую изменяет данные на ведомом устройстве, сбои сервера, изменения схемы в неправильном порядке и т. д.

Однако pt-table-sync также можно использовать без репликации для синхронизации таблиц в режиме, близком к реальному времени, если данные не меняются слишком сильно.

Правильный ответ на вопрос 2

Конечно, вы можете использовать его и в среде без репликации, это также упоминается в руководстве . Я использую его из cron, чтобы «синхронизировать» 3 сервера mysql каждые 5 минут. У них есть одна и та же копия данных, которая изменяется только иногда (на первом сервере), поэтому репликация для этой цели была бы излишней.

Вы можете указать отдельные базы данных или отдельные таблицы для синхронизации. У вас может быть несколько целевых серверов. pt-table-sync использует несколько эффективных алгоритмов для обнаружения изменений в таблицах базы данных и копирования только изменений (он разбивает изменения на 4 группы: удаления, замены, вставки, обновления).

2
ответ дан 3 December 2019 в 04:46

Теги

Похожие вопросы