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。![]()

浙公網安備 33010602011771號