使用命令 mongoimport
引數 h 主機ip+埠
d 要匯入的db
c 要匯入的collections
f 指定字段
type=型別
file 匯入的檔案路徑
演示如下:
root@localhost bin]# ./mongoimport -h 192.168.1.151:27017 -d "logs" -c "logs" -f "server,ip,username,account,datetime,program,type,operation,message,messageid" -type=csv -file=/root/test-date.csv
connected to: 192.168.1.151:27017
6854400/5440597038 0%
9600 3200/second
23847600/5440597038 0%
33400 5566/second
36699600/5440597038 0%
51400 5711/second
52264800/5440597038 0%
73200 6100/second
66330600/5440597038 1%
92900 6193/second
81039000/5440597038 1%
113500 6305/second
97032600/5440597038 1%
135900 6471/second
111812400/5440597038 2%
156600 6525/second
120666000/5440597038 2%
169000 6259/second
136302600/5440597038 2%
190900 6363/second
將csv檔案中的資料匯入MongoDB
在cmd中輸入命令 mongoimport dmydb cuser type csv headline f id,name,password,adress file.user.csv 粗體部分需要替換 d 標示 資料庫 c 標示 資料表 type 匯入的資料型別 file 要匯入的檔案位置 f 需要...
Mysql 匯入csv檔案
mysql load data infile命令可以把csv平面檔案中的資料匯入到資料庫中。linux下 load data infile home test dump ip location.csv into table ip location character set utf8 fields ...
Solr匯入CSV檔案
首先得準備好乙份csv檔案,這份檔案可以是手動生成,也可以是從資料庫中匯出來的。參見postgresql匯入匯出資料 將postgres中的表匯出為csv檔案。上傳csv檔案示例,在csv檔案中,header不能加雙引號 postgres匯出時缺省會加上 比如下面的檔案匯入會出錯,id name 8...