{"id":13526463,"url":"https://github.com/changba/nsqproxy","last_synced_at":"2026-01-12T07:46:14.218Z","repository":{"id":54585185,"uuid":"324894326","full_name":"changba/nsqproxy","owner":"changba","description":"NSQProxy是NSQ和Worker之间的中间件，根据配置负责消息转发。然后通过HTTP/FastCGI/CBNSQ等协议转发给Worker机执行。","archived":false,"fork":false,"pushed_at":"2021-03-08T10:41:30.000Z","size":2143,"stargazers_count":81,"open_issues_count":0,"forks_count":9,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-21T11:03:17.746Z","etag":null,"topics":["cbnsq","fastcgi","http","mysql","nsq","nsq-client","nsqproxy-nsq-worker","vue"],"latest_commit_sha":null,"homepage":"https://github.com/changba/nsqproxy","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/changba.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-28T02:38:21.000Z","updated_at":"2024-04-23T12:13:43.000Z","dependencies_parsed_at":"2022-08-13T20:31:22.703Z","dependency_job_id":null,"html_url":"https://github.com/changba/nsqproxy","commit_stats":null,"previous_names":["changbaserver/nsqproxy","changba-server/nsqproxy"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/changba%2Fnsqproxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/changba%2Fnsqproxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/changba%2Fnsqproxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/changba%2Fnsqproxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/changba","download_url":"https://codeload.github.com/changba/nsqproxy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246600825,"owners_count":20803489,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cbnsq","fastcgi","http","mysql","nsq","nsq-client","nsqproxy-nsq-worker","vue"],"created_at":"2024-08-01T06:01:30.083Z","updated_at":"2026-01-12T07:46:14.171Z","avatar_url":"https://github.com/changba.png","language":"Go","readme":"# NSQProxy\nNSQProxy是Golang开发的NSQ和Worker之间的中间件，根据数据库配置，负责消息转发。NSQProxy启动后，接受NSQD队列内容，然后通过HTTP/FastCGI/CBNSQ等协议转发给Worker机执行。在唱吧内部使用2年，高效稳定的处理着每日数十亿条消息。\n\n[![go report card](https://goreportcard.com/badge/github.com/changba/nsqproxy \"go report card\")](https://goreportcard.com/report/github.com/changba/nsqproxy)\n[![MIT license](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://github.com/changba/nsqproxy/blob/master/LICENSE)\n[![Downloads](https://img.shields.io/github/downloads/changba/nsqproxy/total.svg)](https://github.com/changba/nsqproxy/releases)\n[![Release](https://img.shields.io/github/release/changba/nsqproxy.svg?label=Release)](https://github.com/changba/nsqproxy/releases)\n\n## 解决的问题\n\n* 各Topic执行机器可配\n* 各Topic消费速度可配\n* 各Worker机协议可配\n    * HTTP：将消息发送给配好的URL。\n    * FastCGI：将消息发送给配置的服务端，如PHP-FPM。\n    * CBNSQ：自定义的基于TCP的文本协议。\n* 可视化界面管理\n* 队列积压超出阈值报警\n* 散乱在各处的消费者集中化管理\n* 通过网络分发，无需安装.so等扩展库，因此无需修改线上环境\n\n\n## 有图有真相\n\n![流程图](assets/images/nsqproxy_flow_chart.png)\n\n![消费者管理](assets/images/admin_consume_config.png)\n\n![worker机管理](assets/images/admin_work_server.png)\n\n## 使用\n请先部署好NSQLookupd、NSQd、MySQL\n\n\u003e 启动NSQLookupd `nsqlookupd -broadcast-address=\"0.0.0.0\" -http-address=\"0.0.0.0:4161\" -tcp-address=\"0.0.0.0:4160\"`\n\n\u003e 启动NSQD `nsqd -broadcast-address=\"0.0.0.0\" -lookupd-tcp-address=\"0.0.0.0:4160\" -tcp-address=\"0.0.0.0:4150\" -http-address=\"0.0.0.0:4151\"`\n\n\u003e 启动MySQL\n\n### 安装\n\n#### 二进制安装\n\n* 下载最新版本的压缩包 https://github.com/changba/nsqproxy/releases\n* 解压\n* 启动（注意替换为自己的MySQL信息） `./nsqproxy -dbHost=127.0.0.1 -dbPort=3306 -dbUsername=root -dbPassword=rootpsd -dbName=nsqproxy -logLevel=debug -nsqlookupdHTTP=127.0.0.1:4161`\n* 命令行 `curl http://0.0.0.0:19421/status` 输出ok\n* 浏览器打开 http://0.0.0.0:19421/admin\n\n#### 源码安装\n\n* 要求Go1.13及以上\n* 下载本项目 `go get github.com/changba/nsqproxy`\n* `cd nsqproxy`\n* `export GO111MODULE=on`\n* 编译 `make build`\n* 启动（注意替换为自己的MySQL信息） `./bin/nsqproxy -dbHost=127.0.0.1 -dbPort=3306 -dbUsername=root -dbPassword=rootpsd -dbName=nsqproxy -logLevel=debug -nsqlookupdHTTP=127.0.0.1:4161`\n* 命令行 `curl http://0.0.0.0:19421/status` 输出ok\n* 浏览器打开 http://0.0.0.0:19421/admin\n\n### 快速开始\n\n* [快速体验](document/doc/quick_start.md)\n* [启动参数](document/doc/flag.md)\n* [make命令](document/doc/make.md)\n* [文档](document/doc/README.md)\n\n## 二次开发\n\n### 前端\n使用VUE开发，所有源码均在/web/vue-admin目录中，开发完成后需要编译，编译后的文件存放在/web/public/目录中。使用开源项目statik将静态文件/web/public/变成一个go文件internal/statik/statik.go，这样前端的静态文件也会被我们编译到同一个二进制文件中了。\n\n* 启动go服务 `make run`\n* 安装VUE `make vue-install`（如果国内被墙可以使用淘宝的源进行安装：make vue-install-taobao）\n* 开启VUE开发环境 `make vue-dev`\n* 浏览器打开 http://0.0.0.0:9528/admin\n* 开发前端相关功能\n* 编译VUE `make vue-build`\n* 前段文件转换为一个go文件 `make statik`\n* 编译go服务 `make build`\n* 浏览器打开 http://0.0.0.0:19421/admin\n\n### 接口文档\n* 通过接口对数据库增删改查：[查看接口文档](document/api/README.md)\n\n## TODO LIST\n\n* 协议增加protobuf\n* 后台增加用户权限管理\n* 报警HOOK\n* 日志按天分割\n\n## License\n\n© [Changba.com](https://changba.com), 2020~time.Now\n\nReleased under the [MIT License](https://github.com/changba/nsqproxy/blob/main/LICENSE)","funding_links":[],"categories":["消息队列"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchangba%2Fnsqproxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchangba%2Fnsqproxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchangba%2Fnsqproxy/lists"}