我正在这个图书馆做一个poc,设置起来有点困难。我有一个非常简单的mysql设置:-一个vm(没有主从机)-centos 7-mysql版本5.7
以下是迄今为止我掌握的代码:
public static void main(String[] args) throws IOException {
BinaryLogClient client = new BinaryLogClient("***.***.***.***", 3306, "****", "******");
client.setBinlogFilename("/var/log/mysql/mysql-bin");
client.registerLifecycleListener(new BinaryLogClient.LifecycleListener() {
@Override
public void onConnect(BinaryLogClient binaryLogClient) {
System.out.println("OnConnect()");
}
@Override
public void onCommunicationFailure(BinaryLogClient binaryLogClient, Exception e) {
System.out.println("OnCommunicationFailure()");
e.printStackTrace();
}
@Override
public void onEventDeserializationFailure(BinaryLogClient binaryLogClient, Exception e) {
System.out.println("OnEventDeserialize()");
}
@Override
public void onDisconnect(BinaryLogClient binaryLogClient) {
System.out.println("OnDisconnect()");
}
});
client.registerEventListener(new EventListener() {
@Override
public void onEvent(Event event) {
System.out.println(event.toString());
}
});
client.connect();
}
运行此代码时,我得到以下输出:
oncommunicationfailure()com.github.shyiko.mysql.binlog.network.serverexception:在com.github.shyiko.mysql.binlog.binarylogclient.listenforeventpackets(binarylogclient)的二进制日志索引文件中找不到第一个日志文件名。java:882)在com.github.shyiko.mysql.binlog.binarylogclient.connect(binarylogclient。java:559)在main.main(main。java:40)
我的mysql配置文件内容:
[我的qld]
datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock
符号链接=0
日志错误=/var/log/mysql/mysqld.log
服务器id=1
log bin=/var/log/mysql/mysql bin
pid文件=/var/run/mysqld/mysqld.pid
绑定地址=。。。
我的日志目录的内容如下:
[mysql]# ls
error.log mysql-bin.000001 mysql-bin.index mysqld.log
当然,mysql-bin.index的内容是:
/var/log/mysql/mysql-bin.000001
此问题的所有联机解决方案都涉及主从配置,相应的解决方案是-有人需要帮助吗?:)
暂无答案!
目前还没有任何答案,快来回答吧!