Mycat study notes. Client uses latin1 character set, backend MySQL for UTF8 character set, Mycat log parsing.

Source: Internet
Author: User

In fact, this is more boring-the client is the Lantin character set, after MySQL for the U8 character set, Mycat in the middle in the end what role.

Again the environment for this verification:

Mac OS 10.11.2

MySQL 5.6

Mycat 1.5

OK, start our verification work.

1) because the database and operating system have been set to U8 encoding by default, the client character set configuration is scheduled to be validated by modifying the MySQL "character_set_client" parameter.

For a more comprehensive description of the MySQL character set, refer to the mysql_query ("Set names gb2312") Setting the client character Set portal

--View the character set of the current system

SHOW VARIABLES like ' character% ';

--View the current client character set

Show variables like ' character_set_client ';

OK, after confirming that the local client character set is U8, use the following command to tune to Latin1 (iso8859-1)

Set Names Latin1

2) Look at the Mycat log in the case of select, according to the following red-labeled text content, speculated mycat each time from the connection pool to get back-end connection will automatically synchronize the database connection character set, The character set that will connect the local client to the Mycat service synchronizes to the Mycat connection to MySQL.

In addition Mycat uses the U8 character set with the back-end MySQL communication by default, which can be embodied in the release connection step.

That is, by default, U8 is used to interact with MySQL, and the client can specify additional characters.

Under normal circumstances everyone will use U8, of course, can also be adjusted by Mycat server.xml configuration.

<system> <property name= "CharSet" >utf8</property> </system>

01/21 22:25:53.174 DEBUG [$_NIOREACTOR-2-RW] (serverqueryhandler.java:56)-serverconnection [id=2, Schema=TESTDB, host =127.0.0.1, User=test,txisolation=3, Autocommit=true, Schema=testdb]select * from T_demo_travel_record

LIMIT 0, 1000

01/21 22:25:53.174 DEBUG [$_NIOREACTOR-2-RW] (enchachepool.java:70)-sqlroutecache hit cache, Key:testdbselect * from T_d Emo_travel_record

LIMIT 0, 1000

01/21 22:25:53.175 DEBUG [$_NIOREACTOR-2-RW] (nonblockingsession.java:113)-serverconnection [id=2, Schema=TESTDB, host=127.0.0.1, User=test,txisolation=3, Autocommit=true, Schema=testdb]select * from T_demo_travel_record

LIMIT 0, route={

1-Dn1{select *

From T_demo_travel_record

LIMIT 0, 1000}

2-Dn2{select *

From T_demo_travel_record

LIMIT 0, 1000}

} RRS

01/21 22:25:53.175 DEBUG [$_NIOREACTOR-2-RW] (multinodequeryhandler.java:82)-execute mutinode Query select * FROM T_demo _travel_record

LIMIT 0, 1000

01/21 22:25:53.176 DEBUG [$_NIOREACTOR-2-RW] (multinodequeryhandler.java:97)-has Data Merge logic

01/21 22:25:53.176 DEBUG [$_NIOREACTOR-2-RW] (physicaldbpool.java:452)-select read source hostM1 for Datahost: Localhost1

01/21 22:25:53.176 DEBUG [$_NIOREACTOR-2-RW] (mysqlconnection.java:445) -con need syn, total syn cmd 1 commands SET n Ames Latin1; Schema Change:false con:mysqlconnection [id=11, lasttime=1453386353176, USER=MYCAT1, SCHEMA=MYCAT_DB1, old Shema=mycat _DB1, Borrowed=true, Fromslavedb=false, threadid=13, Charset=latin1, txisolation=3, Autocommit=true, attachment=dn1{ SELECT *

From T_demo_travel_record

LIMIT 0, Res[email, protected]5f81c977, Host=localhost, port=3306, Statussync=null, Writequeue=0, Modifiedsqlexecuted=false]

01/21 22:25:53.177 DEBUG [$_NIOREACTOR-2-RW] (physicaldbpool.java:452)-select read source hostM1 for Datahost: Localhost2

01/21 22:25:53.177 DEBUG [$_NIOREACTOR-3-RW] (multinodequeryhandler.java:171)-received OK response, Executeresponse: False from Mysqlconnection [id=11, lasttime=1453386353165, USER=MYCAT1, SCHEMA=MYCAT_DB1, old shema=mycat_db1, borrowed =true, Fromslavedb=false, threadid=13, Charset=latin1, txisolation=3, Autocommit=true, Attachment=dn1{SELECT *

From T_demo_travel_record

LIMIT 0, Res[email, protected]5f81c977, Host=localhost, port=3306, [email protected]1d1d49d, writequeue=0, Modifiedsqlexecuted=false]

01/21 22:25:53.177 DEBUG [$_NIOREACTOR-2-RW] (mysqlconnection.java:445)-con need syn, total syn cmd 1 commands SET names Latin1;schema Change:false con:mysqlconnection [id=9, lasttime=1453386353177, User=mycat2, SCHEMA=MYCAT_DB2, old Shema =MYCAT_DB2, Borrowed=true, Fromslavedb=false, threadid=6, Charset=latin1, txisolation=3, Autocommit=true, attachment= Dn2{select *

From T_demo_travel_record

LIMIT 0, Res[email, protected]5f81c977, Host=localhost, port=3306, Statussync=null, Writequeue=0, Modifiedsqlexecuted=false]

01/21 22:25:53.178 DEBUG [$_NIOREACTOR-3-RW] (datamergeservice.java:94)-field metadata Inf:[id=colmeta [ColIndex=0, Coltype=3], Context=colmeta [Colindex=1, coltype=253], Sharding_id=colmeta [colindex=2, coltype=3]]

01/21 22:25:53.179 DEBUG [$_NIOREACTOR-1-RW] (multinodequeryhandler.java:171)-received OK response, Executeresponse: False from Mysqlconnection [Id=9, lasttime=1453386353165, User=mycat2, SCHEMA=MYCAT_DB2, old Shema=mycat_db2, borrowed= True, Fromslavedb=false, threadid=6, Charset=latin1, txisolation=3, Autocommit=true, Attachment=dn2{select *

From T_demo_travel_record

LIMIT 0, Res[email, protected]5f81c977, Host=localhost, port=3306, [email protected]3ad876a, writequeue=0, Modifiedsqlexecuted=false]

01/21 22:25:53.179 DEBUG [$_NIOREACTOR-3-RW] (multinodequeryhandler.java:241)-on row End Reseponse MySQLConnection [id= One, lasttime=1453386353165, USER=MYCAT1, SCHEMA=MYCAT_DB1, old shema=mycat_db1, Borrowed=true, FromSlaveDB=false, Threadid=13, charset=latin1, txisolation=3, Autocommit=true, Attachment=dn1{select *

From T_demo_travel_record

LIMIT 0, Res[email, protected]5f81c977, Host=localhost, port=3306, [email protected]1d1d49d, writequeue=0, Modifiedsqlexecuted=false]

....

01/21 22:28:52.877 DEBUG [$_NIOREACTOR-2-RW] (physicaldatasource.java:403)-release channel mysqlconnection [id=2, lasttime=1453386532857, USER=MYCAT2, SCHEMA=MYCAT_DB2, old Shema=mycat_db2, Borrowed=true, FromSlaveDB=false, threadid=2,Charset=utf8,Txisolation=3, Autocommit=true, Attachment=null, Resphandler=null, Host=localhost, port=3306, StatusSync=null, Writequeue=0, Modifiedsqlexecuted=false]
01/21 22:28:59.237 DEBUG [Timer1] (sqljob.java:85)-con query Sql:select user () to con:mysqlconnection [Id=7, lasttime=145 3386539237, USER=MYCAT2, SCHEMA=MYCAT_DB2, old Shema=mycat_db2, Borrowed=true, Fromslavedb=false, threadId=4, charset= UTF8, txisolation=3, autocommit=true, Attachment=null, Resphandler=null, Host=localhost, port=3306, StatusSync=null, Writequeue=0, Modifiedsqlexecuted=false]
01/21 22:28:59.239 DEBUG [Timer1] (sqljob.java:85)-con query Sql:select user () to con:mysqlconnection [Id=13, lasttime=14 53386539239, USER=MYCAT1, SCHEMA=MYCAT_DB1, old shema=mycat_db1, Borrowed=true, Fromslavedb=false, threadId=12, Charset=utf8, Txisolation=3, Autocommit=true, Attachment=null, Resphandler=null, Host=localhost, port=3306, Statussync=null, Writequeue=0, Modifiedsqlexecuted=false]
01/21 22:28:59.239 DEBUG [$_NIOREACTOR-3-RW] (physicaldatasource.java:403)-release channel mysqlconnection [Id=7, lasttime=1453386539219, USER=MYCAT2, SCHEMA=MYCAT_DB2, old Shema=mycat_db2, Borrowed=true, FromSlaveDB=false, Threadid=4, Charset=utf8, txisolation=3, Autocommit=true, Attachment=null, Resphandler=null, Host=localhost, port= 3306, Statussync=null, Writequeue=0, Modifiedsqlexecuted=false]
01/21 22:28:59.240 DEBUG [$_NIOREACTOR-1-RW] (physicaldatasource.java:403)-release channel mysqlconnection [Id=13, lasttime=1453386539239, USER=MYCAT1, SCHEMA=MYCAT_DB1, old shema=mycat_db1, Borrowed=true, FromSlaveDB=false, Threadid=12, Charset=utf8, txisolation=3, Autocommit=true, Attachment=null, Resphandler=null, Host=localhost, port= 3306, Statussync=null, Writequeue=0, Modifiedsqlexecuted=false]

Mycat study notes. Client uses latin1 character set, backend MySQL for UTF8 character set, Mycat log parsing.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.