MyCat 使用中问题记录
MyCat问题记录:
Unknown charsetIndex:255
异常消息:
jvm 1 | 2022-04-27 14:09:13,337 [WARN ][$_NIOREACTOR-13-RW] MySQLConnection [id=13, lastTime=1651039753332, user=root, schema=szmachine, old shema=szmachine, borrowed=false, fromSlaveDB=true, threadId=3214, charset=utf8, txIsolation=3, autocommit=true, attachment=null, respHandler=null, host=192.168.12.229, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false] connectionError java.lang.RuntimeException: Unknown charsetIndex:255 (io.mycat.backend.mysql.nio.handler.NewConnectionRespHandler:NewConnectionRespHandler.java:37)
jvm 1 | 2022-04-27 14:09:13,339 [INFO ][Timer1] no ilde connection in pool,create new connection for hostS2 of schema szmachine (io.mycat.backend.datasource.PhysicalDatasource:PhysicalDatasource.java:413)
jvm 1 | 2022-04-27 14:09:13,340 [INFO ][$_NIOREACTOR-14-RW] can't get connection for sql :select user() (io.mycat.sqlengine.SQLJob:SQLJob.java:114)
jvm 1 | 2022-04-27 14:09:13,341 [INFO ][$_NIOREACTOR-14-RW] no ilde connection in pool,create new connection for hostS2 of schema szmachine (io.mycat.backend.datasource.PhysicalDatasource:PhysicalDatasource.java:413)
jvm 1 | 2022-04-27 16:28:38,627 [INFO ][$_NIOREACTOR-6-RW] connected successfuly MySQLConnection [id=6, lastTime=1651048118627, user=root, schema=szmachine, old shema=szmachine, borrowed=true, fromSlaveDB=false, threadId=3387, charset=utf8, txIsolation=3, autocommit=true, attachment=null, respHandler=null, host=192.168.12.229, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false] (io.mycat.backend.mysql.nio.handler.GetConnectionHandler:GetConnectionHandler.java:67)
解决办法:修改confg里面的index_to_charset.properties 文件,添加对应异常中字符索引的数据库字符编码即可,我这里是255,也可能是224或其他的。
至于为什么我这里是255。。。,我也不知道
启动异常: startup error java.lang.NumberFormatException: Size must be specified as bytes (b), kibibytes (k), mebibytes (m), gibibytes (g), tebibytes (t), or pebibytes(p). E.g. 50b, 100k, or 250m.
解决办法:方案一:编辑config下server.xml,修改useOffHeapForMerge为0,禁用堆外内存,但是会影响性能
方案二:编辑config下wrapper.conf,修改wrapper.java.additional.5=-XX:MaxDirectMemorySize,调整堆内存大小,我这里设了8G。