MongoDB集群的variety执行
创建结果数据库
1.创建一个新的存储数据库用来保存分析结果
use keyTest
db.createUser({
user:"root",
pwd:"root",
roles:[{role:"dbOwner",db:"keyTest"}]
})
下载variety脚本
https://github.com/variety/variety
单表分析
/data/tianyiyun/mongodb/bin/mongo 127.0.0.1:37017/mydb -uadmin -padmin --authenticationDatabase admin --eval "var collection='telecom_portal_asset_info',maxDepth=1,limit=500000,persistResults=true,resultsDatabase='192.168.0.103:37017/keyTest',resultsUser='root',resultsPass='root'" "/data/tianyiyun/variety.js"
批量表分析
#!/bin/bash array=(asset_acceptance_info asset_filing_info asset_icp_info asset_info_result asset_info_task_result) for((i=0;i<=${#array[@]}-1;i++)) do echo ${array[i]} /data/tianyiyun/mongodb/bin/mongo 127.0.0.1:37017/mydb -uadmin -padmin --authenticationDatabase admin --eval "var collection='${array[i]}',maxDepth=1,limit=500000,persistResults=true,resultsDatabase='192.168.0.103:37017/keyTest',resultsUser='root',resultsPass='root'" "/data/tianyiyun/variety.js" done
variety操作说明
本文来自博客园,作者:不懂123,转载请注明原文链接:https://www.cnblogs.com/yxh168/p/16711116.html