Ошибка импорта данных MySQL с ошибкой 1839

8341
JAVAC

У меня есть настройка главного ведомого MySQL с настроенным GTID. Я забрал резервную копию данных мастера и импортировал ее на отдельный тестовый сервер. Не удается импортировать как

ОШИБКА 1839 (HY000) в строке 24: @@ GLOBAL.GTID_PURGED может быть установлена ​​только тогда, когда @@ GLOBAL.GTID_MODE = ON. Я пытался с --set-gtid-purged = OFF и AUTO, но безуспешно.

7

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

15
banyek

If you run a

SHOW MASTER STATUS\G 

you'll see something like this:

mysql> show master status\G *************************** 1. row *************************** File: mysql-bin.000299 Position: 780437462 Binlog_Do_DB: Binlog_Ignore_DB: Executed_Gtid_Set: 075d81d6-8d7f-11e3-9d88-b4b52f517ce4:1-616637650, e907792a-8417-11e3-a037-b4b52f51dbf8:1-25385296642 1 row in set (0.00 sec) 

Becuase when GTID is enabled all the servers got their own uuid, and there are transactions. I suppose you created the dump with mysqldump, and if you look at the beginning of that file, you'll find something similiar as this:

-- -- GTID state at the beginning of the backup -- SET @@GLOBAL.GTID_PURGED='075d81d6-8d7f-11e3-9d88-b4b52f517ce4:1-616648986, e907792a-8417-11e3-a037-b4b52f51dbf8:1-25385296642'; 

This is the command which cannot be executed.

You have the following options:

  • Remove this command from the mysql dump file. Simply delete it. All the inserts will appear on slave as it's local transactions

  • If you want to prevent this happening, you can also reset master on slave

    mysql> RESET MASTER;

    This command will clean up the 'Executed_Gtid_Set' variable on slave, so you can import the dumpfile directly, and the previously mentioned set_global_gtid_purged variable takes action

  • When you create the mysqldump, you can skip the GTID setup part as adding the

    --set-gtid-purged=OFF

parameter for mysqldump.

NOTE:

if the GTID subset differs on master between master and slave (if you want to use this in a replication setup) then the replication will not work, I'd recommend a binary dump and restore, as setting the slave's GTID exactly to the master's.

With GTID there are a lot of new problems emerge, but your replica setup will be more consistent. It is worth working with that.

на самом деле я пытаюсь перенести весь этот сервер MySQL на новый сервер, я установил сервер MySQL на новую машину и пытаюсь импортировать дамп, где я получаю эту проблему JAVAC 8 лет назад 0
И сервер имеет свой собственный набор GTID. (См. «SHOW MASTER STATUS»). Если это будет совершенно новый сервер, на котором в настоящее время нет ведомых, то я бы удалил данные GTID из дампа и импортировал все данные. После этого я бы выпустил «RESET MASTER», который сбрасывает последовательность GTID, и вы можете начать все заново. banyek 8 лет назад 1
убрал GTID из файла дампа sql работал у меня JAVAC 8 лет назад 1