pm2的cluster模式下使用log4js
配置log4js.config1234567891011121314151617181920{ /** * pm2 (boolean) (optional) * - set this to true if you’re running your app using pm2, * otherwise logs will not work (you’ll also need to install pm2-intercom as pm2 module: pm2 install pm2-intercom) */ pm2: true, /** * pm2InstanceVar (string) (optional, defaults to ‘NODE_APP_INSTANCE’) * - set this if you’re using pm2 and have changed the default name of the NODE_APP_INSTANCE variable. */ pm2InstanceVar: "isMaste...
自定义npm包,发布及下载
封装npm包上传到npmjs.com 定义package.json 12345678910111213141516{ "name": "logger-server", //会被当作包名存在,不可与现有npm仓库的包名重复(例如已经有了log4js,这里就不能叫log4js) "version": "1.0.0", // 打版本标签 "private": true, // 这个字段可以防止代码被公开发布 "description": "日志自定义封装", "main": "index.js", "author": "xiaowu", "repository": { //可不配 "type": "git", "url": "git@...
解决Could not find any Visual Studio installation to use的问题
https://github.com/nodejs/node-gyp/issues/2203 https://stackoverflow.com/questions/57541402/node-gyp-configure-got-gyp-err-find-vs/63311413#63311413 https://www.jianshu.com/p/e2f12fab2b78 node版本12.22, win10 执行npm install报错信息如下 123456789101112131415161718192021222324252627282930313233gyp ERR! find VSgyp ERR! find VS msvs_version not set from command line or npm configgyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Promptgyp ERR! find VS checking VS2017 (15.9.28307.1974) foun...
posgresql的安装
安装postgresqldocker 安装 postgresql10 拉取官方的镜像 docker pull postgres:10 创建并运行postgres docker run –name postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 -d postgres:10 启动数据库 docker start postgres 访问数据库 psql -h localhost -p 5432 -U postgres PostgreSQL 11 / 10 on CentOS 7PostgreSQL 11 install 1234### PostgreSQL 11 ###yum install -y https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7-x86_64/pgdg-centos11-11-2.noarch.rpm### PostgreSQL 10 ###yum install -y https://...
posgresql备份及还原
PostgreSQL还原.bak文件 win+R输入cmd cd C:\PostgreSQL\10\bin 还原之前首先在postgresql中新建数据库,作为目标数据库 在postgresql对目标数据库执行create extension postgis;语句,确保空间数据加载正常,同时生成表spatial_ref_sys psql -h localhost -U postgres -p 5432 -d DBtest -f “E:\DBtest .bak”(备份:pg_dump -h localhost -U postgres DBtest > “E:\DBtest .bak” ) 用户 postgres 的口令:输入密码回车 EXPLAIN ( ANALYZE, buffers )–查询执行时间等(执行计划) 备份数据库中表及数据pg_dump -h 127.0.0.1 -U admin -Fc -v postgres > /usr/local/pgsql/db_backup/2012-10-15&...
prometheus,k8s学习网站记录
rancher官方文档 一个不错的Prometheus中文网站 上面网站的一个备用地址 AlertManager 何时报警 Alertmanager重复/缺失告警现象探究及两个关键参数group_wait和group_interval的释义 Kubernetes集群监控指标项详解 K8s about pod resource monitoring(记录些常用的Prometheus规则expr) 最近5分钟,pod 磁盘io利用/写, 大于100的1sum(rate(container_fs_writes_bytes_total{pod!=""}[5m])) by (pod,namespace,instance) > 100 最近30分钟pod重启1changes(kube_pod_container_status_restarts_total[30m])>0 Ready状态(配合for参数, 比如for=5m, Ready持续5分钟,说明启动有问题)1kube_pod_container_status_r...
ik分词器自定义词库热更新
官方热更新 IK 分词使用方法目前该插件支持热更新 IK 分词,通过上文在 IK 配置文件中提到的如下配置 1234 <!--用户可以在这里配置远程扩展字典 --><entry key="remote_ext_dict">location</entry> <!--用户可以在这里配置远程扩展停止词字典--><entry key="remote_ext_stopwords">location</entry> 其中 location 是指一个 url,比如 http://yoursite.com/getCustomDict,该请求只需满足以下两点即可完成分词热更新。 该 http 请求需要返回两个头部(header),一个是 Last-Modified,一个是 ETag,这两者都是字符串类型,只要有一个发生变化,该插件就会去抓取新的分词进而更新词库。 该 http 请求返回的内容格式是一行一个分词,换行符用 \n 即可。 满足上面两点要求就可以实现热更新分词了,不需要重...
nodejs的包更新策略加实践
package.json版本123456^ 开头的版本会固定首个大版本,后面的两个小版本会更新到最新,如 vue ^2.5.0 => vue 2.6.14~ 开头的版本会前两个版本,后面的小版本会更新到最新 vuex ~3.1.0 => vuex 3.1.3不带符号,直接写版本号会安装固定的版本 vue-router 3.5.3 => vue-router 3.5.3最小的版本设置为 x 或者 *,其最小的版本号会更新到最新 react 15.4.x => react 15.4.2依次类推任何一位版本设置为 x 或者 *,其当前位置的版本号都会更新到最新永远保持最新版本可以将版本号设置为 x 或者 *,如 pinia * => pinia 2.0.12 npm-check-updates(npm i -g npm-check-updates)工具的使用查看单个包的最新版本1ncu vue 更新 package.json(所有) 的最新依赖项1ncu -u 更新单个依赖1ncu -u vue 查看全局的安装包最新版本1ncu -g 检查某一个...
node环境canvas安装慢、安装失败的解决方法
摘自:https://blog.csdn.net/EverRose/article/details/122846767 node是跨平台的,那么对于任何的node模块理论也是应该是跨平台的。然而,有些node模块直接或间接使用原生C/C++代码,这些东西要跨平台,就需要使用源码根据实际的操作平台环境进行原生模块编译。这也是canvas、SQLite3等模块安装的折磨之源。 canvas的安装过程 npm下载在仓库中的canvas包 执行canvas的package.json中的install命令(node-pre-gyp install --fallback-to-build) node-pre-gyp下载canvas已编译好的 macOS、Linux 和 Windows 的二进制文件,如果预构建的二进制文件不存在或不可用,则回退到从源代码构建 node-gyp编译为当前平台可用的node模块 为什么安装慢,还容易失败从安装过程可以发现, 步骤3和步骤4是核心问题区, canvas的二进制文件托管在https://github.com/Automattic/nod...
minimum_should_match最低匹配度
minimum_should_match顾名思义:最低匹配度,即条件在倒排索引中最低的匹配度。 1. minimum_should_match的使用1.1 数据准备1234567891011121314151617181920212223242526# 创建索引PUT test_match# 创建映射PUT test_match/_mapping{ "properties":{ "price":{ "type":"double" }, "name":{ "type":"text" } }}# 批量导入数据PUT _bulk{"create":{"_index":"test_match","_type":"...
