GithubHelp home page GithubHelp logo

skyformat99 / mysql-zmq-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from netkiller/mysql-zmq-plugin

0.0 2.0 0.0 9 KB

ZeroMQ / ØMQ for MySQL

Home Page: http://netkiller.github.io/

License: BSD 3-Clause "New" or "Revised" License

CMake 6.31% C 86.66% PHP 7.03%

mysql-zmq-plugin's Introduction

mysql-zmq-plugin

Join the chat at https://gitter.im/netkiller/mysql-zmq-plugin

ZeroMQ / ØMQ for MySQL

http://zeromq.org/event:zeromq-for-mysql

Build

# yum install zeromq3-devel

# cmake .
# make && make install

Install & uninstall

drop function zmq_client;
drop function zmq_publish;

create function zmq_client returns string soname 'libzeromq.so';
create function zmq_publish returns string soname 'libzeromq.so';

mysql> SELECT * FROM `mysql`.`func` LIMIT 1000;
+--------------+-----+--------------+----------+
| name         | ret | dl           | type     |
+--------------+-----+--------------+----------+
| image_crc32  |   0 | image.so     | function |
| image_rename |   0 | image.so     | function |
| image_move   |   0 | image.so     | function |
| image_remove |   0 | image.so     | function |
| image_check  |   0 | image.so     | function |
| fifo_write   |   0 | fifo.so      | function |
| fifo_read    |   0 | fifo.so      | function |
| fifo_remove  |   0 | fifo.so      | function |
| fifo_create  |   0 | fifo.so      | function |
| zmq_publish  |   0 | libzeromq.so | function |
| zmq_client   |   0 | libzeromq.so | function |
+--------------+-----+--------------+----------+
11 rows in set (0.00 sec)

Test

编译zeromq server 测试程序

cd test
cmake .
make
./server

在mysql终端中运行测试SQL

mysql> select zmq_client('tcp://localhost:5555','Hello world!');
+---------------------------------------------------+
| zmq_client('tcp://localhost:5555','Hello world!') |
+---------------------------------------------------+
| Hello world! OK                                   |
+---------------------------------------------------+
1 row in set (0.01 sec)

mysql> select zmq_client('tcp://localhost:5555',mobile) from demo;
+-------------------------------------------+
| zmq_client('tcp://localhost:5555',mobile) |
+-------------------------------------------+
| 13113668891 OK                            |
| 13113668892 OK                            |
| 13113668893 OK                            |
| 13322993040 OK                            |
| 13588997745 OK                            |
+-------------------------------------------+
5 rows in set (0.03 sec)

手工编译

gcc -O3  -g  -I/usr/include/mysql -I/usr/include  -fPIC -lm -lz -shared -o libzeromq.so zeromq.c
sudo mv libzeromq.so /usr/lib/mysql/plugin/

Bitdeli Badge

mysql-zmq-plugin's People

Contributors

bitdeli-chef avatar gitter-badger avatar netkiller avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.