本地部署IOT平台
目的
为了方便调式【视频服务】
步骤
安装docker
拉取最新代码
根据下面的【yml】文件进行本地docker部署
version: '2'
networks:
network:
ipam:
driver: default
config:
- subnet: '177.7.0.0/16'
services:
redis:
image: redis:7.0.0
container_name: redis
ports:
- 6379:6379
privileged: true
networks:
network:
ipv4_address: 177.7.0.10
volumes:
- ./redis:/usr/local/etc/redis
- ./redis/data:/data
command: [ '-- requirepass fastbee', '-- appendonly yes' ]
mysql:
image: mysql:5.7
container_name: mysql
ports:
- 3306:3306
privileged: true
networks:
network:
ipv4_address: 177.7.0.11
volumes:
- ./mysql/mysql:/var/lib/mysql
- ./mysql/mysql.cnf:/etc/mysql/conf.d/mysql.cnf
- ./mysql/initdb:/docker-entrypoint-initdb.d
environment:
MYSQL_DATABASE: fastbee
MYSQL_ROOT_PASSWORD: fastbee
command:
[
'mysqld',
'--character-set-server=utf8',
'--collation-server=utf8_unicode_ci',
'--default-time-zone=+8:00',
'--lower-case-table-names=1'
]
# emqx:
# image: emqx:5.1
# container_name: emqx
# ports:
# - 1883:1883
# - 8083:8083
# - 8084:8084
# - 18083:18083
# privileged: true
# networks:
# network:
# ipv4_address: 177.7.0.12
# volumes:
# - 。/emqx/etc/emqx.conf:/opt/emqx/etc/emqx.conf
# - 。/emqx/etc/acl.conf:/opt/emqx/etc/acl.conf
# - 。/emqx/etc/log:/opt/emqx/log
# environment:
# SET_CONTAINER_TIMEZONE: "true"
# CONTAINER_TIMEZONE: Asia/Shanghai
# nginx:
# image: nginx:stable
# container_name: nginx
# ports:
# - 80:80
# - 443:443
# - 15060:15060/udp
# privileged: true
# networks:
# network:
# ipv4_address: 177.7.0.14
# depends_on:
# - java
# volumes:
# - 。/nginx/vue:/usr/share/nginx/html
# - 。/nginx/view:/usr/share/nginx/view
# - 。/nginx/h5:/usr/share/nginx/h5
# - 。/nginx/www:/usr/share/nginx/www
# - 。/nginx/doc:/usr/share/nginx/doc
# - 。/nginx/ssl:/usr/share/nginx/ssl
# - 。/nginx/nginx.conf:/etc/nginx/nginx.conf
# - 。/nginx:/var/log/nginx
zlmedia-record:
build:
context: ./zlmedia/record
container_name: zlmedia-record
privileged: true
restart: always
ports:
- 18081:18081
- 8082:80
- 8443:443
- 554:554
- 1935:1935
- 8000:8000
- 30000-30100:30000-30100/udp
expose:
- "80"
- "443"
- "554"
- "1935"
volumes:
- ./zlmedia/record/fastbee-record.jar:/fastbee-record.jar
- ./zlmedia/record/logs:/opt/assist/logs
- ./zlmedia/logs:/opt/media/bin/log
- ./zlmedia/data/www:/opt/media/bin/www
- ./zlmedia/conf/config.ini:/opt/media/conf/config.ini
- ./zlmedia/conf/default.pem:/opt/media/bin/default.pem
networks:
network:
ipv4_address: 177.7.0.15
# tdengine:
# image: 'tdengine/tdengine:2.6.0.12'
# container_name: tdengine
# hostname: fastbee
# ports:
# - 6030-6049:6030-6049
# - 6030-6049:6030-6049/udp
# volumes:
# - "。/tdengine/log:/var/log/taos"
# - "。/tdengine/data:/var/lib/taos"
# environment:
# TZ: Asia/Shanghai
# networks:
# network:
# ipv4_address: 177.7.0.16
实现效果:
搭建MQTT服务器
docker pull emqx/emqx:5.6.1
docker run -d --name emqx -p 1883:1883 -p 8083:8083 -p 8084:8084 -p 8883:8883 -p 18083:18083 emqx/emqx:5.6.1
实现效果:
运行后端代码
个人建议采用远程服务器的测试数据库
主要包括以下两个,因为windows下的docker容器老是连接不上,最终docker上只连接了zlmedia
和emqx
容器。
redis
mysql
【远程服务器执行最新的sql
脚本就行】
运行前端代码
系统运行效果
本地接入视频
需要一个路由器,将摄像头和本地主机接入同一个局域网下。
本机ip地址
链接速度(接收/传输): 1000/1000 (Mbps)
本地链接 IPv6 地址: fe80::c6cc:cd48:b4a2:9ec8%43
IPv4 地址: 192.168.31.172
IPv4 DNS 服务器: 192.168.31.1 (未加密)
制造商: Realtek
描述: Realtek USB GbE Family Controller #2
驱动程序版本: 10.19.705.2017
物理地址(MAC): 00-E0-4C-68-72-6D
摄像头ip地址
复制到的ip地址:192.168.31.76
新增视频节点
新增节点后,需要删除旧的节点
配置摄像头参数
查看设备编号及通道
输入摄像头ip地址进入设置页面,输入设备ID和通道ID
注:更改参数后先去掉【启用】,再点击保存;然后再勾选【启用】,再点击保存。
当摄像头状态变为在线后,开启直播及录像功能。
直播
点击查看直播按钮进入设备直播页面
录像
点击开启按钮即可!
录像地址
wumei-smart\docker\data\zlmedia\data\www\record\rtp\gb_playrecord_11010100001320000001_11010100001320000001\2024-05-11
录像文件
转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 jungle8884@163.com