3

I'm trying to set up a multi-source replication

When trying to set a master for a specific channel using this query

CHANGE MASTER TO MASTER_HOST='192.168.0.203', MASTER_USER='rep', MASTER_PORT=3306, MASTER_PASSWORD='pass', MASTER_LOG_FILE='mysql-bin.000003', MASTER_LOG_POS=107 FOR CHANNEL 'master-203';

I get the following error

Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FOR CHANNEL 'master-203'' at line 1

I can't figure out what's the problem. The query is pretty much a copy-paste from the official documentation

My server is running MariaDB 10.1.21

What could be wrong?

  • FOR CHANNEL is syntax in MySQL, not MariaDB. Multi-source repl is an area where Oracle and MariaDB have significant differences. – Rick James Feb 25 '18 at 13:26
2

You're looking at the documentation for MySQL 5.7, but you're running MariaDB 10.1, and replication channels happen to be a feature that is implemented differently in MariaDB.

From the MariaDB documentation on multi-source replication:

You specify which master connection you want to work with by either specifying the connection name in the command or setting default_master_connection to the connection you want to work with.

So in your case you could try:

CHANGE MASTER 'master-203' TO MASTER_HOST='192.168.0.203', 
MASTER_USER='rep', 
MASTER_PORT=3306, 
MASTER_PASSWORD='pass', 
MASTER_LOG_FILE='mysql-bin.000003', 
MASTER_LOG_POS=107; 

(Disclaimer: I've not tried this in practice.)

  • Worked fine just the way you wrote it. Thanks! – minusnine Feb 20 '18 at 17:41
-3
CHANGE MASTER 's-102' TO  MASTER_HOST='INFItjgDT-059',
MASTER_USER='rpl1', 
MASTER_PASSWORD='rpl1',
MASTER_LOG_FILE='mysql-bin.000003',
MASTER_LOG_POS=342,
MASTER_PORT=6666;

use this command

  • No, I won't try it, I am not using MariaDB. But if you compare your answer to the other one (reported working by the original asker), you'll see yours is lacking explanation - especially that the two commands look very similar. – dezso Jul 11 '18 at 10:22
  • Hi, Narayan welcome on the DBA SE! I don't think that it would be a link-only answer already. However, it is important to also explain, what your code is doing and why is it so. Simple script snippets are not very HQ (high quality) answers, even if they are working. Do it quickly - the site welcomes your contributions. – peterh Jul 11 '18 at 11:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.