1、下载(建议使用github上的)
http://maxwells-daemon.io/quickstart/ # version > 1.30 jdk需要使用11版本 https://github.com/zendesk/maxwell/releases # version <1.30 jdk使用8版本
2、解压
tar -xf xxx.tar.gz
3、运行示例 http://maxwells-daemon.io/quickstart/
bin/maxwell --user='maxwell' --password='XXXXXX' --host='127.0.0.1' \ --producer=kafka --kafka.bootstrap.servers=localhost:9092 --kafka_topic=maxwell
4、通过config.properties运行 (增量监听)
#mysql user=root password=yang156122 host=hadoop101 #kafka producer=kafka kafka.bootstrap.servers=hadoop101:9092 kafka_topic=kafkaeagle1
../bin/maxwell --config config.properties
FAQ
错误一:
(base) [root@hadoop101 maxwell-1.33.1]# bin/maxwell --user='root' --password='yang156122' --host='hadoop101' \ > --producer=kafka --kafka.bootstrap.servers=hadoop101:9092 --kafka_topic=kafkaeagle1 Using kafka version: 1.0.0 Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.UnsupportedClassVersionError: com/zendesk/maxwell/Maxwell has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:756) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:468) at java.net.URLClassLoader.access$100(URLClassLoader.java:74) at java.net.URLClassLoader$1.run(URLClassLoader.java:369) at java.net.URLClassLoader$1.run(URLClassLoader.java:363) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:362) at java.lang.ClassLoader.loadClass(ClassLoader.java:418) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355) at java.lang.ClassLoader.loadClass(ClassLoader.java:351) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:601)
解决方法:maxwell1.33版本要使用jdk11,因此要么就升级jdk,要么就使用maxwell低版本(小于1.30版本)