NSQ的HTTP API
来源:互联网 发布:改良圈算法 编辑:程序博客网 时间:2024/06/05 05:24
/ping liveness
/info version
/stats comprehensive runtime telemetry
/pub - publish a message to a topic
/mpub - publish multiple messages to a topic
/config - configure nsqd
/debug/pprof - pprof debugging portal
/debug/pprof/profile - generate pprof CPU profile
/debug/pprof/goroutine - generate pprof goroutine profile
/debug/pprof/heap - generate pprof heap profile
/debug/pprof/block - generate pprof blocking profile
/debug/pprof/threadcreate - generate pprof OS thread profile
v1 namespace (as of nsqd v0.2.29+):
/topic/create - create a new topic
/topic/delete - delete a topic
/topic/empty - empty a topic
/topic/pause - pause message flow for a topic
/topic/unpause - unpause message flow for a topic
/channel/create - create a new channel
/channel/delete - delete a channel
/channel/empty - empty a channel
/channel/pause - pause message flow for a channel
/channel/unpause - unpause message flow for a channel
• /ping - 活跃度
• /info - 版本
• /stats - 检查综合运行
• /pub - 发布消息到话题(topic)
• /mpub - 发布多个消息到话题(topic)
• /debug/pprof - pprof 调试入口
• /debug/pprof/profile - 生成 pprof CPU 配置文件
• /debug/pprof/goroutine - 生成 pprof 计算配置文件
• /debug/pprof/heap - 生成 pprof 堆配置文件
• /debug/pprof/block - 生成 pprof 块配置文件
• /debug/pprof/threadcreate - 生成 pprof OS 线程配置文件
v1 命名空间 (as of nsqd v0.2.29+ ):
• /topic/create - 创建一个新的话题(topic)
• /topic/delete - 删除一个话题(topic)
• /topic/empty - 清空话题(topic)
• /topic/pause - 暂停话题(topic)的消息流
• /topic/unpause - 恢复话题(topic)的消息流
• /channel/create - 创建一个新的通道(channel)
• /channel/delete - 删除一个通道(channel)
• /channel/empty - 清空一个通道(channel)
• /channel/pause - 暂停通道(channel)的消息流
• /channel/unpause - 恢复通道(channel)的消息
POST
/pub
发布消息
Query Params:
topic - the topic to publish to
Body:
raw message bytes
Example:
$ curl -d "<message>" http://127.0.0.1:4151/pub?topic=name
POST
/mpub
一次发多条消息
Query Params:
topic - the topic to publish tobinary - bool ('true' or 'false') to enable binary mode
Body
\n separated raw message bytes
NOTE: 多条消息用\n
分割, 使用 ?binary=true
参数时,将启用binary mode,但是post body需要符合以下形式,HTTP Content-Length
header 需要被发送,长度为POST
body的长度
[ 4-byte num messages ][ 4-byte message #1 size ][ N-byte binary data ] ... (repeated <num_messages> times)
Example:
$ curl -d "<message>\n<message>\n<message>" http://127.0.0.1:4151/mpub?topic=name
POST
/topic/create
弃用名字: /create_topic
创建topic
Query Params:
topic - the topic to create
Example:
$ curl -X POST http://127.0.0.1:4151/topic/create?topic=name
POST
/topic/delete
弃用名字: /delete_topic
删除一个存在的topic,包括所有的channel
Query Params:
topic - the existing topic to delete
Example:
$ curl -X POST http://127.0.0.1:4151/topic/delete?topic=name
POST
/channel/create
弃用名字: /create_channel
从一个已经存在的topic上创建channel
Query Params:
topic - the existing topicchannel - the channel to create
Example:
$ curl -X POST http://127.0.0.1:4151/channel/create?topic=name&channel=name
POST
/channel/delete
Deprecated alias: /delete_channel
在一个存在的topic上删除一个channel
Query Params:
topic - the existing topicchannel - the existing channel to delete
Example:
$ curl -X POST http://127.0.0.1:4151/channel/delete?topic=name&channel=name
POST
/topic/empty
Deprecated alias: /empty_topic
清空一个topic里所有的队列消息(包括内存和硬盘里的)
Query Params:
topic - the existing topic to empty
Example:
$ curl -X POST http://127.0.0.1:4151/topic/empty?topic=name
POST
/channel/empty
Deprecated alias: /empty_channel
清空一个channel里所有的队列消息(包括内存和硬盘里的)
Query Params:
topic - the existing topicchannel - the existing channel to empty
Example:
$ curl -X POST http://127.0.0.1:4151/channel/empty?topic=name&channel=name
POST
/topic/pause
Deprecated alias: /pause_topic
暂停发送消息到所有的channel,消息将会暂时队列在topic内部
Pause message flow to all channels on an existing topic (messages will queue at topic)
Query Params:
topic - the existing topic
Example:
$ curl -X POST http://127.0.0.1:4151/topic/pause?topic=name
POST
/topic/unpause
Deprecated alias: /unpause_topic
终止暂停,继续发送消息到channel
Resume message flow to channels of an existing, paused, topic
Query Params:
topic - the existing topic
Example:
$ curl -X POST http://127.0.0.1:4151/topic/unpause?topic=name
POST
/channel/pause
Deprecated alias: /channel_pause
暂停发送消息到消费者,消息被队列在channel
Pause message flow to consumers of an existing channel (messages will queue at channel)
Query Params:
topic - the existing topicchannel - the existing channel to pause
Example:
$ curl -X POST http://127.0.0.1:4151/channel/pause?topic=name&channel=name
POST
/channel/unpause
Deprecated alias: /unpause_channel
继续发送消息到消费者
Resume message flow to consumers of an existing, paused, channel
Query Params:
topic - the existing topicchannel - the existing channel to pause
Example:
$ curl -X POST http://127.0.0.1:4151/channel/unpause?topic=name&channel=name
GET
/stats
返回内部的统计信息
Return internal statistics
Query Params
format - (optional) `text` or `json` (default = `text`)topic - (optional) filter to topicchannel - (optional) filter to channel
Example:
$ curl http://127.0.0.1:4151/stats
GET
/ping
监控终端,返回200是没有问题的,返回500的就是有问题“unhealthy”的。
Monitoring endpoint, should return 200
OK
. It returns an HTTP 500
if it is not healthy.
NOTE: The only “unhealthy” state is if nsqd
failed to write messages to disk when overflow occurred.
目前唯一会出现这种情况的是当发生内存中的消息溢出的时候,nsqd不能把消息写到硬盘上。
GET
/info
Version information
返回版本信息GET
/debug/pprof
An index page of available debugging endpoints
可用的调试节点的页码GET
/debug/pprof/profile
Starts a pprof
CPU profile for 30s and returns the output via the request
NOTE: this endpoint is not listed in the /debug/pprof
index page because of its effect on runtime performance.
由于这些节点处在运行时,所有这些节点将不在debug/pprof展示的页码中显示
GET
/debug/pprof/goroutine
Returns a stack trace for all running goroutines
返回所有运行的go路由的栈跟踪GET
/debug/pprof/heap
Returns a heap and memstats profile (top portion can be used as a pprof
memory profile)
GET
/debug/pprof/block
返回 goroutine 块配置信息GET
/debug/pprof/threadcreate
返回 goroutine 栈记录 GET
/config/nsqlookupd_tcp_addresses
nsqlookupd TCP addresses的列表
Example:
$ curl http://127.0.0.1:4151/config/nsqlookupd_tcp_addresses
PUT
/config/nsqlookupd_tcp_addresses
更新 nsqlookupd TCP addresses.
Body:
JSON array of TCP addresses.
Example:
$ curl -X PUT http://127.0.0.1:4151/config/nsqlookupd_tcp_addresses \ -d '["127.0.0.1:4160", "127.0.0.2:4160"]'
PUT
/config/nsqlookupd_tcp_addresses
PUT
/config/nsqlookupd_tcp_addresses
Update the nsqlookupd TCP addresses.
Body:
JSON array of TCP addresses.
Example:
$ curl -X PUT http://127.0.0.1:4151/config/nsqlookupd_tcp_addresses \ -d '["127.0.0.1:4160", "127.0.0.2:4160"]'
- NSQ的HTTP API
- NSQ的设计特点:
- nsq
- nsq
- nsq源码导读(1.1) nsq的核心nsqd
- ubuntu下nsq的安装
- NSQ的golang客户端简单使用
- NSQ的安装运行以及编程实践
- nsq topic和channel的区别
- golang实时消息平台NSQ的使用
- nsq源码阅读 nsqlookupd源码五 http.go http_server.go
- nsq源码分析(2):nsqlookup之http服务
- windows的http api分析
- nsq 学习
- NSQ简介
- 通过HTTP通信的API的安全
- BaseHTTPServer — Basic HTTP server的API
- restful api 的HTTP认证访问方式
- javascript的函数节流
- 练习随笔16.09.29
- scala console 用:paste 多行输入 以及load加载本地文件
- Android常使用倒计时
- openwrt MT7620的无线MAC地址修改
- NSQ的HTTP API
- 关于Eclipse Java EE中默认的配置Tomcat,启动后访问http://locaohost:8080/,出现404错
- Qt利用QSplashScreen类自定义初始化启动界面
- CentOS+Nginx一步一步开始配置负载均衡
- PHP : mysqli【面向对象】操作数据库【连接、增、删、改、查】
- 如何使用Java List等集合类的removeAll方法
- Ajax, 选择GET还是POST?(转)
- 用于音频对讲: 解g711u数据流和压缩pcm的数据流的方法
- Java实现二分查找--非递归