STATUS | wrapper | 2015/04/1215:05:00 | --> Wrapper Started as Daemon STATUS | wrapper | 2015/04/1215:05:00 | Launching a JVM... INFO | jvm1 | 2015/04/1215:05:01 | Wrapper (Version3.2.3) http://wrapper.tanukisoftware.org
INFO | jvm1 | 2015/04/1215:05:01 | Copyright1999-2006TanukiSoftware, Inc. AllRightsReserved.
INFO | jvm1 | 2015/04/1215:05:01 |
INFO | jvm1 | 2015/04/1215:05:01 | log4j 2015-04-1215:05:01 [./conf/log4j.xml] load completed.
INFO | jvm1 | 2015/04/1215:05:02 | MyCATServer startup successfully. see logs in logs/mycat.log
如果啟動異常會有對應的異常信息,比如:
STATUS | wrapper | 2015/02/1401:43:44 | --> Wrapper Started as Daemon
STATUS | wrapper | 2015/02/1401:43:44 | Launching a JVM...
INFO | jvm 1 | 2015/02/1401:43:45 | Error: Exception thrown bythe agent : java.rmi.server.ExportException: Port already in use: 1984; nested exception is:
INFO | jvm 1 | 2015/02/1401:43:45 | java.net.BindException: Address already in use
ERROR | wrapper | 2015/02/1401:43:45 | JVM exited while loading theapplication.
日志顯示異常原因為java.net.BindException: Address already in use,也就是端口占用,很有可能是原有服務未停止,或者Mycat默認端口被其他程序占用,正常啟動成功后會有mycat.log日志,如果服務未啟動成功不會有對應的日志。 2 mycat日志 下面看一下info級別小成功啟動的日志。
04-2921:46:59.121 INFO [main] (PhysicalDBPool.java:81) -total resouces of dataHost jdbchost is :404-2921:46:59.126 INFO [main] (PhysicalDBPool.java:81) -total resouces of dataHost jdbchost2 is :404-2921:46:59.143 INFO [main] (CacheService.java:125) -create layer cache pool TableID2DataNodeCache oftype encache ,default cache size 10000 ,default expire seconds18000
04-2921:46:59.145 INFO [main] (DefaultLayedCachePool.java:80) -create child Cache: TESTDB_ORDERS for layered cache TableID2DataNodeCache, size 50000, expire seconds 1800004-2921:46:59.472 INFO [main] (DynaClassLoader.java:35) -dyna class load from E:\MyProject\Mycat-Server\main\catlet,and auto check for class file modified every 60 seconds
04-2921:46:59.477 INFO [main] (MycatServer.java:192) -===============================================
04-2921:46:59.478 INFO [main] (MycatServer.java:193) -MyCat is ready to startup ...
04-2921:46:59.478 INFO [main] (MycatServer.java:203) -Startup processors ...,total processors:4,aio thread pool size:8 each process allocated socket buffer pool bytes ,buffer chunk size:4096buffer pool's capacity(buferPool/bufferChunk) is:400004-2921:46:59.479 INFO [main] (MycatServer.java:204) -sysconfig params:SystemConfig [processorBufferLocalPercent=100, frontSocketSoRcvbuf=1048576, frontSocketSoSndbuf=4194304, backSocketSoRcvbuf=4194304, backSocketSoSndbuf=1048576, frontSocketNoDelay=1, backSocketNoDelay=1, maxStringLiteralLength=65535, frontWriteQueueSize=2048, bindIp=0.0.0.0, serverPort=8066, managerPort=9066, charset=utf8, processors=4, processorExecutor=8, timerExecutor=2, managerExecutor=2, idleTimeout=1800000, catletClassCheckSeconds=60, sqlExecuteTimeout=300,
processorCheckPeriod=1000, dataNodeIdleCheckPeriod=300000, dataNodeHeartbeatPeriod=10000, clusterHeartbeatUser=_HEARTBEAT_USER_, clusterHeartbeatPass=_HEARTBEAT_PASS_, clusterHeartbeatPeriod=5000, clusterHeartbeatTimeout=10000, clusterHeartbeatRetry=10, txIsolation=3, parserCommentVersion=50148, sqlRecordCount=10, processorBufferPool=16384000, processorBufferChunk=4096, defaultMaxLimit=100, sequnceHandlerType=1, 04-2921:47:01.343 INFO [main] (PhysicalDBPool.java:296) -init result :finished 10 success 10 target count:1004-2921:47:01.343 INFO [main] (PhysicalDBPool.java:238) -jdbchost2 index:0 init success MyCAT Server startup successfully. see logs in logs/mycat.log
04-2921:51:21.846 INFO [main] (PhysicalDBPool.java:81) -total resouces of dataHost jdbchost is :404-2921:51:21.848 INFO [main] (PhysicalDBPool.java:81) -total resouces of dataHost jdbchost2 is :4
該部分日志可以看到配置的數據源相關信息,上面是兩個數據源連接 datahost:
04-29 21:51:21.856 INFO [main] (CacheService.java:125) -create layer cache pool TableID2DataNodeCache of type encache ,default cache size10000 ,default expire seconds18000 04-2921:51:21.857 INFO [main] (DefaultLayedCachePool.java:80) -create child Cache: TESTDB_ORDERS for layered cache TableID2DataNodeCache, size50000, expire seconds 1800004-2921:51:22.104 INFO [main] (DynaClassLoader.java:35) -dyna class loadfrom E:\MyProject\Mycat-Server\main\catlet,and auto checkfor class file modified every 60 seconds
04-29 22:06:10.420 DEBUG [$_NIOREACTOR-3-RW] (NonBlockingSession.java:118) -ServerConnection [id=1, schema=mycat, host=127.0.0.1, user=mycat,txIsolation=3, autocommit=true, schema=mycat]
select * from t_user t, route={
1 -> dn1{SELECT * FROM t_user t LIMIT 100}
2 -> dn2{SELECT * FROM t_user t LIMIT 100} } rrs
04-2922:06:10.420 DEBUG [$_NIOREACTOR-3-RW] (MultiNodeQueryHandler.java:78) -execute mutinode query select * from t_user t
該部分描述了該條sql被分配到到了分片dn1、dn2上同時執行,如果某個某個sql通過緩存、分片規則或者注解指定只會在某個分片執行,則sql只會被分配到到某個分片,例如: sql=select * from t_user t where t.user_id=121;該條數據只在分片1上。
04-29 22:13:40.960 DEBUG [$_NIOREACTOR-3-RW] (NonBlockingSession.java:118) -ServerConnection [id=1, schema=mycat, host=127.0.0.1, user=mycat,txIsolation=3, autocommit=true, schema=mycat]select * from t_user t where t.user_id=121, route={ 1 -> dn1{SELECT * FROM t_user t WHERE t.user_id = 121 LIMIT 100} } rrs
從日志可以看出sql只被路由到dn1節點執行。 4 異常日志
java.sql.SQLSyntaxErrorException:com.alibaba.druid.sql.parser.ParserException: syntax error, errorin :'elect * from t_user t where t.',expect IDENTIFIER, actual IDENTIFIER elect at org.opencloudb.route.impl.DruidMycatRouteStrategy.routeNormalSqlWithAST(DruidMycatRouteStrategy.java:44)
at org.opencloudb.route.RouteService.route(RouteService.java:118) at org.opencloudb.server.ServerConnection.routeEndExecuteSQL(ServerConnection.java:165)at org.opencloudb.server.ServerConnection.execute(ServerConnection.java:154)
at org.opencloudb.net.FrontendConnection.query(FrontendConnection.java:250)
at org.opencloudb.net.handler.FrontendCommandHandler.handle(FrontendCommandHandler.java:56)at org.opencloudb.net.FrontendConnection.handle(FrontendConnection.java:357)
at org.opencloudb.net.NIOSocketWR.asynRead(NIOSocketWR.java:186) at org.opencloudb.net.AbstractConnection.asynRead(AbstractConnection.java:238)
at org.opencloudb.net.NIOReactor$RW.run(NIOReactor.java:97)at java.lang.Thread.run(Thread.java:745)
at com.alibaba.druid.sql.parser.SQLParser.printError(SQLParser.java:229)
at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:325)
at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatement(SQLStatementParser.java:1655)
at org.opencloudb.route.impl.DruidMycatRouteStrategy.routeNormalSqlWithAST(DruidMycatRouteStrategy.java:41) ... 13 more