使用RubyRep时,某些表的MySQL数据库复制失败

时间:2019-05-24 06:51:52

标签: mysql ruby replication database-replication

我正在使用RubyRep设置对MySQL数据库的部分复制。但这不适用于某些表。我做错了什么?

这是一台运行MySQL 5的Linux CentOS服务器。我尝试在本地复制两个MySQL数据库,以在两个不同数据库中复制两种相同类型的表,效果很好。所以我在服务器上尝试了同样的方法。在服务器中,当我尝试新创建的表时,它可以正常工作,但对于某些现有表,则无法工作。

出勤表属性是

| Field             | Type         | Null | Key | Default | Extra |
+-------------------+--------------+------+-----+---------+-------+
| ATTENDANCE_DATE   | datetime     | NO   |     | NULL    |       |
| STUDENT_ID        | int(10)      | NO   |     | NULL    |       |
| CLASS_ID          | int(10)      | NO   |     | NULL    |       |
| STAFF_ID          | int(10)      | NO   |     | NULL    |       |
| ATTENDANCE_STATUS | char(1)      | YES  |     | NULL    |       |
| LATE_STATUS       | char(1)      | YES  |     | NULL    |       |
| LATE_TIME         | varchar(7)   | YES  |     | NULL    |       |
| DROP_TIME         | time         | YES  |     | NULL    |       |
| PICK_TIME         | time         | YES  |     | NULL    |       |
| REMARKS           | varchar(200) | YES  |     | NULL    |       |
| SCHOOL_ID         | int(11)      | YES  |     | NULL    |       |
| CREATED_ON        | datetime     | NO   |     | NULL    |       |
| CREATED_BY        | varchar(15)  | NO   |     | NULL    |       |
| MODIFIED_ON       | datetime     | YES  |     | NULL    |       |
| MODIFIED_BY       | varchar(15)  | YES  |     | NULL    |       |
+-------------------+--------------+------+-----+---------+-------+

而RubyRep的配置文件是:

RR::Initializer::run do |config|                                                   
  config.left = {                                                                  
    :adapter  => 'mysql2',                                                         
    :database => 'database-A',                                          
    :username => '*******',                                                      
    :password => '*******',                                                   
    :host     => 'localhost'                                                       
  }                                                                                

  config.right = {                                                                 
    :adapter  => 'mysql2',                                                         
    :database => 'database-B',                                             
    :username => '*******',                                                      
    :password => '*******',                                                   
    :host     => 'localhost'                                                       
  }                                                                                

  config.left[:logger] = "log/left_database.log"                                   
  config.right[:logger] = "log/right_database.log"                                 
  config.options[:auto_key_limit] = 2                                              

  config.include_tables 'attendance', :replication_conflict_handing => :
left_wins, :sync_conflict_handling => :left_wins                                   
  # config.include_tables /^e/ # regexp matching all tables starting with e        
  # config.include_tables /./ # regexp matching all tables in the database         
end                                                                                

我希望在数据库A的出勤表中添加数据时,应该将其复制到数据库B的出勤表中。

现在,在运行复制命令本身时,该命令将失败,并显示错误消息

Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '), null, 'I');

0 个答案:

没有答案