Replication : Table doesn't exist with replicate_rewrite_db
I've set up replication between two mariadb 10.6 servers. I want the master to replicate its DB "database" to the slave DB "database1". The goal here is to set up multi-source replication. Here's the slave configuration :
log-bin server_id=2 master1.replicate_rewrite_db="database->database1"
I can start the slave with :
CHANGE MASTER 'master1' TO MASTER_HOST='XXXX', MASTER_USER='replication', MASTER_PASSWORD='XXXXXXX', MASTER_PORT=3306, MASTER_LOG_FILE='master1-bin.000001', MASTER_LOG_POS=710, MASTER_CONNECT_RETRY=10, MASTER_USE_GTID = slave_pos; SET GLOBAL gtid_slave_pos = "1-1-2"
If I add a new table to the master, the table is replicated to the slave. However, if I populate the new table with data, the slave gives the following error :
show slave 'master1' status \G; ... Last_SQL_Error: Error 'Table 'database.test' doesn't exist' on query. Default database: 'database1'. Query: 'INSERT INTO `database`.`test` (`test`) VALUES ('1242')' ...