启动zookeeper
zookeeper-3.4.x 单机启动、停止服务、查看服务状态、jps
启动kafka
Maxwell启动方式一:命令行
cd /program/maxwell-1.29.2
前台运行
缺点:窗口不能关闭,否则不能停止运行
启动命令后面带很多参数:
bin/maxwell --user='maxwell' --password='maxwell' --host='hadoop1' --producer=kafka --kafka.bootstrap.servers=hadoop1:9092 --kafka_topic=scott
解释:
--user='maxwell':指定MySQL用户名--password='maxwell':指定MySQL密码--host='hadoop1':指定数据库ip 或 主机名--producer=:生产者模式,有2个值:- stdout:控制台
- kafka:kafka集群
--kafka.bootstrap.servers:kafka的ip、portkafka_topic=scott:发送到哪个topic主题,该主题不存在,会自动创建,只会创建一个分区。
名字可任意起,这里由于操作的数据库名叫 scott,所以指定主题名是scott
后台运行
bin/maxwell --user='maxwell' --password='maxwell' --host='hadoop1' --producer=kafka --kafka.bootstrap.servers=hadoop1:9092 --kafka_topic=scott --daemon
Maxwell启动方式二:配置文件
cd /program/maxwell-1.29.2
复制配置文件
cp config.properties.example config.properties
修改配置文件
vim config.properties
修改下面内容:
producer=kafka
kafka.bootstrap.servers=hadoop1:9092
# mysql login info
host=hadoop1
user=maxwell
password=maxwell
kafka_topic=scott
前台启动
缺点:窗口不能关闭,否则不能停止运行
bin/maxwell --config ./config.properties
后台启动
bin/maxwell --config ./config.properties --daemon
常见错误
Maxwell1.29.x 配置成发送数据给kafka,启动报错Error while fetching metadata with correlation id