navicat 连不上mycat,mycat.log提示如下错误日志:
ServerConnection [id=6, schema=null, host=192.168.0.104, user=root,txIsolation=3, autocommit=true, schema=null, executeSql=SHOW VARIABLES LIKE 'lower_case_%']SHOW VARIABLES LIKE 'lower_case_%', route={
1 -> dn1{SHOW VARIABLES LIKE 'lower_case_%'}
}
java.lang.NullPointerException: null
at io.mycat.backend.mysql.nio.handler.SingleNodeHandler.execute(SingleNodeHandler.java:204) [Mycat-server-1.6.7.6-release.jar:?]
at io.mycat.server.NonBlockingSession.execute(NonBlockingSession.java:151) [Mycat-server-1.6.7.6-release.jar:?]
at io.mycat.server.ServerConnection.routeEndExecuteSQL(ServerConnection.java:368) [Mycat-server-1.6.7.6-release.jar:?]
at io.mycat.server.ServerConnection.execute(ServerConnection.java:283) [Mycat-server-1.6.7.6-release.jar:?]
at io.mycat.server.handler.ShowHandler.handle(ShowHandler.java:60) [Mycat-server-1.6.7.6-release.jar:?]
at io.mycat.server.ServerQueryHandler.query(ServerQueryHandler.java:92) [Mycat-server-1.6.7.6-release.jar:?]
at io.mycat.net.FrontendConnection.query(FrontendConnection.java:397) [Mycat-server-1.6.7.6-release.jar:?]
at io.mycat.net.FrontendConnection.query(FrontendConnection.java:417) [Mycat-server-1.6.7.6-release.jar:?]
at io.mycat.net.handler.FrontendCommandHandler.handle(FrontendCommandHandler.java:76) [Mycat-server-1.6.7.6-release.jar:?]
at io.mycat.net.FrontendConnection.rawHandle(FrontendConnection.java:591) [Mycat-server-1.6.7.6-release.jar:?]
at io.mycat.net.FrontendConnection.handle(FrontendConnection.java:573) [Mycat-server-1.6.7.6-release.jar:?]
at io.mycat.net.AbstractConnection.onReadData(AbstractConnection.java:338) [Mycat-server-1.6.7.6-release.jar:?]
at io.mycat.net.NIOSocketWR.asynRead(NIOSocketWR.java:216) [Mycat-server-1.6.7.6-release.jar:?]
at io.mycat.net.AbstractConnection.asynRead(AbstractConnection.java:290) [Mycat-server-1.6.7.6-release.jar:?]
at io.mycat.net.NIOReactor$RW.run(NIOReactor.java:113) [Mycat-server-1.6.7.6-release.jar:?]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_292]
2021-06-27 13:37:47.213 ERROR [$_NIOREACTOR-2-RW] (io.mycat.net.FrontendConnection.writeErrMessage(FrontendConnection.java:231)) - ServerConnection [id=6, schema=null, host=192.168.0.104, user=root,txIsolation=3, autocommit=true, schema=null, executeSql=SHOW VARIABLES LIKE 'lower_case_%']nulljava.lang.Thread .getStackTrace1559
io.mycat.net.FrontendConnection .getStack245
io.mycat.net.FrontendConnection .writeErrMessage231
注意到上述代码有如下内容:
route={
1 -> dn1{SHOW VARIABLES LIKE 'lower_case_%'}
}
其中有个dn1
但是我这边实际在schema.xml中配置的是dn101,因此猜测mycat在节点上必须配置成dn1开始dn2这样一直下去。
把schema.xml中的dn101改成dn1,重新启动就可以了。