Ilya Bylich

Page 2

Experimental MySQL HTTP API and Ruby

Yes, MySQL has an HTTP API which is:

  1. an experimental feature
  2. it ships as a native plugin only for 5.7 version (

Basically, it allows you to work with your database in the following ways:

  1. as an SQL endpoint
  2. as a CRUD endpoint
  3. as a JSON document endpoint

SQL endpoint

It gives an ability to run queries like

GET http://host:port/sql/:database/:query

For example

GET http://localhost:8080/sql/testdb/SELECT+1

is a synonym of SQL’s SELECT 1.

CRUD endpoint

Interface is:

GET http://host:port/crud/:database/:table/:id


GET http://localhost:8080/crud/test_db/test_table/101'


SELECT * FROM `test_db`.`test_table` WHERE `test_table`.`id` = 101

JSON document endpoint

Basically, with this endpoint your table has only 3 fields:

mysql> describe test_db.test_table;
| Field  |

Continue reading →

ExceptionManager gem

ExceptionManager is a gem for getting extra information from your exception.

Source code:

With this gem every time when you get an exception, it’s possible to grab subject of exception (the instance of class where raise happened), locals - local variables, subject_instance_variables and subject_class_variables


require 'exception_manager'

class TestClassThatRaisesException
  @@class_variable = :class_value

  def test_error(*args)
    @instance_variable = :instance_value

    raise 'Test error'

begin, 2, 3)
rescue => e
  puts "Subject: {e.subject}"
  puts "Locals: {e.locals}"
  puts "Instance variables: {e.subject_instance_variables}"
  puts "Class variables: {e.subject_class_variables}"
  puts "Summary: {e.summary.inspect}"

This code...

Continue reading →

Redis cluster. Quick overview

Today I’ve tested version 3.0.0 of Redis server with includes Redis cluster. Here are some first thoughts about this.


Here are my servers:  / / node1 / / node2  / / node3

Local hosts (on each server):

 local hosts node1 node2 node3

And remote (on my PC):

 remote hosts  node1 node2  node3

First of all, let’s download and extract it (on each node).

mkdir build && cd build
tar -xvzf redis-3.0.0.tar.gz
cd redis-3.0.0/

Now we can build it

apt-get install -y make gcc build-essential
make MALLOC=libc  also jemalloc can be used

Now let’s run tests

apt-get install -y tk8.5 tcl8.5
make test
 a lot of output, should be green

Then we...

Continue reading →