canal工具报错权限不足
场景描述
在搭建canal环境,使用指定用户从RDS for MySQL获取Binlog时,启动canal经常会报如下错误:'show master status' has an error! Access denied: you need (at least one of) the SUPER, REPLICATION CLIENT privilege(s) for this operation
报错信息如下:
2021-01-10 23:58:32.964 [destination = evoicedc , address = /dbus-mysql:3306 , EventParser] ERROR xxx.common.alarm.LogAlarmHandler - destination:evoicedc[xxx.parse.exception.CanalParseEx ception: command : 'show master status' has an error! Caused by: java.io.IOException: ErrorPacket [errorNumber=1227, fieldCount=-1, message=Access denied; you need (at least one of) the SUPER, REPLICATION CLIENT privilege(s) for this operation, sqlState=42000, sqlStateMarker=#] with command: show master status at xxx.parse.driver.mysql.MysqlQueryExecutor.query(MysqlQueryExecutor.java:61)
原因分析
canal拉取Binlog时需要赋予REPLICATION SLAVE, REPLICATION CLIENT权限。
解决方案
使用管理员账户给相应用户授予REPLICATION SLAVE, REPLICATION CLIENT权限。
GRANT SELECT, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO ‘canal’@’%’;
FLUSH PRIVILEGES;