将mysql数据导入mongodb

admin 发布于:2013-11-21 16:07 分类:Linux  有 1812 人浏览,获得评论 0 条 标签: mysql mongodb 

1、进入Mysql,将数据导成CVS

select * from test_info into outfile '/tmp/test.csv' fields terminated by ',' optionally enclosed by '"' escaped by '"' lines terminated by '\r\n';


2、将CVS导入到Mongodb中
#./bin/mongoexport -h "127.0.0.1:16688" -u"username" -p "password" -d "test" -c "test_info" -f "id,name" -type=csv -file="/tmp/test.csv"