问题
My situation is currently
- 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).
- I run
mosquitto
on Amazon Web Services, and typemosquitto_sub -t "test"
for receive data.(photo 2) - 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
- 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) - Are all the steps I've done so far right?
- 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.
- 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
- ifconfig does not give you the external ip
- It is dangerous to reveal your ip only if you have given public access to the ip
- 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