Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
I
iot-mqtt-bl
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
deploy
iot-mqtt-bl
Commits
a3fb19ab
Commit
a3fb19ab
authored
May 23, 2023
by
吴文龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加IP传参
parent
1b437060
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
17 deletions
+16
-17
docker-compose.yml
docker-compose.yml
+0
-2
haproxy.cfg
haproxy/config/haproxy.cfg
+11
-11
check_mqtt.sh
haproxy/data/check_mqtt.sh
+4
-3
mqtt.env
haproxy/data/mqtt.env
+1
-0
test-mqtt.json
haproxy/data/test-mqtt.json
+0
-1
No files found.
docker-compose.yml
View file @
a3fb19ab
...
...
@@ -17,6 +17,4 @@ services:
-
NET_ADMIN
environment
:
MQTT_PORT
:
1883
TB_MQTT_PORT
:
31883
TB_ACCESS_TOKEN
:
'
123456'
FORCE_HTTPS_REDIRECT
:
"
false"
haproxy/config/haproxy.cfg
View file @
a3fb19ab
...
...
@@ -52,13 +52,13 @@ listen mqtt-in
option log-health-checks
external-check path "/usr/bin:/bin:/usr/local/bin"
external-check command /usr/local/bin/check_mqtt.sh
server tbMqtt1 47.99.83.75:31883 check inter 10s rise 2 fall 3
server tbMqtt2 47.97.197.103:31883 check inter 10s rise 2 fall 3
server tbMqtt3 47.96.103.209:31883 check inter 10s rise 2 fall 3
server tbMqtt4 121.43.228.88:31883 check inter 10s rise 2 fall 3
server tbMqtt5 121.43.169.33:31883 check inter 10s rise 2 fall 3
server tbMqtt6 120.55.38.205:31883 check inter 10s rise 2 fall 3
server tbMqtt7 116.62.229.50:31883 check inter 10s rise 2 fall 3
server tbMqtt8 121.196.10.235:31883 check inter 10s rise 2 fall 3
server tbMqtt9 47.114.33.137:31883 check inter 10s rise 2 fall 3
server tbMqtt10 47.97.181.210:31883 check inter 10s rise 2 fall 3
\ No newline at end of file
server tbMqtt1 47.99.83.75:31883 check inter 30s rise 2 fall 3
server tbMqtt2 47.97.197.103:31883 check inter 30s rise 2 fall 3
server tbMqtt3 47.96.103.209:31883 check inter 30s rise 2 fall 3
#server tbMqtt4 121.43.228.88:31883 check inter 30s rise 2 fall 3
server tbMqtt5 121.43.169.33:31883 check inter 30s rise 2 fall 3
#server tbMqtt6 120.55.38.205:31883 check inter 30s rise 2 fall 3
server tbMqtt7 116.62.229.50:31883 check inter 30s rise 2 fall 3
server tbMqtt8 121.196.10.235:31883 check inter 30s rise 2 fall 3
server tbMqtt9 47.114.33.137:31883 check inter 30s rise 2 fall 3
#server tbMqtt10 47.97.181.210:31883 check inter 30s rise 2 fall 3
haproxy/data/check_mqtt.sh
View file @
a3fb19ab
#!/bin/sh
echo
$@
>>
/tmp/all_arguments.txt
ip_adr
=
$(
echo
$@
|awk
'{print $3}'
)
if
mosquitto_pub
-h
$ip_adr
-p
${
TB_MQTT_PORT
}
-u
${
TB_ACCESS_TOKEN
}
-t
v1/devices/me/attributes
-f
/usr/local/bin/test-mqtt.json
-q
1
-d
;
then
source
mqtt.env
currentTime
=
$(
date
"+%Y-%m-%d %H:%M:%S"
)
env
>
/tmp/env.txt
if
mosquitto_pub
-h
$HAPROXY_SERVER_ADDR
-p
$HAPROXY_SERVER_PORT
-u
$TB_ACCESS_TOKEN
-t
v1/devices/me/telemetry
-m
"{
\"
check-mqtt-status
\"
:
\"
ok
\"
,
\"
$HAPROXY_SERVER_ADDR
:
$HAPROXY_SERVER_PORT
\"
:
\"
$currentTime
\"
}"
-q
1
-d
;
then
exit
0
else
exit
1
...
...
haproxy/data/mqtt.env
0 → 100644
View file @
a3fb19ab
TB_ACCESS_TOKEN='123456'
\ No newline at end of file
haproxy/data/test-mqtt.json
deleted
100644 → 0
View file @
1b437060
{
"check-mqtt-status"
:
"ok"
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment