標籤:blog io os 檔案 on log cti bs ad
#count collection
db.news.count({"lpublishtime":{"$gte":1358697600000}});
#mongo匯出
mongoexport -h 192.168.1.175 --port 33000 -d booaa_so -c weibo -f ‘_id‘ -q "{\"lweibotime\":{\"\$gte\":1349020800000,\"\$lt\":1351699200000}}" -o weibo_20121201_33000.ids &
######################20121227.txt######################
#mongo匯出0.1
mongoexport --port 33000 -d booaa_so -c bbs -f ‘_id‘ -o 33000.bbs.ids;
#替換,將匯出的檔案內容替換成一個插入sql語句
#sed v1
sed ‘s/{ "_id" : { "\$oid" : /insert ignore into index_quene3_test (id,createtime) values (/‘ 33001.bbs.ids> 33001.bbs.ids_tmp
sed ‘s/ } }/,now());/‘ 33001.bbs.ids_tmp> 33001.bbs.ids_final
#sed v2
sed ‘s/{ "_id" : { "\$oid" : "/ /‘ 20130121_33002_bbs.ids> 20130121_33002_bbs.ids_tmp
sed ‘s/" } }/ /‘ 20130121_33002_bbs.ids_tmp> 20130121_33002_bbs.ids_final
#sed 3
sed ‘s/insert into index_quene/insert ignore into index_quene/‘ 33001.weibo.ids_final> 33001.weibo.ids_fffff
#mysql匯入
#2013-01-12 import
mysql -um4n -p01D060A476642BA8335B832AC5B211F222F641B5 -h192.168.1.136 -D boss_db < 33002.bbs.ids_final &
mysql -um4n -p01D060A476642BA8335B832AC5B211F222F641B5 -h192.168.1.136 -D boss_db < 33002.blog.ids_final &
#統計檔案行數數量
[[email protected] ~]$ wc -l weibo_20130121_33002.ids_final
4942900 weibo_20130121_33002.ids_final
#index_module mv
mv busstmp/weiboMerge/weibo0/* buss/weibo0/
mv busstmp/weiboMerge/weibo1/* buss/weibo1/
#mysql sql import
insert ignore into index_quene4 (id,createtime) select id,createtime from index_quene4_test;
mongoDB id 匯出,dump,sed,count,mysql import等用法樣本