摘要: 软件层面优化 设置WiredTiger的cacheSizeGB 默认配置在系统可用内存的60%左右,如果一台机器上只部署一个mongod,mongod可以使用所有可用内存,则使用默认配置即可。 storage.wiredTiger.engineConfig.cacheSizeGB 值的范围可以从 0 阅读全文
posted @ 2021-09-27 17:25 Varden 阅读(964) 评论(0) 推荐(0) 编辑
摘要: 清理脚本:/root/scripts/clean_mongodb_log.sh #!/bin/bash # set -u echo " Started Time: `date` " mongodb_logdir=/var/log/mongodb days=7 pid=$(pidof $(which 阅读全文
posted @ 2021-09-27 14:59 Varden 阅读(455) 评论(0) 推荐(0) 编辑
摘要: mongodump 常用选项说明: --db 指定要备份的数据库,如果不指定,则备份所有数据库 --collection 指定要备份的集合,如果不指定,则备份所有集合 --gzip 压缩输出,文件后缀为.gz --archive 将输出写入指定的归档文件,如果不指定,则写入到stdout --opl 阅读全文
posted @ 2021-09-27 14:51 Varden 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 查看服务器状态 db.serverStatus() 查看数据库状态 db.stats() mongostat 命令格式: mongostat --username=admin --password=password --authenticationDatabase=admin --rowcount= 阅读全文
posted @ 2021-09-27 13:40 Varden 阅读(293) 评论(0) 推荐(0) 编辑
摘要: 连接副本集 >>> import pymongo >>> url = r'mongodb://admin:password@mongodb-1,mongodb-2/?replicaSet=rs1&readPreference=secondaryPreferred' >>> conn = pymong 阅读全文
posted @ 2021-09-27 11:44 Varden 阅读(438) 评论(0) 推荐(0) 编辑
摘要: 在所有节点创建超级管理员 db.createUser({user: "admin",pwd: "password",roles: ["root"]}) 配置/etc/mongod.conf文件 security: authorization: enabled keyFile: /data/mongo 阅读全文
posted @ 2021-09-27 11:13 Varden 阅读(254) 评论(0) 推荐(0) 编辑
摘要: 4.4版本 sudo apt-get install gnupg wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add - echo "deb [ arch=amd64,arm64 ] http 阅读全文
posted @ 2021-09-27 10:35 Varden 阅读(288) 评论(0) 推荐(0) 编辑
摘要: 4.4版本 apt-get install gnupg wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | apt-key add - echo "deb http://repo.mongodb.org/apt/debian 阅读全文
posted @ 2021-09-27 10:28 Varden 阅读(631) 评论(0) 推荐(0) 编辑