python连接
try:
conn = MongoClient(ip, port)
database = conn[db] #db为数据库名称
my_set = database[tb]#tb为表名称
# logger.info("需要检测的字段:{0}".format(field))
nm_all = my_set.estimated_document_count()#数据库总条数
all_dates=my_set.find().limit(10)
return all_dates#返回需要检测的数值,数量,第几条
except Exception as e:
logger.error(e)
1:数据库的备份,恢复,资源监控
mongodump -h 127.0.0.1 -d db -o path