mongoDB id 匯出,dump,sed,count,mysql import等用法樣本

來源:互聯網
上載者:User

標籤: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等用法樣本

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.