What server address (mosquitto broker url) should I use to connect node-red to mosquitto?

≯℡__Kan透↙ 提交于 2020-01-16 13:10:50

问题


My situation is currently

  1. I have two computers. One is my computer, the other is Amazon Web Services. Node-red is installed on my computer, and mosquitto is installed on Amazon Web Services (Photo 1).
  2. I run mosquitto on Amazon Web Services, and type mosquitto_sub -t "test" for receive data.(photo 2)
  3. I need to enter 'server' (mosquitto broker url) and 'topic' in node-red to send data from node-red to mosquitto. Currently I have entered 172.26.12.244:1880 and 'test'. But node-red and mosquitto are not connected. (Photo 3)

Questions

  1. Photo4 is the console screen for Amazon Web Services. When I type ifconfig, I get several ip addresses. What ip should I enter in 'server'? (photo 4)
  2. Are all the steps I've done so far right?
  3. Is it dangerous to upload my IP as I do now? I am a beginner studying about studying server.

ps)

Over time, a connection is made from node-red, so when I send data from node-red, I see a "Successfully injected" message. But in mosquitto no messages can be seen. My guess is that when I send data from node-red, that data should be output to the mosquitto screen. Isn't it? (photo5)

(photo 1)

(photo 2)

(photo 3)

(photo 4)

(photo 5)


回答1:


There are several questions here so will try answering one by one if any question is missed out comment to ask.

  1. The ip you have used for mosquitto server is wrong you need to find the external ip which you can find in the aws EC2 web console
  2. ifconfig does not give you the external ip
  3. It is dangerous to reveal your ip only if you have given public access to the ip
  4. As @Rafael Muynarsk pointed once you have the external ip make sure the security group allows the connection from your computer to the mosquitto on the port mosquitto is running.


来源:https://stackoverflow.com/questions/59557479/what-server-address-mosquitto-broker-url-should-i-use-to-connect-node-red-to-m

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!