# 查看和准备当前数据库 - 已经有数据库:lq_nuode - 准备创建数据库:rlq_nuode # 云端添加项目数据库 - DD.Electricity.Cloud.PrPersistence - appsettings.json中,添加相关 - GlobalSettings中,添加相关 - DesignTimeDbContextFactoryBase中,添加相关 - 右键DD.Electricity.Cloud.PrPersistence,生成项目 - dotnet ef datbase update -c ProjectDbContext, 这样云端数据就多了`rlq_nuode`这个数据库 # 更新源代码Web层 - DD.Electricity.Cloud.WebUI - appsettings.json中,添加相关 - GlobalSettings.json中,添加相关 - Program.cs中,添加相关 - 右键DD.Electricity.Cloud.WebUI,发布网站 - 更新云端网站 # 权限管理后台添加集团、项目以及项目用户 - DD.Electricity.Cloud.AuthServer - 管理员登录:13800000000 DrrnFwd2018 - 添加集团:青岛利群集团,记录主键是7 - 添加项目:青岛诺德购物广场,记录主键将是9 ``` 项目名称:青岛诺德购物广场 集团:青岛利群集团 ip:47.103.61.198 端口号:3306 数据库名称:rlq_nuode 连接字符串:rlq_nuode Sort:1 时序数据库API地址:http://47.102.145.164:6020/rest/sql 时序数据库用户名:root 时序数据库密码:taosdata 时序数据库名称:rlq_nuode_7_9 ``` - 在rlq_nuode数据库中,把type设置成0 - 查看鼎鼎展厅1的用户名和角色 ``` 用户名:ddzt1 密码:888888 角色:DianGong ``` - 添加诺德用户:nuode 888888 ``` 用户名:nuode 密码:888888 集团:青岛利群集团 项目:青岛诺德购物广场 角色:DianGong ``` # 确认时序数据库所在的Linux服务器状态 - 使用PuTTY连接Linux服务器 - 检查状态:systemctl status taosd - 启动服务:systemctl start taosd - 修改配置文件:cd /etc/taos/ vim taos.cfg # Windows客户端连接时序数据库 - 客户端连接TDengine: ./taos.exe -h 47.102.145.164 - 展示所有数据库:show databases; - 创建数据库:create database rlq_nuode_7_9; - 使用某个数据库:use database rlq_nuode_7_9; # 准备网站环境 - 确认局域网网站SDK版本:netcoreapp3.0 - sdk已经存在:dotnet-hosting-3.0.0-win # 旧版本更换模块 > 14E38更换成14784 - 确认缓存中是否有14784的数据 - 记录当前的开关编号,1015-1024 - 删除相关 ``` -- KaiGuan 编号:1015-1024 Mac:187ed5314e38 地址:1-10 -- SceneItem select * from sceneitem where KaiGuanId in ('1015','1016','1017','1018','1019','1020','1021','1022','1023','1024') -- SceneDetails select * from scenedetails limit 1 select * from scenedetails where mac='187ed5314e38' -- warninghistories select * from warninghistories where KaiGuanId in ('1015','1016','1017','1018','1019','1020','1021','1022','1023','1024') -- kaiguanwarning select * from kaiguanwarning where KaiGuanId in ('1015','1016','1017','1018','1019','1020','1021','1022','1023','1024') -- 删除 delete from scenedetails where mac='187ed5314e38' delete from sceneitem where KaiGuanId in ('1015','1016','1017','1018','1019','1020','1021','1022','1023','1024') delete from warninghistories where KaiGuanId in ('1015','1016','1017','1018','1019','1020','1021','1022','1023','1024') delete from kaiguanwarning where KaiGuanId in ('1015','1016','1017','1018','1019','1020','1021','1022','1023','1024') delete from kaiguan where Mac='187ed5314e38' ``` - 添加新开关 ``` select * from kaiguan where Mac='187ed5314c38' sort=3 select * from kaiguan where Mac='187ed5314d98' sort=1 187ed5314784 sort=2 select * from kaiguan where Mac='187ed5314784' ``` - 可视化界面-1层F区,尝试是否可以分断合闸 - 添加到场景中 ``` -- -1层F区9点关 -- -1层F区下班关 -- -1层F区上班开 ``` # 14B84换成1EFAO - 模块默认IP:192.168.91.1:82 - 服务器指向:`192.168.0.252:8080/ebx-bishop/data/carry` - 其它 ``` -- KaiGuan Mac:187ed5314b84 15个开关,编号1-15 Sort:3 1-5 梯东,6 廊灯,7 梯底,8和9 服务台,10 灯箱,11电视,12-15空 --场景 -1A区晚上21点关:线路10 -1层A区上班开:1-15 -1层A区下班关:1-15 -- SceneItem select * from sceneitem where KaiGuanId in ('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15') -- SceneDetails select * from scenedetails where mac='187ed5314b84' -- warninghistories select * from warninghistories where KaiGuanId in ('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15') -- kaiguanwarning select * from kaiguanwarning where KaiGuanId in ('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15') -- 删除 delete from scenedetails where mac='187ed5314b84' delete from sceneitem where KaiGuanId in ('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15') delete from warninghistories where KaiGuanId in ('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15') delete from kaiguanwarning where KaiGuanId in ('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15') delete from kaiguan where Mac='187ed5314b84' --添加新开关 用户名:13800000000 密码:DrrnFwd2018 select Id, Mac, LineAddress, Name from kaiguan where Mac='187ed531efa0' update kaiguan set Name='梯东' where Mac='187ed531efa0' and LineAddress in ('1','2','3','4','5') update kaiguan set Name='廊灯' where Mac='187ed531efa0' and LineAddress='6' update kaiguan set Name='梯底' where Mac='187ed531efa0' and LineAddress='7' update kaiguan set Name='服务台' where Mac='187ed531efa0' and LineAddress in ('8','9') update kaiguan set Name='灯箱' where Mac='187ed531efa0' and LineAddress='10' update kaiguan set Name='电视' where Mac='187ed531efa0' and LineAddress='11' update kaiguan set Name='空' where Mac='187ed531efa0' and LineAddress in ('12','13','14','15') 补Code ``` - 可视化界面-1层A区,尝试是否可以分断合闸 - 添加到场景中 ``` --场景 -1A区晚上21点关:线路10 187ed531efa0 -1层A区上班开:1-15 -1层A区下班关:1-15 ``` - 14B84从缓存中删除 - 处理云端 ``` # 1571C换成226AC - 模块默认IP:192.168.91.1:82 - 服务器指向:`192.168.0.252:8080//ebx-bishop/data/carry` - 其它 ``` -- KaiGuan Mac:187ed531571c select * from kaiguan where Mac='187ed531571c' 7个开关,编号870-876 Sort:9 1 走廊吊灯 2 电梯前室 3 扶梯上反灯 4 -5 楼梯反光 6 电视墙 7 电梯走廊 --场景 -4层晚上19点关 21:27触发,4,5,6 -4层下班关 22:30 1,3,6 -4层货梯下班关 21:50 2,7 -- SceneItem select * from sceneitem where KaiGuanId in ('870','871','872','873','874','875','876') -- SceneDetails select * from scenedetails where mac='187ed531571c' -- warninghistories select * from warninghistories where KaiGuanId in ('870','871','872','873','874','875','876') -- kaiguanwarning select * from kaiguanwarning where KaiGuanId in ('870','871','872','873','874','875','876') -- 删除 delete from scenedetails where mac='187ed531571c' delete from sceneitem where KaiGuanId in ('870','871','872','873','874','875','876') delete from warninghistories where KaiGuanId in ('870','871','872','873','874','875','876') delete from kaiguanwarning where KaiGuanId in ('870','871','872','873','874','875','876') delete from kaiguan where Mac='187ed531571c' -- 删除缓存中的模块 --添加新开关 用户名:13800000000 密码:DrrnFwd2018 -- 设置开关名称 -- 补Code ``` select Mac, LineAddress, Name, Code from kaiguan where Mac='187ed53226ac' update kaiguan set Name='走廊吊灯',Code='1' where Mac='187ed53226ac' and LineAddress=1 update kaiguan set Name='电梯前室',Code='2' where Mac='187ed53226ac' and LineAddress=2 update kaiguan set Name='扶梯上反灯',Code='3' where Mac='187ed53226ac' and LineAddress=3 update kaiguan set Name='楼梯反光',Code='4' where Mac='187ed53226ac' and LineAddress=4 update kaiguan set Name='楼梯反光',Code='5' where Mac='187ed53226ac' and LineAddress=5 update kaiguan set Name='电视墙',Code='6' where Mac='187ed53226ac' and LineAddress=6 update kaiguan set Name='电梯走廊',Code='7' where Mac='187ed53226ac' and LineAddress=7 ``` -- 设置场景 ``` - 可视化界面4层A区,尝试是否可以分断合闸 - 添加到场景中 - 同步时序数据库 - 处理云端 ``` # 连接局域网服务器 - 网址:192.168.0.252,TecheFwd123 - 当前版本所在文件夹:D:\websites\dingding_v1.1.5.2_us - 服务器信息 ``` 处理器:intel 3.3GHZ 4核 内存:8GB 系统类型:64位 Windows版本:Windows Server 2012 R2 Standard ``` # 部署网站 - 创建新文件夹:2020_v1.0.0.0 - Home/Index修改24小时负荷的stepSize - 禁用每30秒一次的RealDataToCloud - 禁用每分钟一次的RealDataToTDengine - 禁用每小时一次的TongJiByHourTDengine - 发布网站,把网站拷贝到2020_v1.0.0.0文件夹 - 安装netcoreapp3.0运行时 - 修改appsettings.json ``` 云端数据库:rlq_nuode 本地网址:192.168.0.252 groupid:7 projectid:9 connkey:rlq_nuode 时序数据库名称:rlq_nuode_7_9 ``` - 运行:dotnet.exe DD.Local.Web.dll - 管理员身份登录:13800000000,DrrnFwd2018(TecheFwd2018) # 把局域网位置和场景同步到云端 - 同步位置 - 同步场景 - 超级表 - 子表 - 启用每30秒一次的RealDataToCloud - 启用每分钟一次的RealDataToTDengine - 启用每小时一次的TongJiByHourTDengine - 重新生成网站 - 发现各项都慢 ``` -- 服务器支持的最大连接数,最大连接数,默认100,一般经验设置3000。win服务器连接数支持1500-1800。 show variables like '%max_connections%'; set global max_connections=1000 -- 响应的最大连接数,检查曾经使用最大的连接数,这个值在max_connections的85%左右比较合适,过高,则会系统使用连接数过少,系统负荷过高。Max_used_connections / max_connections * 100%=44/151,最好是占85%以上。 show global status like 'max_used_connections' -- max_user_connections=0,表示不限制用户的最大连接数,其最大值可以等于max_connections show variables like '%max_user_connections'; -- show status like 'Threads%'; 参数说明: Threads_cached 34 ##mysql管理的线程池中还有多少可以被复用的资源 Threads_connected 32 ##打开的连接数 Threads_created 66 ##代表新创建的thread(根据官方文档,如果thread_created增大迅速,需要适当调高 thread_cache_size)。 Threads_running 2 ##激活的连接数,这个数值一般远低于connected数值,准确的来说,Threads_running是代表当前并发数 sql> show variables like 'thread_cache_size'; sql> set global thread_cache_size=60; ``` select * from real_187ed5314b84 where ts >= NOW - 1h; # 在局域网创建时序数据库表 - 超级表 ``` - superreal - superrealtj - superwarning - superwarningtj - superdl ``` - 子表 ``` - real_187ed5314e0c; - realtj_187ed5314e0c_h; realtj_187ed5314e0c_d; realtj_187ed5314e0c_n;realtj_187ed5314e0c_y; - warning_187ed5314e0c; - warningtj_187ed5314e0c_h; warningtj_187ed5314e0c_d; warningtj_187ed5314e0c_n;warningtj_187ed5314e0c_y; - dl_187ed5314e0c ``` - 云端同步 # 2020年10月7日 换模块 ``` 192.168.18.38 TecheFwd123 192.168.0.215 http://192.168.0.1/ admin admin LAN设置 客户端列表 192.168.0.252:8080/ebx-bishop/data/carry -- 粮油区第6排和第5排 -- 15034换成2F658 192.168.0.141 第5排 -- 16484换成2CB7C 192.168.0.71 第6排 select * from kaiguan where Mac='187ed5316484' ip 192.168.0.64 不对 新模块: # 15034换成2F658 -局域网找新模块确认指向?已确认。 -新模块是否最新?确实最新。最新。 -确认旧模块是否不再更新?最后一次更新时间在2020-10-06 09:34:19,确实不再更新。 -记录旧模块的开关编号和开关名称? select * from KaiGuan where Mac='187ed5315034' in ('260','261','262','263','264','265','266','267','268','269', '270','271','272','273','274','275') -记录旧模块的场景 -1D区晚上21点关 2,4,6,8,10,14 -1层D区下班关 1,3,5,7,9,11,12,13,16 -1层收银下班 14,15 -1层D区上班开 2,4,5,6,8,10,11,12,13,14,15,16 -1层E区上班早开 1,3,7,9 粮油调味区盘点关 1-10 粮油调味区盘点开 1-10 -删除旧模块SceneDetails select * from sceneDetails where mac='187ed5315034' delete from sceneDetails where mac='187ed5315034' -删除旧模块SceneItem select * from SceneItem where KaiGuanId in ('260','261','262','263','264','265','266','267','268','269', '270','271','272','273','274','275') delete from SceneItem where KaiGuanId in ('260','261','262','263','264','265','266','267','268','269', '270','271','272','273','274','275') -删除旧模块warninghistories select * from warningHistories where KaiGuanId in ('260','261','262','263','264','265','266','267','268','269', '270','271','272','273','274','275') delete from warningHistories where KaiGuanId in ('260','261','262','263','264','265','266','267','268','269', '270','271','272','273','274','275') -删除旧模块kaiguanwarning select * from kaiguanwarning where KaiGuanId in ('260','261','262','263','264','265','266','267','268','269', '270','271','272','273','274','275') delete from KaiGuanWarning where KaiGuanId in ('260','261','262','263','264','265','266','267','268','269', '270','271','272','273','274','275') -删除旧模块开关 select * from KaiGuan where Mac='187ed5315034' delete from KaiGuan where Mac='187ed5315034' -删除缓存 AllMac 其它相关缓存 -添加新模块开关 select Mac, LineAddress, Name from KaiGuan where Mac='187ed5328658' update KaiGuan Set Name='射灯2' where Mac='187ed5328658' and LineAddress='1'; update KaiGuan Set Name='灯带9' where Mac='187ed5328658' and LineAddress='2'; update KaiGuan Set Name='灯带10' where Mac='187ed5328658' and LineAddress='3'; update KaiGuan Set Name='灯带10' where Mac='187ed5328658' and LineAddress='4'; update KaiGuan Set Name='灯带11' where Mac='187ed5328658' and LineAddress='5'; update KaiGuan Set Name='灯带11' where Mac='187ed5328658' and LineAddress='6'; update KaiGuan Set Name='灯带12' where Mac='187ed5328658' and LineAddress='7'; update KaiGuan Set Name='灯带12' where Mac='187ed5328658' and LineAddress='8'; update KaiGuan Set Name='灯带14' where Mac='187ed5328658' and LineAddress='9'; -设置新模块相关场景 S3上班 S3下班 #16484换成2CB7C -局域网找新模块确认指向? -新模块是否最新?确实最新。 -确认旧模块是否不再更新?最后一次更新时间在2020-10-06 09:34:19,确实不再更新。 -记录旧模块的开关编号和开关名称? select * from KaiGuan where Mac='187ed5316484' in ('276','277','278','279','280','281','282') -记录旧模块的场景 -1D区晚上21点关 1 -1层D区下班关 2,3,4,5,6,7 -1层收银下班 5 -1层D区上班开 1-7 -删除旧模块SceneDetails select * from sceneDetails where mac='187ed5316484' delete from sceneDetails where mac='187ed5316484' -删除旧模块SceneItem select * from SceneItem where KaiGuanId in ('276','277','278','279','280','281','282') delete from SceneItem where KaiGuanId in ('276','277','278','279','280','281','282') -删除旧模块warninghistories select * from warningHistories where KaiGuanId in ('276','277','278','279','280','281','282') delete from warningHistories where KaiGuanId in ('276','277','278','279','280','281','282') -删除旧模块kaiguanwarning select * from kaiguanwarning where KaiGuanId in ('276','277','278','279','280','281','282') delete from KaiGuanWarning where KaiGuanId in ('276','277','278','279','280','281','282') -删除旧模块开关 select * from KaiGuan where Mac='187ed5316484' delete from KaiGuan where Mac='187ed5316484' -删除缓存 AllMac 其它相关缓存 -添加新模块开关 select Mac, LineAddress, Name from KaiGuan where Mac='187ed5328658' update KaiGuan Set Name='射灯2' where Mac='187ed5328658' and LineAddress='1'; update KaiGuan Set Name='灯带9' where Mac='187ed5328658' and LineAddress='2'; update KaiGuan Set Name='灯带10' where Mac='187ed5328658' and LineAddress='3'; update KaiGuan Set Name='灯带10' where Mac='187ed5328658' and LineAddress='4'; update KaiGuan Set Name='灯带11' where Mac='187ed5328658' and LineAddress='5'; update KaiGuan Set Name='灯带11' where Mac='187ed5328658' and LineAddress='6'; update KaiGuan Set Name='灯带12' where Mac='187ed5328658' and LineAddress='7'; update KaiGuan Set Name='灯带12' where Mac='187ed5328658' and LineAddress='8'; update KaiGuan Set Name='灯带14' where Mac='187ed5328658' and LineAddress='9'; -设置新模块相关场景 S3上班 S3下班 ```