到目前为止花了两天看堆栈溢出的答案和谷歌,我只是无法让它工作..
我试图在mysql / mariadb中设置主/从复制..但是当我开始复制时。它只是错误的奴隶说表不存在。
这是奴隶的当前状态:
MariaDB [(none)]> show slave status \G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: somedomain.com
Master_User: someuser
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000002
Read_Master_Log_Pos: 63687969
Relay_Log_File: mariadb-relay-bin.000002
Relay_Log_Pos: 382
Relay_Master_Log_File: mysql-bin.000001
Slave_IO_Running: Yes
Slave_SQL_Running: No
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 1146
Last_Error: Error 'Table 'xxxxx.xxxx' doesn't exist' on query. Default database: 'xxxxxxxxxxxx'. Query: 'UPDATE xxxx SET lastused = NOW(), lingertime = 7 WHERE siteid = 'xxxxxxxxxxx''
Skip_Counter: 0
Exec_Master_Log_Pos: 98
Relay_Log_Space: 63763807
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 1146
Last_SQL_Error: Error 'Table 'xxxxxxxx.xxxxx' doesn't exist' on query. Default database: 'xxxxxxx'. Query: 'UPDATE xxxxx SET lastused = NOW(), lingertime = 7 WHERE siteid = 'xxxxxxxxxx''
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
答案 0 :(得分:4)
我是否需要先创建数据库和表?
是的,你必须先这样做。您必须拥有与master相同的模式和表。
如果是这样,如果在主设备上制作新表会怎样?这会破坏复制吗?
您在master上执行的每个命令也将在slave上复制。这包括表和模式的CREATE语句。所以,你不会有任何问题。