DeNA / HandlerSocket-Plugin-for-MySQL

HandlerSocket is a NoSQL plugin for MySQL, working as a daemon inside the mysqld process, to accept tcp connections, and execute requests from clients. HandlerSocket does not support SQL queries; instead it supports simple CRUD operations on tables.
Other
1.13k stars 150 forks source link

Unable to insert a record via handlersocket - returns [2, "readonly"] #69

Closed andy318 closed 12 years ago

andy318 commented 12 years ago

I have HandlerSocket running on MySQL 5.1.58 on OS X. I used the instructions in this gist - https://gist.github.com/1461033 I can see that i have the plugin loaded into MySQL and 'show processlist' shows 16 read handlersocket threads and 1 write thread.

My table structure is simple - CREATE TABLE hs_availability ( listing_id int(11) NOT NULL, state int(11) NOT NULL, PRIMARY KEY (listing_id) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

I tried inserting a record over telnet and i get the readonly error. I can insert records via SQL and can query records using handlersocket just fine. $ telnet 127.0.0.1 9998 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. P 0 dev_db hs_availability PRIMARY listing_id,state 2 1 cmd P 0 platphorm_development hs_availability PRIMARY listing_id,state 0 1 0 = 1 2828 0 2 2828 3 0 + 1 2829 1 2 1 readonly

WheresWardy commented 12 years ago

By default HandlerSocket has a port for reading (9998) and a port for writing (9999). You're using the read-only port in your example, so try changing it to 9999 and see what happens (that will connect to the write thread you see in the processlist).

andy318 commented 12 years ago

Yes, that worked. Thanks!