1. mamp 中mysql 无法正常启动
2019-07-06 11:24:01 7fffacd58340 InnoDB: Operating system error number 2 in a file operation.
InnoDB: The error means the system cannot find the path specified.
InnoDB: If you are installing InnoDB, remember that you must create
InnoDB: directories yourself, InnoDB does not create them.
InnoDB: Error: could not open single-table tablespace file ./mysql/innodb_index_stats.ibd
InnoDB: We do not continue the crash recovery, because the table may become
InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.
InnoDB: To fix the problem and start mysqld:
InnoDB: 1) If there is a permission problem in the file and mysqld cannot
InnoDB: open the file, you should modify the permissions.
InnoDB: 2) If the table is not needed, or you can restore it from a backup,
InnoDB: then you can remove the .ibd file, and InnoDB will do a normal
InnoDB: crash recovery and ignore that table.
InnoDB: 3) If the file system or the disk is broken, and you cannot remove
InnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnf
InnoDB: and force InnoDB to continue crash recovery here.
解决方式:
解决办法:
一、打开MAMP PRO,选择菜单栏File->Edit Template->MySQL->5.5.3(选择你的版本)),这时打开了一个文本,找到
[mysqld]
注意带上中括号,在这行下面加一行
innodb_force_recovery = 1 (可换1-6 进行尝试)
二、启动mySQL,成功后再关闭;
三、重新打开那个文本,删除添加的 innodb_force_recovery = 1 行;
四、再打开mySQL,完毕。
参考: https://blog.csdn.net/svendson/article/details/76423270?fps=1&locationNum=9
不求甚解,深以为耻
2. 七牛的子域名和自定义域名再上传和下载上的区别?
七牛自定义域名为融合域名,如果某家节点出现故障,可以及时切换线路到其他家。
https://developer.qiniu.com/kodo/manual/1655/download-public
https://developer.qiniu.com/fusion/manual/4940/domain-name-operation
3. puppeteer 在centos 6.x 上适配嫉妒恶心,建议使用centos 7
在 macOS上运转正常,而在centos 6.x 上报各种奇奇怪怪的依赖缺失。
ldd /data/apps/su-web-crawler/su-web-crawler.src/node_modules/puppeteer/.local-chromium/linux-674921/chrome-linux/chrome | grep not
// 用来查看具体缺失的依赖
https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#chrome-headless-doesnt-launch-on-unix
https://github.com/GoogleChrome/puppeteer/issues/391
换 centos 7 秒好。 还有同学建议用docker,没有去实践 不做评价
以上换centos 7 秒好的言论,我本着实事求是的原则道歉。实际操作应该是在centos上安装chrome。 出现以上问题的根源我分析是chrome在centos6 上的问题,所以无论在哪只要正常安装浏览器 都可以正常跑起来。
4. egg.js 生产环境不用egg-script, 而用 supervisor / pm2 守护
鉴于一些原因(例如我是因为发布系统脚本无法随意更改),因此无法动态的为egg项目生成启动脚本。
// server.js
const egg = require("egg");
// 设置默认参数
// 参数参考地址: https://github.com/eggjs/egg-cluster#options
const DEFAULT_OPTIONS = {
port: 7001,
workers: require("os").cpus().length
}
// 解析传入参数
const program = require("commander");
program.version("0.0.1").option('--NODE_CONFIG', 'node config').parse(process.argv);
const args = JSON.parse(program.args[0]);
const workers = Number(args.workers || DEFAULT_OPTIONS.workers);
egg.startCluster({
workers,
baseDir: __dirname,
port: args.port || DEFAULT_OPTIONS.port
});
参考文档手写一个入口提供启动
5. 快速搭建centos 下可用的node环境
- yum 安装node
- yum 安装git
- 安装mongo
- 修改mongo bind_ip 为0.0.0.0
- egg.js post invalid csrf token
- nginx 反向代理
- ssl 证书
6. Cannot read property 'resolve' of undefined
问题描述: 在升级完Node之后,npm install 显示 Cannot read property 'resolve' of undefined(如上图,并且安装失败)
解决方案:
- 重新安装Node + Npm;
- (我的解决方案)由于我用的是n安装的多Node环境,首先升级n模块至最新再安装对应Node版本就可以修复此问题,亲测可用;
7. mysql: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/mysql.rb:167: syntax error, unexpected keyword_ensure, expecting keyword_end
解决方案:
rm -rf /usr/local/Homebrew/.git
brew update
brew config
参考:
https://blog.csdn.net/alexander_phper/article/details/80183814
https://github.com/Homebrew/brew/issues/3353
7.nginx 代理多个vue静态项目
亲测可用
https://zhuanlan.zhihu.com/p/242758284
8. 使用 fluent-ffmpeg
这个包时,需要保证 Node 环境下安装了FFmpeg,所以需要前置向centos中安装。安装流程如下:
# 先安装epel-release
yum install epel-release
# 安装nux存储库
rpm -v --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
#最后安装ffmpeg
yum install ffmpeg ffmpeg-devel
//等走完,国外服务器很快
可以通过 ffmpeg -version
验证一下。