nanomsg 如何写数据到PipelineDB

nanomsg:https://github.com/nanomsg/nanomsg

PipelineDB:https://github.com/pipelinedb/pipelinedb

nanomsgToPipelineDB:https://github.com/sangli00/nanomsgtopdb

 

创建extension

pipeline=# create extension nanomsgtopdb ;
CREATE EXTENSION

 

 默认数据接收流

pipeline=# \d generic_stream
         Stream "public.generic_stream"
      Column       |            Type
-------------------+-----------------------------
 data              | text
 arrival_timestamp | timestamp(0) with time zone

pipeline=#

 

创建Continuous View

pipeline=# create continuous view cv as select data from generic_stream;
CREATE CONTINUOUS VIEW
pipeline=# \d cv
Continuous view "public.cv"
 Column | Type | Modifiers
--------+------+-----------
 data   | text |

pipeline=#

 

发送数据:

[root@localhost test]# ./send_msg
connect to tcp://127.0.0.1:9999
Send msg size is 64

pipeline=# select * from cv;
 data
------
(0 rows)

pipeline=# select * from cv;
           data
--------------------------
 Hello ,from nanomsg msg.
(1 row)

pipeline=#

 

运用PostgreSQL来创建后台进程,如图所示:

 

多nanomsg worker process进行数据写入,提高数据接收速度。

 

运用场景:

在底层数据采集的时候,原始数据直接写入到Stream生成CV结果。

 

posted @ 2017-05-03 22:20  Li.Sang  阅读(928)  评论(0编辑  收藏  举报