简体   繁体   English

如何配置StatsD和Graphite在不同的服务器上运行

[英]How to configure StatsD and Graphite to run on different servers

I have looked all over for this but have not found anyone talking about how to setup and configure StatsD and Graphite to communicate on separate servers. StatsD都在寻找,但是还没有人在谈论如何设置和配置StatsDGraphite以在单独的服务器上进行通信。 I currently have everything running on one but I have attempted unsuccessfully to separate them. 我目前正在运行所有程序,但是尝试将它们分开却未成功。

Here is how I setup the StatsD exampleConfig.js 这是我设置StatsD exampleConfig.js

exampleconfig
{
  graphitePort: 2003
, graphiteHost: "(graphite server IP)"
, port: 8125
}

The only other thing I can think to setup on the other box is the example-client.py . 我可以想到的是,在其他框上进行设置的唯一另一件事是example-client.py

currently it says this:
CARBON_SERVER = '127.0.0.1'
CARBON_PORT = 2003

I would think it needs to stay local host to communicate with whisper or graphite on the same server. 我认为它需要留在本地主机上,才能与同一台服务器上的耳语或石墨通信。 I have my firewall setup to listen for 2003 , and Using a packet dump the server does get the UDP from statsd. 我的防火墙设置为侦听2003 ,并且使用数据包转储,服务器确实从statsd获取UDP。 It just doesn't seem to get consumed by carbon and graphite. 它似乎并没有被碳和石墨消耗。

What am I missing? 我想念什么?
Also what is recommended for scaling the statsd graphite setup? 另外,建议采用什么来缩放statsd石墨设置? I have statsd on its own right now and graphite + carbon + whisper on another server. 我现在拥有statsd,另一台服务器上有石墨+碳+耳语。 Does statsd take the most power to run or is it the graphite box? statsd是运行功率最大的设备还是石墨盒? I am wondering this because I will soon be sending millions of bits of data to the servers every day for testing. 我很奇怪,因为我很快将每天向服务器发送数百万位数据进行测试。

Modify example-client.py 修改example-client.py

If you want to run the example-client.py on a different server that is running your graphite/carbon instance. 如果要在运行石墨/碳实例的其他服务器上运行example-client.py Then you will need to change the CARBON_SERVER to the IP address of the graphite/carbon server. 然后,您需要将CARBON_SERVER更改为石墨/碳纤维服务器的IP地址。


Network Tests 网络测试

You might want to also do a few quick tests to make sure that the processes are listening correcting on the ports that your expect and the underlying network will allow this communication. 您可能还需要进行一些快速测试,以确保进程正在侦听您期望的端口上的更正,并且基础网络将允许此通信。

On the server running graphite/carbon you should be able to check if the server is accepting connections from more than just the localhost via the lsof command 在运行石墨/碳纤维的服务器上,您应该能够通过lsof命令检查服务器是否正在接受来自不仅仅是本地主机的连接

$ lsof -Pi:2003
COMMAND    PID    USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
carbon-ca 1596 graphite   7u  IPv4   9517      0t0  TCP *:2003 (LISTEN)

You can see from the above that I have a carbon-cache process running and listening on all interfaces on TCP 2003. 从上面可以看到,我有一个碳缓存进程在TCP 2003的所有接口上运行和侦听。

A very simple test from the remote machine would be to do a telnet connection to the graphite/carbon server on the port that it is listening on ( default: 2003 ) and see if that works. 从远程计算机进行的一个非常简单的测试将是在它正在侦听的端口(默认值:2003)上与石墨/碳纤维服务器进行telnet连接,然后查看是否可行。

Example of a listening socket* 监听套接字示例*

$ telnet graphite-server 2003
Trying graphite-server...
Connected to graphite-server.
Escape character is '^]'.
^]
telnet> quit
Connection closed.

Example of a closed socket* 封闭插座的例子*

$ telnet graphite-server 2003
Trying graphite-server...
telnet: Unable to connect to remote host: Connection refused

So I finally discovered the problem. 所以我终于发现了问题。 I was assuming that statsd not only recieved UDP but also sent UDP to carbon. 我以为statsd不仅可以接收UDP,而且还可以将UDP发送给carbon。 After I realized that statsd sends TCP instead I was able to adjust my firewall and it works great now. 当我意识到statsd改为发送TCP之后,我便能够调整防火墙,并且现在可以正常工作了。 I left CARBON_SERVER as local host. 我离开了CARBON_SERVER作为本地主机。

Thanks! 谢谢!

What are the best ways to scale graphite/carbon? 缩放石墨/碳的最佳方法是什么? Should I separate carbon from graphite? 我应该将碳与石墨分开吗? Is that possible? 那可能吗? Does Carbon strain the processor more than graphite? 与石墨相比,碳对处理器的压力更大吗?

paperlesspost statsd分支也可能对您有用: https : //github.com/paperlesspost/statsd

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM