nsq 学习(二)简单使用

一,quick start

1.在一个控制台:

$ nsqlookupd

2.在另一个控制台

$ nsqd --lookupd-tcp-address=127.0.0.1:4160

3.再新建一个控制台

$ nsqadmin --lookupd-http-address=127.0.0.1:4161

4.继续新建一个控制台

$ curl -d 'hello world 1' 'http://127.0.0.1:4151/put?topic=test'

5.还不够,不过应该可以保证说最后一次了

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

6.使用4的控制台

$ curl -d 'hello world 2' 'http://127.0.0.1:4151/put?topic=test'
$ curl -d 'hello world 3' 'http://127.0.0.1:4151/put?topic=test'

7. cat /tmp/test<Tab> 日志就可以看到刚果post的三条消息

或者。。浏览器中 open http://127.0.0.1:4171/ , view thensqadmin UI and see statistics.

8.notice。。

The important lesson here is that nsq_to_file (the client) is not explicitly told where the test topic is produced, it retrieves this information from nsqlookupd and, despite the timing of the connection, no messages are lost.

 

posted @ 2015-08-09 23:05  诡城  阅读(576)  评论(0编辑  收藏  举报