# updateCacheEggServer **Repository Path**: vesper0407/update-cache-egg-server ## Basic Information - **Project Name**: updateCacheEggServer - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2021-12-09 - **Last Updated**: 2023-11-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # updateCache a dedicated task for updating edge cache resources ### environment - Linux (CentOS macOS Ubuntu ...) - 不要在windows上部署 用了很多Linux shell命令 ### 关于wget timeout参数 - [timeout不是用来控制下载时间](https://blog.csdn.net/zhuxinquan61/article/details/89221735) ### eggjs支持https - 暂不支持在config.default.js中配置cluster - [github issues](https://github.com/eggjs/egg/issues/1344) - 解决办法 1. 获取证书 ```shell mkdir ssl cd ssl openssl genrsa -out server.key 1024 openssl req -new -key server.key -out server.csr openssl x509 -req -in server.csr -signkey server.key -out server.crt ``` 2. package.json中scripts新增devs 支持https ```json { "scripts":{ "devs": "egg-bin dev --port=5002 --https.key='./ssl/server.key' --https.cert='./ssl/server.crt'" } } ``` 3. npm run devs - http服务器的话就直接 ```npm run dev``` - wget测试服务器之间的网速 -q安静模式 -O指定文件位置 --timeout指定超时重试 ```shell drj_MacBook:~ apple$ time wget http://162.14.105.224:8080/panorama/skiing/face2/video/vp09/4/seg-10.m4s -O /dev/null --timeout 1 -q real 0m5.159s user 0m0.010s sys 0m0.024s ``` - nethogs监控 - 监控可以 但是用来主动获取有点问题 要知道真实的传输速率最好传了才知道 获取的空闲速率很低 ## QuickStart see [egg docs][egg] for more detail. ### Development ```bash $ npm i $ npm run dev $ open http://localhost:5001/ $ npm run devs $ open https://localhost:5002/ ``` ### Deploy ```bash $ npm start $ npm stop ``` ### npm scripts - Use `npm run lint` to check code style. - Use `npm test` to run unit test. - Use `npm run autod` to auto detect dependencies upgrade, see [autod](https://www.npmjs.com/package/autod) for more detail. [egg]: https://eggjs.org ### 超时了 node.js ClusterClientNoResponseError - nodejs.ClusterClientNoResponseError: client no response in 72172ms exceeding maxIdleTime 60000ms, maybe the connection is close on other side. - 生产版本不会出现这个问题,是正常的现象。 - 看到这个报错不要手动quit 程序还在运行 - node_modules/cluster-client/lib/leader.js:71 - 调整maxIdleTime - heartbeatInterval and responseTimeout ```javascript //定义在 node_modules/cluster-client/lib/index.js const defaultOptions = { port: parseInt(process.env.NODE_CLUSTER_CLIENT_PORT || 7777), singleMode: process.env.NODE_CLUSTER_CLIENT_SINGLE_MODE === '1', maxWaitTime: 30000, responseTimeout: 3000, heartbeatInterval: 20000, autoGenerate: true, isBroadcast: true, logger, transcode, formatKey, }; ``` ### wget https ```shell Last login: Thu Jan 27 14:01:10 on ttys010 drj_MacBook:~ apple$ ssh root@81.70.14.129 Last login: Thu Jan 27 14:01:10 2022 from 115.60.29.146 [root@VM-0-15-centos ~]# wget https://162.14.105.224:8080/panorama/skiing/face2/video/vp09/4/seg-10.m4s -O /dev/null --2022-01-27 14:02:56-- https://162.14.105.224:8080/panorama/skiing/face2/video/vp09/4/seg-10.m4s 正在连接 162.14.105.224:8080... 已连接 错误: 无法验证 162.14.105.224 的由 "/C=XX/L=Default City/O=Default Company Ltd/CN=162.14.105.224" 颁发的证书: 出现了自己签名的证书 要以不安全的方式连接至 162.14.105.224 使用"--no-check-certificate" [root@VM-0-15-centos ~]# wget https://162.14.105.224:8080/panorama/skiing/face2/video/vp09/4/seg-10.m4s -O /dev/null --no-check-certificate --2022-01-27 14:03:06-- https://162.14.105.224:8080/panorama/skiing/face2/video/vp09/4/seg-10.m4s 正在连接 162.14.105.224:8080... 已连接 警告: 无法验证 162.14.105.224 的由 "/C=XX/L=Default City/O=Default Company Ltd/CN=162.14.105.224" 颁发的证书: 出现了自己签名的证书 已发出 HTTP 请求 正在等待回应... 200 OK 长度 1328923 (1.3M) [application/octet-stream] 正在保存至: "/dev/null" 100%[================================================>] 1,328,923 1011KB/s 用时 1.3s 2022-01-27 14:03:07 (1011 KB/s) - 已保存 "/dev/null" [1328923/1328923]) ```