Re: How to create a SQL engine like MySQL server
harryxiyou <[email protected]> Sat, 31 Jan 2015 10:51:34 +0800
| Newsgroups | gmane.comp.db.mysql.devel |
|---|---|
| Message-ID | <CAD+1EGM2aC4B+5tt08LuGMo=fhPGuboNxOLAkDrZA45yDcB+-w@mail.gmail.com> |
On Sat, Jan 31, 2015 at 3:34 AM, Vlad Lesin <[email protected]> wrote: > On 01/30/2015 07:23 PM, harryxiyou wrote: >>> >>> percona-playback inherits the code which parses mysql protocol from >>> "mysqlsniffer"(can be found here: >>> https://github.com/daniel-nichter/hackmysql.com). >> >> I don't think you give what I want. Because mysqlsniffer just captures >> MySQL packages pass through one deveice. However, ***I care how to >> design/implement a lightweight SQL server side (like MySQL server) *to >> be cannected* by MySQL client***. > > > Steward suggested you percona-playback as an example of parsing mysql > protocol. percona-playback can parse tcpdump files and send captured queries > to server. It uses mysqlsniffer code for parsing mysql protocol. To accept > mysql client connections you have to parse mysql protocol, so mysqlsniffer > can be used at least as a guide(see for example state_map[], > pkt_handshake_client(), pkt_handshake_server()). > ACK. See following experiment I use mysqlsniffer but I cannot see any package it captures. harryxiyou@common_vm ~ $ mysql -h127.0.0.1 -P4041 -uadmin -p123 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.0.99-agent-admin Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> exit Bye harryxiyou@common_vm ~ $ mysql-proxy --admin-username=admin --admin-password=123 --proxy-backend-addresses=127.0.0.1:8875 2015-01-31 10:45:09: (critical) chassis.c:968: could not raise RLIMIT_NOFILE to 8192, Invalid argument (22). Current limit still 1024. harryxiyou@common_vm ~/workshop1/hackmysql.com/mysqlsniffer $ sudo ./mysqlsniffer lo mysqlsniffer listening for MySQL on interface lo port 3306 ^C0 MySQL packets captured (0 bytes) Actually, the SQL engine (server side) should listen with an IP and port (loop there). The MySQL client could connect by the IP and port. Yes, it is what MySQL protocol does ;-) Thanks, Harry -- MySQL Internals Mailing List For list archives: http://lists.mysql.com/internals To unsubscribe: http://lists.mysql.com/internals