bennojoy / mysql

ansible role for mysql
150 stars 137 forks source link

miss create db in slave #20

Open linbo opened 10 years ago

linbo commented 10 years ago

MySQL Version: 5.5.38

I follow this configuration to create a new Replication environment, then loads data from an existing MySQL Server. Since slave didn't create databases, sync db from master to slave will be failed, told db not exist when create tables;

The solution is set replicate_do_db = dbname in slave

  - hosts: master
    roles:
     - {role: mysql, mysql_db: [{name: benz}, {name: benz2}],
                     mysql_users: [{name: ben3, pass: foobar, priv: "*.*:ALL"},
                                   {name: ben2, pass: foo}],
                     mysql_db_id: 8 

  - hosts: slave
    roles:
     - {role: mysql, mysql_db: none, mysql_users: none,
              mysql_repl_role: slave, mysql_repl_master: vm2,
              mysql_db_id: 9, mysql_repl_user: [{name: repl, pass: foobar}] }
geogdog commented 9 years ago

I've been working on this tonight. It looks like an ordering problem between the config change in my.cnf, the restart of mysql to introduce the changes and the creation of the databases.

I've got a fix, but I have to test it before sending in a pull request.

hbokh commented 9 years ago

Any news on this issue? We're still waiting for a fix in the release...

geogdog commented 9 years ago

The solution that I used didn't solve the problem.