爬虫笔记 | 纯粹写给自己看的,勿点

https://www.runoob.com/mongodb/mongodb-osx-install.html
如果不想在后端运行,而是在控制台上查看运行过程可以直接设置配置文件启动:
mongod –config /usr/local/etc/mongod.conf
查看 mongod 服务是否启动:
ps aux | grep -v grep | grep mongod
使用以上命令如果看到有 mongod 的记录表示运行成功。
启动后我们可以使用 mongo 命令打开一个终端:
$ cd /usr/local/mongodb/bin
$ ./mongo
报错:
mongod –dbpath /usr/local/var/mongodb –logpath /usr/local/var/log/mongodb/mongo.log –fork
2021-01-07T15:45:34.647+0800 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify –sslDisabledProtocols ‘none’
WiredTiger error
Failed to unlink socket file /tmp/mongodb-27017.sock Permission denied
unable to read root page from file:WiredTiger.wt: WT_ERROR
解决方案:
If you don’t need database then remove all the files in database folder (in Ubuntu path will be /usr/lib/mongodb) usingrm -rf /usr/lib/mongodband if you require database then follow this steps: When you upgrade MongoDB Server, let’s say from 3.4 to 3.6. You also need to set database feature compatibility version using this command before upgrading. This command must be run in MongoDB Server v3.4
Tips:
/usr/local/var/log/mongodb看mongo.log
rm -r *
删除当前目录下的所有文件和文件夹。
CTRL+A:光标移到指令最前位置
CTRL+E:光标移到指令最后位置
具体操作:
/usr/local/var/mongodb ? rm -r *
/usr/local/var/mongodb ? mongod –dbpath /usr/local/var/mongodb –repair
/usr/local/var/mongodb ? mongod –dbpath /usr/local/var/mongodb –logpath /usr/local/var/log/mongodb/mongo.log –fork
/usr/local/var/mongodb ? ps aux | grep -v grep | grep mongod
代码最后加上:
client.close()

版权声明