IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 大数据 -> flink cdc 没有Replication client ,Replication slave权限,报错,处理 -> 正文阅读

[大数据]flink cdc 没有Replication client ,Replication slave权限,报错,处理

项目场景:

fiink cdc 的表用户,需要有Replication client ,Replication slave权限。
授权命令如下:
grant Replication client on . to ods_base@‘%’;
grant replication slave on . to ods_base@‘%’;
flush privileges;


问题描述

flink cdc读取mysql数据,没有往外写数据,页面的状态显示正常,但日志报错。

Caused by: org.apache.flink.util.FlinkRuntimeException: Cannot read the binlog filename and position via 'SHOW MASTER STATUS'. Make sure your server is correctly configured
	at com.ververica.cdc.connectors.mysql.debezium.DebeziumUtils.currentBinlogOffset(DebeziumUtils.java:122) ~[flink-sql-connector-mysql-cdc-2.2-SNAPSHOT.jar:2.2-SNAPSHOT]
	at com.ververica.cdc.connectors.mysql.debezium.task.MySqlSnapshotSplitReadTask.doExecute(MySqlSnapshotSplitReadTask.java:139) ~[flink-sql-connector-mysql-cdc-2.2-SNAPSHOT.jar:2.2-SNAPSHOT]
	at com.ververica.cdc.connectors.mysql.debezium.task.MySqlSnapshotSplitReadTask.execute(MySqlSnapshotSplitReadTask.java:115) ~[flink-sql-connector-mysql-cdc-2.2-SNAPSHOT.jar:2.2-SNAPSHOT]
	... 6 more
Caused by: java.sql.SQLSyntaxErrorException: Access denied; you need (at least one of) the SUPER, REPLICATION CLIENT privilege(s) for this operation
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120) ~[flink-sql-connector-mysql-cdc-2.2-SNAPSHOT.jar:2.2-SNAPSHOT]
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) ~[flink-sql-connector-mysql-cdc-2.2-SNAPSHOT.jar:2.2-SNAPSHOT]
	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) ~[flink-sql-connector-mysql-cdc-2.2-SNAPSHOT.jar:2.2-SNAPSHOT]
	at com.mysql.cj.jdbc.StatementImpl.executeQuery(StatementImpl.java:1200) ~[flink-sql-connector-mysql-cdc-2.2-SNAPSHOT.jar:2.2-SNAPSHOT]
	at io.debezium.jdbc.JdbcConnection.queryAndMap(JdbcConnection.java:643) ~[flink-sql-connector-mysql-cdc-2.2-SNAPSHOT.jar:2.2-SNAPSHOT]
	at io.debezium.jdbc.JdbcConnection.queryAndMap(JdbcConnection.java:512) ~[flink-sql-connector-mysql-cdc-2.2-SNAPSHOT.jar:2.2-SNAPSHOT]
	at com.ververica.cdc.connectors.mysql.debezium.DebeziumUtils.currentBinlogOffset(DebeziumUtils.java:104) ~[flink-sql-connector-mysql-cdc-2.2-SNAPSHOT.jar:2.2-SNAPSHOT]
	at com.ververica.cdc.connectors.mysql.debezium.task.MySqlSnapshotSplitReadTask.doExecute(MySqlSnapshotSplitReadTask.java:139) ~[flink-sql-connector-mysql-cdc-2.2-SNAPSHOT.jar:2.2-SNAPSHOT]
	at com.ververica.cdc.connectors.mysql.debezium.

第二个错误

Caused by: com.ververica.cdc.connectors.shaded.org.apache.kafka.connect.errors.ConnectException: An exception occurred in the change event producer. This connector will be stopped.
	at io.debezium.pipeline.ErrorHandler.setProducerThrowable(ErrorHandler.java:42) ~[flink-sql-connector-mysql-cdc-2.2-SNAPSHOT.jar:2.2-SNAPSHOT]
	at com.ververica.cdc.connectors.mysql.debezium.task.context.MySqlErrorHandler.setProducerThrowable(MySqlErrorHandler.java:72) ~[flink-sql-connector-mysql-cdc-2.2-SNAPSHOT.jar:2.2-SNAPSHOT]
	at io.debezium.connector.mysql.MySqlStreamingChangeEventSource$ReaderThreadLifecycleListener.onCommunicationFailure(MySqlStreamingChangeEventSource.java:1185) ~[flink-sql-connector-mysql-cdc-2.2-SNAPSHOT.jar:2.2-SNAPSHOT]
	at com.github.shyiko.mysql.binlog.BinaryLogClient.listenForEventPackets(BinaryLogClient.java:973) ~[flink-sql-connector-mysql-cdc-2.2-SNAPSHOT.jar:2.2-SNAPSHOT]
	at com.github.shyiko.mysql.binlog.BinaryLogClient.connect(BinaryLogClient.java:606) ~[flink-sql-connector-mysql-cdc-2.2-SNAPSHOT.jar:2.2-SNAPSHOT]
	at com.github.shyiko.mysql.binlog.BinaryLogClient$7.run(BinaryLogClient.java:850) ~[flink-sql-connector-mysql-cdc-2.2-SNAPSHOT.jar:2.2-SNAPSHOT]
	... 1 more
Caused by: io.debezium.DebeziumException: Access denied; you need (at least one of) the REPLICATION SLAVE privilege(s) for this operation Error code: 1227; SQLSTATE: 42000.
	at io.debezium.connector.mysql.MySqlStreamingChangeEventSource.wrap(MySqlStreamingChangeEventSource.java:1146) ~[flink-sql-connector-mysql-cdc-2.2-SNAPSHOT.jar:2.2-SNAPSHOT]
	at io.debezium.connector.mysql.MySqlStreamingChangeEventSource$ReaderThreadLifecycleListener.onCommunicationFailure(MySqlStreamingChangeEventSource.java:1185) ~[flink-sql-connector-mysql-cdc-2.2-SNAPSHOT.jar:2.2-SNAPSHOT]
	at com.github.shyiko.mysql.binlog.BinaryLogClient.listenForEventPackets(BinaryLogClient.java:973) ~[flink-sql-connector-mysql-cdc-2.2-SNAPSHOT.jar:2.2-SNAPSHOT]
	at com.github.shyiko.mysql.binlog.BinaryLogClient.connect(BinaryLogClient.java:606) ~[flink-sql-connector-mysql-cdc-2.2-SNAPSHOT.jar:2.2-SNAPSHOT]
	at com.github.shyiko.mysql.binlog.BinaryLogClient$7.run(BinaryLogClient.java:850) ~[flink-sql-connector-mysql-cdc-2.2-SNAPSHOT.jar:2.2-SNAPSHOT]
	... 1 more
Caused by: com.github.shyiko.mysql.binlog.network.ServerException: Access denied; you need (at least one of) the REPLICATION SLAVE privilege(s) for this operation
	at com.github.shyiko.mysql.binlog.BinaryLogClient.listenForEventPackets(BinaryLogClient.java:937) ~[flink-sql-connector-mysql-cdc-2.2-SNAPSHOT.jar:2.2-SNAPSHOT]
	at com.github.shyiko.mysql.binlog.BinaryLogClient.connect(BinaryLogClient.java:606) ~[flink-sql-connector-mysql-cdc-2.2-SNAPSHOT.jar:2.2-SNAPSHOT]
	at com.github.shyiko.mysql.binlog.BinaryLogClient$7.run(BinaryLogClient.java:850) ~[flink-sql-connector-mysql-cdc-2.2-SNAPSHOT.jar:2.2-SNAPSHOT]
	... 1 more

原因分析:

flink 客户端,这个用户没有权限同步mysql的的数据。赋予相应的权限就行。


解决方案:

授权

replication client
拥有此权限可以查询master server、slave server状态。
mysql> show master status;
ERROR 1227 (42000): Access denied; you need the SUPER,REPLICATION CLIENT privilege for this operation
mysql> grant Replication client on . to p1@localhost;
或:mysql> grant super on . to p1@localhost;
mysql> show master status;
+——————+———-+————–+——————+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+——————+———-+————–+——————+
| mysql-bin.000006 | 2111 | | |
+——————+———-+————–+——————+
mysql> show slave status;

  1. replication slave
    拥有此权限可以查看从服务器,从主服务器读取二进制日志。
    mysql> show slave hosts;
    ERROR 1227 (42000): Access denied; you need the REPLICATION SLAVE privilege for this operation
    mysql> show binlog events;
    ERROR 1227 (42000): Access denied; you need the REPLICATION SLAVE privilege for this operation
    mysql> grant replication slave on . to p1@localhost;
    mysql> show slave hosts;
    Empty set (0.00 sec)
    mysql>show binlog events;
    +—————+——-+—————-+———–+————-+————–+
    | Log_name | Pos | Event_type | Server_id| End_log_pos|Info |
    +—————+——-+————–+———–+————-+—————+
    | mysql-bin.000005 | 4 | Format_desc | 1 | 98 | Server ver: 5.0.77-log, Binlog ver: 4 |
    |mysql-bin.000005|98|Query|1|197|use mysql; create table a1(i int)engine=myisam|

赋予如下权限就ok

 grant Replication client on *.* to ods_base@'%';
  grant replication slave on *.* to ods_base@'%';
flush privileges;
  大数据 最新文章
实现Kafka至少消费一次
亚马逊云科技:还在苦于ETL?Zero ETL的时代
初探MapReduce
【SpringBoot框架篇】32.基于注解+redis实现
Elasticsearch:如何减少 Elasticsearch 集
Go redis操作
Redis面试题
专题五 Redis高并发场景
基于GBase8s和Calcite的多数据源查询
Redis——底层数据结构原理
上一篇文章      下一篇文章      查看所有文章
加:2022-09-13 11:22:42  更:2022-09-13 11:24:37 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/27 1:12:35-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码