ITPub博客

首页 > 数据库 > > nanomsg 如何写数据到PipelineDB

nanomsg 如何写数据到PipelineDB

作者:飘絮絮絮丶 时间:2022-03-01 10:16:26 0 删除 编辑

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() 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
------
( rows)

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

pipeline=#

 

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

 

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

 

运用场景:

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


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69946831/viewspace-3163507/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-09-09

  • 博文量
    2646
  • 访问量
    42236