原文链接:https://nsq.io/deployment/production.html

Although nsqd can run as a single standalone node these notes assume you want to take advantage of the distributed nature of its design.

虽然“nsqd”可以作为一个单独的节点运行,但这些注释假定您希望利用其设计的分布式特性。

There are three separate binaries that need to be installed and running:

有三个单独的二进制文件需要安装和运行:

nsqd 守护进程

nsqd is the daemon that receives, buffers, and delivers messages to clients.

nsqd 是一个守护进程,它接收、缓冲并向客户端发送消息。

All configuration is managed via command line parameters. We strive for the default configuration to be adequate for most use cases however a few specific options are worth noting:

所有配置都通过命令行参数进行管理。我们努力使默认配置适合大多数用例,但是有几个特定的选项值得注意:

--mem-queue-size adjusts the number of messages queued in memory per topic/channel. Messages over that watermark are transparently written to disk, defined by --data-path.

--mem-queue-size调整每个主题/通道在内存中排队的消息数量。水印上的消息透明地写入磁盘,由 --data-path定义。

Also, nsqd will need to be configured with nsqlookupd addresses (see below for details). Specify --lookupd-tcp-address options for each instance.

此外,nsqd 将需要配置 nsqlookupd地址(详情见下文).为每个实例指定 --lookupd-tcp-address 选项。

In terms of topology, we recommend running nsqd co-located with services producing messages.

就扩展优化而言,我们建议运行“nsqd”与生成消息的服务共存。

nsqd can be configured to push data to statsd by specifying --statsd-address. nsqd sends stats under the nsq.*namespace. See nsqd statsd.

可以将nsqd 配置为通过指定 --statsd-address将数据推送到statsd。'nsqd nsq.* 名称空间下发送统计信息。看 nsqd statsd

nsqlookupd 管理拓扑信息的守护进程

nsqlookupd is the daemon that provides a runtime discovery service for consumers to find nsqd producers for a specific topic.

nsqlookupd是一个守护进程,它为使用者提供了一个运行时发现服务,以便为特定主题找到nsqd生产者。

It maintains no persistent state and does not need to coordinate with any other nsqlookupd instances to satisfy a query.

它不维护持久状态,也不需要与任何其他“nsqlookupd”实例进行协调来满足查询。

Run as many as you want based on your redundancy requirements. They use few resources and can be co-located with other services. Our recommendation is to run a cluster of at least 3 per datacenter.

根据您的冗余需求运行任意多的命令.它们使用很少的资源,并且可以与其他服务共存.我们的建议是每个数据中心至少运行3个集群。

nsqadmin web服务

nsqadmin is a web service for realtime instrumentation and administration of your NSQ cluster. It talks to nsqlookupd instances to locate producers and leverages graphite for charts (requires enabling statsd on the nsqd side).

nsqadmin 是一个用于NSQ集群的实时检测和管理的web服务,它与“nsqlookupd”实例对话,以定位生产者并利用graphite绘制图表(需要在nsqd端启动statsd).

You only need to run 1 of these and make it accessible publicly (securely).

您只需要运行其中的一个,并使其可以公开(安全地)访问。

To display charts from graphite, specify --graphite-url.

要显示来自graphite的图表,请指定--graphite-url

If you’re using a version of statsd that adds those silly prefixes to all keys, also specify --use-statsd-prefixes.

如果您使用的是一个版本的statsd,它将那些愚蠢的前缀添加到所有键,还请指定--use-statsd-prefixes

Finally, if graphite isn’t accessible publicly you can have nsqadmin proxy those requests by specifying --proxy-graphite.

最后,如果不能公开访问石墨,您可以通过指定 --proxy-graphitensqadmin代理这些请求。

Monitoring 监听

Each of the daemons has a /ping HTTP endpoint that can be used to create a Nagios check.

每个守护进程都有一个' /ping ' HTTP端点,可用于创建Nagios检查。

For realtime debugging this also works surprisingly well:

对于实时调试来说,这种方法也非常有效:

$ watch -n 0.5 "curl -s http://127.0.0.1:4151/stats"

Typically most debugging, analysis, and administration is done via nsqadmin.

通常,大多数调试、分析和管理都是通过“nsqadmin”完成的。

最后修改:2021 年 02 月 24 日 10 : 38 PM
如果觉得我的文章对你有用,请随意赞赏