Severalnines


PROJECTS

Gearman worker for MySQL Cluster

This is also discussed in this article and this is very alfa. Code is here.

  • Get Google Protocol Buffers 2.3 or later
  • tar xvfz protobuf-2.3.0.tar.gz
    protobuf-2.3.0
    ./configure
    make
    sudo make install
  • Get Gearman
  • tar xvfz gearmand-0.11.tar.gz
    gearmand-0.11
    ./configure
    make
    sudo make install
  • Start a MySQL Cluster (you need MySQL Cluster include and libraries on the computer where you will build gearman-ndbapi)
  • Get gearman-ndbapi
  • tar xvfz gearman-ndbapi.tar.gz
    gearman-ndbapi
    sh ./compile-all.sh
  • Start gearman (in another terminal)
  • /usr/local/sbin/gearmand
  • Start the worker (in another terminal)
  • ./worker
  • Create the SQL table
  • mysql> create table Person(id integer primary key, salary integer, name varchar(128), message varchar(1024))engine=ndb;
  • The proto files are in proto/
  • > cat proto/Person.proto
    message Person {
    required int32 id = 1;
    optional string name = 2;
    optional string message = 3;
    }
    > cat proto/NdbMessage.proto
    // import the relevant protos that can be in
    // the NdbMessage
    import "Person.proto";
    message NdbMessage {
    enum Type { Person=1;}
    // Identifies which field is filled in.
    required Type type = 1;
    // list of possible protos comes here:
    optional Person person = 2;
    }
  • Start the clients
  • ./set_client
    ./get_client 1
  • Check the source code