If the OpenNebula to be added as a Slave is an existing installation, and you need to preserve its database (users, groups, VMs, hosts...), you need to import the contents with the onedb command.
The onedb import-slave command only imports the “federation tables” (user_pool,group_pool,vdc_pool,zone_pool,db_versioning,acl).
After this step the MySQL replication is started. This action drops the dababase of the existing slave.
Only the replicated federation tables exists for now in the slave opennebula database.
I had to import the “old” production tables manually by importing a SQL dump.
150524 14:19:13 1 Query slave start
38 Connect Out email@example.com:3306
39 Query drop database opennebula
39 Query create database opennebula
39 Query CREATE DATABASE IF NOT EXISTS opennebula
It looks like the first two queries were executed manually in the master mysql server before OpenNebula did the first bootstrap. OpenNebula does not execute a drop + create, it only does the ‘create if not exists’. I admit we didn’t take this scenario into account, all our tests are done with databases managed entirely through OpenNebula.
Probably there is a way to tell the slave to start the replication from a certain position in the master binary log. I think we should fix this issue updating the documentation to instruct admins to look for the first ‘create if not exists’, and use that as the first query to replicate.
What do you guys think? Do you agree, or am I missing something?