#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;