ZeroMQ for MySQL
https://github.com/netkiller/mysql-zmq-plugin
Build
git clone https://github.com/netkiller/mysql-zmq-plugin.git
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)
Example
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)
the zmq_client('socket','message') funciton ,whe message==NULL mysql server will crash, mysql Version=Ver 14.14 Distrib 5.6.28
9:14:16 UTC - mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.
key_buffer_size=8388608
read_buffer_size=16777216
max_used_connections=38
max_threads=800
thread_count=37
connection_count=37
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 39340442 K bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
Thread pointer: 0x46d304b0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong…
stack_bottom = 7fdaf8c29d30 thread_stack 0x40000
/usr/sbin/mysqld(my_print_stacktrace+0x3b)[0x91068b]
/usr/sbin/mysqld(handle_fatal_signal+0x491)[0x693c81]
/lib64/libpthread.so.0(+0xf130)[0x7fe5be672130]
/lib64/libc.so.6(+0x162811)[0x7fe5bcf52811]
/usr/lib64/mysql/plugin/libzeromq.so(zmq_client+0xb4)[0x7fe5745f7f05]
/usr/sbin/mysqld(_ZN11udf_handler7val_strEP6StringS1_+0x87)[0x62f537]
/usr/sbin/mysqld(_ZN17Item_func_udf_str7val_strEP6String+0x1c)[0x62f5fc]
/usr/sbin/mysqld(_ZN4Item4sendEP8ProtocolP6String+0x237)[0x5dea67]
/usr/sbin/mysqld(_ZN8Protocol19send_result_set_rowEP4ListI4ItemE+0xc5)[0x68d445]
/usr/sbin/mysqld(_ZN11select_send9send_dataER4ListI4ItemE+0x5f)[0x6e1c8f]
/usr/sbin/mysqld[0x6f5ff0]
/usr/sbin/mysqld[0x6f14ef]
/usr/sbin/mysqld(_Z10sub_selectP4JOINP13st_join_tableb+0x149)[0x6f1899]
/usr/sbin/mysqld(_ZN4JOIN4execEv+0x2e8)[0x6f0a78]
/usr/sbin/mysqld(_Z12mysql_selectP3THDP10TABLE_LISTjR4ListI4ItemEPS4_P10SQL_I_ListI8st_orderESB_S7_yP13select_resultP18st_select_lex_unitP13st_select_lex+0x275)[0x73c6d5]
/usr/sbin/mysqld(_Z13handle_selectP3THDP13select_resultm+0x165)[0x73cf35]
/usr/sbin/mysqld[0x5816e8]
/usr/sbin/mysqld(_Z21mysql_execute_commandP3THD+0x1cb5)[0x714965]
/usr/sbin/mysqld(_Z11mysql_parseP3THDPcjP12Parser_state+0x3b8)[0x71a9d8]
/usr/sbin/mysqld[0x71b231]
/usr/sbin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0x1b72)[0x71d5f2]
/usr/sbin/mysqld(_Z10do_commandP3THD+0x27b)[0x71f10b]
/usr/sbin/mysqld(_Z24do_handle_one_connectionP3THD+0x162)[0x6e7622]
/usr/sbin/mysqld(handle_one_connection+0x40)[0x6e77e0]
/usr/sbin/mysqld(pfs_spawn_thread+0x143)[0xb55993]
/lib64/libpthread.so.0(+0x7df5)[0x7fe5be66adf5]
/lib64/libc.so.6(clone+0x6d)[0x7fe5bcee61ad]
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7fdadc00f640): is an invalid pointer
Connection ID (thread ID): 52
Status: NOT_KILLED
the problem has bean resloved bad code line 43 at zeromq.c,the function strlen argument not be a NULL value