mosquitto/mqtt broker terminating problem

0

mosquitto broker works fine in t2.micro, but when change the instance type to t2.medium it starts terminating the mosquitto broker. if again type change to t2.micro it working fine, there is no terminating at all. i have no IPv6 CIDR blocks associated with VPC.

mosquitto.log (t2.medium) :
1558772281: Received PUBLISH from 1904MCON001129 (d0, q0, r0, m0, 'MCON/1904MCON001129', ... (289 bytes))
1558772281: mosquitto version 1.4.15 (build date Wed, 13 Feb 2019 00:27:01 +0000) starting
1558772281: Config loaded from /etc/mosquitto/mosquitto.conf.
1558772281: Opening ipv4 listen socket on port 1883.
1558772281: Error: Address already in use
1558772281: Sending PUBLISH to server (d0, q0, r0, m0, 'MCON/1904MCON001129', ... (289 bytes))
1558772281: Received PUBLISH from 1905MS1P000064 (d0, q0, r0, m0, 'MCON/1905MS1P000064', ... (267 bytes))
1558772281: Received PUBLISH from 1803MCON000095 (d0, q0, r0, m0, 'MCON/1803MCON000095', ... (287 bytes))
1558772281: mosquitto version 1.4.15 terminating
1558772341: mosquitto version 1.4.15 (build date Wed, 13 Feb 2019 00:27:01 +0000) starting
1558772341: Config loaded from /etc/mosquitto/mosquitto.conf.
1558772341: Opening ipv4 listen socket on port 1883.
1558772341: Opening ipv6 listen socket on port 1883.
1558772341: Warning: Address family not supported by protocol
1558772341: Opening websockets listen socket on port 1884.
1558772342: New connection from 42.109.150.25 on port 1883.

by analyzing this log mosquitto broker starting before terminating.

  • i don't know why is this happens ,when using t2.medium.

  • is "Opening ipv6 listen socket" make this problem?

mosquitto.conf :
pid_file /var/run/mosquitto.pid
persistence true
persistence_location /var/lib/mosquitto/
log_dest file /var/log/mosquitto/mosquitto.log
include_dir /etc/mosquitto/conf.d
require_certificate false
log_type all

.sh file:
#!/bin/sh
if [ "ps -aux | grep /usr/sbin/mosquitto | wc -l" = "1" ]
then
echo "mosquitto wasnt running so attempting restart" >> /home/ubuntu/cron.log
sudo systemctl restart mosquitto.service
exit 0
fi
state=$(nmap -p 1883 localhost | grep "$PORT" | grep open)
if [ -z "$state" ] ; then
echo "Connection to $SERVER on port $PORT was failed" >> /home/ubuntu/cron.log
sudo systemctl restart mosquitto.service
else
echo "Connection to port 1883 was successful "
echo -z "$state"
fi

please explain if you know,
Thanks in advance.

Edited by: vigneshwaranmws on May 27, 2019 1:10 PM

Edited by: vigneshwaranmws on May 30, 2019 11:56 AM

Edited by: vigneshwaranmws on May 30, 2019 11:57 AM

asked 5 years ago521 views
1 Answer
0

This problem solved when topic was separated instead of using #. The major problem is data receiving page in PHP not handle so mach data from Mqtt broker. This big data also make problem in MQSQL database storage in InnoDB, instead of that using MyISAM store data fast compared to InnoDB. So I group the Topics and store Payload messages based on topic groups in different table using MyISAM DB. This type of settings is to handle the Big data from Mqtt. And terminating broker also reduced. Termination was happen 3 to 4 times for every hour, now it happens 5 to 6 times for a day.

answered 4 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions