随笔分类 - 数据库 / A-数据库之MongoDB
摘要:################################### 请注意,预构建的二进制文件可在 mongodb.org上获得,这可能是最简单的入门方式,而不是从源代码构建。 要构建 MongoDB,您需要: 能够编译 C++17 的现代 C++ 编译器。需要以下其中一项: GCC 8.2 或
阅读全文
摘要:########## [work@10.10.10.10]$ cat collector.conf # if you have any problem, please visit https://github.com/alibaba/MongoShake/wiki/FAQ # for the det
阅读全文
摘要:############## 使用mongodb聚合查询,在$where条件中使用了javascript表达式,执行报错误: no globalScriptEngine in $where parsing 可通过修改mongodb配置文件中的javascriptEnabled为true解决: sec
阅读全文
摘要:################# mongodb的日志: 系统日志级别:可以根据系统日志级别搞最详细来排查问题 /home/work/mongodb/4.0.17/bin/mongod -f /home/work/mongodb/mongo_28042/etc/mongodb.conf -vvvv
阅读全文
摘要:################## mongodb的日志文件mongodb.log的部分内容如下: 2021-09-13T17:12:27.169+0800 I NETWORK [listener] connection accepted from 10.132.73.15:54792 #2560
阅读全文
摘要:################################ 有时候,需要将处于OTHER状态的副本集成员的数据恢复到其他副本集,这时候就需要将其状态改为独立的副本集:但是副本集名称不能改变 apple:OTHER> cfg={_id:"apple",members:[{_id:1,host:"
阅读全文
摘要:############################################ https://www.percona.com/doc/percona-backup-mongodb/installation.html#install-pbm-on-red-hat-enterprise-li
阅读全文
摘要:############################ 获取某个配置参数的值: xxx:PRIMARY> db.runCommand( { getParameter :1, "cursorTimeoutMillis":1 } ) { "cursorTimeoutMillis" : NumberLo
阅读全文
摘要:############################### keyfile是mongodb副本集的实例之间的权限认证,要求如下: 1, keyfile文件的权限必须是600; 2,keyfile文件的内容比如完全相同。 openssl rand -base64 745 > /data/mongo
阅读全文
摘要:############################## 原集合名字:db.aaa 复制后的集合名字:db.bbb (复制会自动创建) db.aaa.find({}).forEach(function(x){db.bbb.insert(x)}) 注意:千万不要使用 db.source.copyT
阅读全文
摘要:############## 关于索引 原则上对于所有的查询都需要有对应的索引,对于上万条记录的collection,是一定需要对应的索引; 索引长度限制1024字节(index key limit), 避免对大字符串字段创建索引和作为查询条件(MongoDB4.2有改动) 注意组合索引创建的字段顺
阅读全文
摘要:############################################# 一、实例级别恢复: 二、数据库级别恢复: 三、表级别恢复: ################################################
阅读全文
摘要:################################### 在工作中会经常遇到一些mongodb的聚合操作,特此总结下。mongo存储的可以是复杂类型,比如数组、对象等mysql不善于处理的文档型结构,并且聚合的操作也比mysql复杂很多。 注:本文基于 mongodb v3.6 目录
阅读全文
摘要:################# 重定向输入mongo脚本: #! /bin/bash mongo --username root --password 123456 --host 10.10.10.10 --port 27017 --authenticationDatabase admin <<
阅读全文
摘要:################################### 返回正在执行且运行时间超过10s的连接信息: db.currentOp({"secs_running": {"$gt": 10},"active": true}) 返回去掉系统线程的连接: db.currentOp({ "act
阅读全文
摘要:################################## 一、插入数据insert : 插入一条数据: db.products.insert( { _id: 10, item: "box", qty: 20 } ) 插入多条数据: db.products.insert( [ { _id:
阅读全文
摘要:############################ 我打日志跑完这句查询耗时1000ms以上 并且报这个错 rpc调用出现异常 java.lang.RuntimeException: org.springframework.data.mongodb.UncategorizedMongoDbEx
阅读全文
摘要:mongotop 使用在数据查询数据卡、慢、查询不出来的情况下使用。total 保持为0最好,有时冒出个100ms-200ms问题不大,一般大于500 可以考虑给当前表做索引优化,结合慢查询日志找出mongod执行慢的原因。 ns:包含数据库命名空间,后者结合了数据库名称和集合。 db:包含数据库的
阅读全文
摘要:################################################################
阅读全文
摘要:[work@xxx bin]$ mongostat --port 28042 --authenticationDatabase admin -umongodb_dba -p123456 insert query update delete getmore command dirty used flu
阅读全文