惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
Jina AI
Jina AI
小众软件
小众软件
GbyAI
GbyAI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 【当耐特】
D
DataBreaches.Net
腾讯CDC
V
Visual Studio Blog
博客园 - 叶小钗
B
Blog
Apple Machine Learning Research
Apple Machine Learning Research
T
The Blog of Author Tim Ferriss
S
SegmentFault 最新的问题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
V2EX
博客园 - 三生石上(FineUI控件)
云风的 BLOG
云风的 BLOG
The Cloudflare Blog
MongoDB | Blog
MongoDB | Blog
有赞技术团队
有赞技术团队
U
Unit 42
博客园 - 司徒正美
博客园 - 聂微东

博客园 - forrestsun

问题整理 weedfs getsockopt: connection timed out 利用cubieboard设置samba打印服务器 CubieTruck上安装mjpg_streamer devexpress bandgridview使用总结(14.2) WeedFS0.6.8-引用库列表 WeedFS问题收集 WeedFS依赖库 0.6.1 golang 前置补0 MongoDB-MMS使用总结 golang 格式化时间为字符串 格式化字符串为时间学习总结 mgo-后续测试(指定字段,获取id) mgo中DBRef-数据查询测试 mgo中DBRef-数据添加测试 weed-fs 基础测试 weed-fs 压力测试 weed-fs参数列表 mgo like的两种写法
NSQ的消息订阅发布测试
forrestsun · 2014-08-05 · via 博客园 - forrestsun

在测试NSQ的Quick Start发现这样一个问题,就是同时只能有一个订阅实例

$ nsq_to_file --topic=test --output-dir=/tmp --lookupd-http-address=127.0.0.1:4161 

当存在两个实例时则消息会被发送给其中的一个实例,而另一个则获取不到消息

在阅读到NSQ中NSQD的启动参数时,发现其支持在一个topic下建立多个channel,通过向topic发送消息,会向所有的channel发布。

测试

//创建topic
$ curl http://10.191.197.209:4151/create_topic?topic=public

//创建三个channel

$ curl http://10.191.197.209:4151/create_channel?topic=public\&channel=t1
$ curl http://10.191.197.209:4151/create_channel?topic=public\&channel=t2
$ curl http://10.191.197.209:4151/create_channel?topic=public\&channel=t3

//建立nsqdata t1 t2 t3四个文件夹分别存放nsqd数据及三个测试channel数据
mkdir nsqdata t1 t2 t3

//启动nsqd,nsqd可以独立启动,无需启动nsqlookupd
nsqd -data-path=/home/sunsl/nsqdata

//启动三个channel的接收端,这里使用nsq_to_file监听nsqd的tcp端口
nsq_to_file --topic=public --channel=t1 --output-dir=/home/sunsl/t1 --nsqd-tcp-address=127.0.0.1:4150
nsq_to_file --topic=public --channel=t2 --output-dir=/home/sunsl/t2 --nsqd-tcp-address=127.0.0.1:4150
nsq_to_file --topic=public --channel=t3 --output-dir=/home/sunsl/t3 --nsqd-tcp-address=127.0.0.1:4150

//向public发送测试数据
curl -d '向三个channel发送数据' 'http://10.191.197.209:4151/put?topic=public'
//cat t1,t2,t3文件夹下的log文件,数据显示正常获取

问题

  • 接收数据有延迟,原因未知,待查