Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

MySQL UDF for inserting data into MongoDB

tree: 9632222c00

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 README.md
Octocat-spinner-32 lib_mysqludf_mongodb.c
README.md

lib_mysqludf_mongodb

The goal of the project is to allow MySQL triggers to store data in MongoDB. By tracking MySQL inserts/updates/deletes will not cause the MySQL database to grow, which will make backing up system critical data faster and easier.

Disclaimer: I am not a C programmer, and this code is definitely not production ready.

Requirements

Installation

  • gcc --std=c99 -shared -Wall -fPIC -I/usr/include/mysql -I/usr/local/lib/mongo-c-driver/src /usr/local/lib/mongo-c-driver/libmongoc.so /usr/local/lib/mongo-c-driver/libbson.so -o lib_mysqludf_mongodb.so lib_mysqludf_mongodb.c
  • sudo cp lib_mysqludf_mongodb.so /usr/lib/mysql/plugin/lib_mysqludf_mongodb.so
  • sudo service mysql restart

Usage

-- connect to mongoDB
-- this will only need to be called once
-- TODO accept arguments for different servers
SELECT mongodb_connect();

-- sample query
SELECT mongodb_save(firstname, lastname) FROM customers ORDER BY id DESC LIMIT 0,10;

-- disconnect from mongoDB
SELECT mongodb_disconnect();
Something went wrong with that request. Please try again.