创建connector报错
来源:9-4 Kafka Connect Source和MySQL集成

weixin_慕仰1047700
2020-05-06
在本机运行:
curl -X POST -H 'Content-Type: application/json' -i 'http://192.168.153.80:8083/connectors' \
--data \
'{"name":"yujia-upload-mysql","config":{
"connector.class":"io.confluent.connect.jdbc.JdbcSourceConnector",
"connection.url":"jdbc:mysql://172.31.157.183:3306/kafka_study?user=root&password=yujia",
"table.whitelist":"users",
"incrementing.column.name": "uuid",
"mode":"incrementing",
"topic.prefix": "yujia-mysql-"}}'
出现报错
{"error_code":400,"message":"Connector configuration is invalid and contains the following 2 error(s):\n
Invalid value com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure\n\n
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. for configuration Couldn't open connection to jdbc:mysql://172.31.157.183:3306/kafka_study?user=root&password=yujia\n
Invalid value com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure\n\nThe last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. for configuration Couldn't open connection to jdbc:mysql://172.31.157.183:3306/kafka_study?user=root&password=fanyujia1995\nYou can also find the above list of errors at the endpoint `/{connectorType}/config/validate`"}~ fanyuji
写回答
3回答
-
小葱与奥特曼
2022-09-22
可能是centos7连接不上宿主机的msyql,权限不够导致
可以在宿主机上执行如下msyql命令
1、登录
mysql -u root -p
2、查询mysql用户
select user,host,authentication_string from mysql.user;
3、 切换到mysql库
use mysql;
4、 修改root用户host
update user set host='%' where user='root'。
5、刷新权限
flush privileges;
00 -
Allen
2020-05-06
这个错误已经挺明显了, 要么是URL不对, 要么是数据库信息不对, 要么是驱动包版本不匹配
022020-05-08 -
Allen
2020-05-06
数据库URL写的格式不对, 可以检查一下
022020-05-06
相似问题