MongoDB import succeeds on one machine, fails on another

99 views Asked by At

I'm trying to import the KDD-CUP-99 dataset (found here: http://kdd.ics.uci.edu/databases/kddcup99/kddcup99.html) into MongoDB. I've done this on one machine using the following command:

mongoimport --db dbName --collection colName --type csv --file kddcup.data.corrected --fieldFile kddcup99header

When I use findOne() to look at the results, all looks well; the output is as follows:

> db.colName.findOne()
{
    "_id" : ObjectId("547c33e376945996ed878f81"),
    "duration" : 0,
    "protocol_type" : "tcp",
    "service" : "http",
    "flag" : "SF",
    "src_bytes" : 215,
    "dst_bytes" : 45076,
    "land" : 0,
    "wrong_fragment" : 0,
    "urgent" : 0,
    "hot" : 0,
    "num_failed_logins" : 0,
    "logged_in" : 1,
    "num_compromised" : 0,
    "root_shell" : 0,
    "su_attempted" : 0,
    "num_root" : 0,
    "num_file_creations" : 0,
    "num_shells" : 0,
    "num_access_files" : 0,
    "num_outbound_cmds" : 0,
    "is_host_login" : 0,
    "is_guest_login" : 0,
    "count" : 1,
    "srv_count" : 1,
    "serror_rate" : 0,
    "srv_serror_rate" : 0,
    "rerror_rate" : 0,
    "srv_rerror_rate" : 0,
    "same_srv_rate" : 1,
    "diff_srv_rate" : 0,
    "srv_diff_host_rate" : 0,
    "dst_host_count" : 0,
    "dst_host_srv_count" : 0,
    "dst_host_same_srv_rate" : 0,
    "dst_host_diff_srv_rate" : 0,
    "dst_host_same_src_port_rate" : 0,
    "dst_host_srv_diff_host_rate" : 0,
    "dst_host_serror_rate" : 0,
    "dst_host_srv_serror_rate" : 0,
    "dst_host_rerror_rate" : 0,
    "dst_host_srv_rerror_rate" : 0,
    "unknown" : "normal."
}

Now I'm running the same import operation on another machine, using the same files and command, but something isn't working properly. The results of the import are as follows:

> db.colName.findOne()
{
    "_id" : ObjectId("547d8f94facff0761ae10688"),
" : 0,  "duration
" : "tcp",rotocol_type
" : "http",rvice
" : "SF",flag
" : 215,"src_bytes
" : 45076,st_bytes
" : 0,  "land
" : 0,  "wrong_fragment
" : 0,  "urgent
" : 0,  "hot
" : 0,  "num_failed_logins
" : 1,  "logged_in
" : 0,  "num_compromised
" : 0,  "root_shell
" : 0,  "su_attempted
" : 0,  "num_root
" : 0,  "num_file_creations
" : 0,  "num_shells
" : 0,  "num_access_files
" : 0,  "num_outbound_cmds
" : 0,  "is_host_login
" : 0,  "is_guest_login
" : 1,  "count
" : 1,  "srv_count
" : 0,  "serror_rate
" : 0,  "srv_serror_rate
" : 0,  "rerror_rate
" : 0,  "srv_rerror_rate
" : 1,  "same_srv_rate
" : 0,  "diff_srv_rate
" : 0,  "srv_diff_host_rate
" : 0,  "dst_host_count
" : 0,  "dst_host_srv_count
" : 0,  "dst_host_same_srv_rate
" : 0,  "dst_host_diff_srv_rate
" : 0,  "dst_host_same_src_port_rate
" : 0,  "dst_host_srv_diff_host_rate
" : 0,  "dst_host_serror_rate
" : 0,  "dst_host_srv_serror_rate
" : 0,  "dst_host_rerror_rate
" : 0,  "dst_host_srv_rerror_rate
    "unknown" : "normal."
}

Seeing as I'm using the same data files and commands, I figured it must be something in the environment. The system locale settings are identical, yet still the import does not work properly. Has anyone ever seen such behavior before?

Edit I should add that both machines are running the same version of MongoDB: 2.6.5

2

There are 2 answers

0
danielvdende On BEST ANSWER

Eventually I went the long way round, based on @helmy's answer. I exported from the working Mongo instance and imported this into the non-working one.

0
helmy On

I would suggest that you verify that the files are truly the same on both machines:

md5sum kddcup.data.corrected kddcup99header

And also verify the version of the mongoimport tool:

mongoimport --version