Tag Info

Hot answers tagged

23

If I was going to put this into SQL Server, I would suggest a table something like: CREATE TABLE tcp_traffic ( tcp_traffic_id bigint constraint PK_tcp_traffic primary key clustered IDENTITY(1,1) , tcp_flags smallint /* at most 9 bits in TCP, so use SMALLINT */ , src_as int /* Since there are less than 2 billion A.S.'s possible, use INT ...


16

In a company I work for we are dealing with similar amount of data (around 10 TBs of realtime searchable data). We solve this with Cassandra and I would like to mention couple of ideas that will allow you to do O(1) search on a multi TBs database. This is not specific to Cassandra db though, you can use it with other db as well. Theory Shard your data. ...


9

There are a lot of differences between the two of them. MongoDB is more like a traditional RDBMS (nobody shoot). CouchDB performs master-master replication. It's pretty well documented in this much ballyhooed blog post.


8

The best resource has to be the MongoDB docs themselves ... http://www.mongodb.org/display/DOCS/Home I'm constantly finding something new there. Secondly, I'd say you should run the "try MongoDB" in browser tutorial available here, it's awesome. You can try out querying and everything without installing anything. http://try.mongodb.org/ Also, I'd ...


7

Are you running from the 10gen repository or from the default Debian/Ubuntu repo? I recommend using the official 10gen repository. Check this link out - [10gen MongoDB How-To Install on Ubuntu:] http://docs.mongodb.org/manual/tutorial/install-mongodb-on-debian-or-ubuntu-linux/. It is best to uninstall the previous mongodb installation prior to this change, ...


6

If you are using sharding, then the "load balancer" is the mongos process - actually it is more like a router - it keeps an in-memory copy of the config database and can make decisions based on the shard key. If you mean load balancing across identical replica sets or across the members of the set, then there is a feature request to have mongos handle ...


6

I think your first question needs to be relational or non-relational. This depends on what you are doing etc. However your tradeoff is that relational databases (including MySQL in traditional mode) will be relatively rigid with data coming in, but are very flexible with data output. NoSQL databases generally (and Mongo is this way) are very flexible with ...


5

Based on my own benchmarks, find().limit(1) is orders of magnitude faster than findOne(). There is either an error in the MongoDB documentation or a bug in findOne(). findOne() performs more like find().limit(N) where N is the number of documents the query would return. I figured this out while trying to figure out why my simple queries were so slow! ...


5

After some experimentation, I found that it is possible to build a ranking function based on MapReduce, assuming the result set can fit in the max document size. For example, suppose I have a collection like this: { player: "joe", points: 1000, foo: 10, bar: 20, bang: "some text" } { player: "susan", points: 2000, foo: 10, bar: 20, bang: "some text" } { ...


5

You can store your index as a list of fixed-size offsets into the block containing your key data. For example: +--------------+ | 3 | number of entries +--------------+ | 16 | offset of first key data +--------------+ | 24 | offset of second key data +--------------+ | 39 | offset of third key data +--------------+ | ...


4

NOTE to people with itchy downvote fingers: I know that OP has asked about MongoDB and the answer that follows is RDBMS. However, if you check out the comments you'll see that I did ask why MongoDB and OP's answer is a presumption of necessity due to performance. Since nobody has come forth with a Mongo-centric answer in four days, I am going to offer my ...


4

Is it also effective for 10 000 collections with 10 000 documents each ? Most people have the "single large collection" problem and so the sharding is clearly useful for reducing headaches of balancing this data. However, when you have 10 000 small collections, your headache is probably not "balancing the data". With this many small collections your ...


4

MongoDB sharding works by splitting up a collection into smaller 'chunks' and distibuting them evenly across a number of machines. The default chunk size, which is generally the most efficient, is 200MB. So unless a collection grows much larger than 200MB it won't split into chunks, and therefore won't be eligible for sharding, so there'll be no benefits. ...


4

It's unclear what you mean by comparing map-reduce to sharding. But the short answer is: sharding. Generally speaking you design-out map-reduce queries, you do not want 100s of map-reduce queries being executed at once - you'd just overload mongo since that essentially means 100s of full collection scans all being run at the same time. If you have an ...


4

MongoDB doesn't have any concept of ranking. The closest I could find comes from here: Here's some sample data: > db.scoreboard.find()` { "_id" : ObjectId("4d99f71450f0ae2165669ea9"), "user" : "dave", "score" : 4 } { "_id" : ObjectId("4d99f71b50f0ae2165669eaa"), "user" : "steve", "score" : 5 }` { "_id" : ObjectId("4d99f72350f0ae2165669eab"), ...


4

Nothing beats MongoDB : The Definitive Guide as a quick start guide. You can quickly learn many things, including install and start MongoDB why to kill -2 to shutdown and not kill -9 how to enable the web interface how to shard Advaned concepts will come with experience, practice, and data mining all the MongoDB blogs going forward.


4

Tools: http://www.phpmoadmin.com/ https://github.com/sbellity/futon4mongo Documentation: There is always the MongoDB website http://www.mongodb.org/display/DOCS/Admin+Zone Blogs: http://blog.mongodb.org/ http://nosql.mypopescu.com/ http://blog.boxedice.com/mongodb/ There was also the Mongo Conferences - for example slides from the one in the uk can ...


4

Your caching layer sits between Model and View Controller. You should not hit database for needless requests. These requests include in my opinion. Almost all lookup tables. You read city and state list already. Why go to database again. Facts used in almost every page. if you show User's detail every page. Hit to Database once and cache it. Slow queries ...


4

The real reason why you can't do as you ask (limit the memory) is because MongoDB doesn't manage the memory it uses directly - it lets the OS do it. MongoDB just memory maps all its data and then has the OS page it in and out of memory as needed. As a result, there is no direct management of the amount used possible until MongoDB implements this in a ...


4

A replica set can only have one primary at any particular time (one master) with the other nodes being secondaries (slaves) and so they are nothing like master-master (i.e. multi-master) replication. You definitely should move to a replica set from master/slave configuration because that is the preferred and recommended way to replicate. From MongoDB docs: ...


3

findOne() is indeed syntactic sugar for find().limit(1), given that you are actually retrieving the document (as opposed to just returning the cursor with find()). See Leftium's answer and updates for more detail.


3

You can do it either way. There isn't much benefit to starting all of the overhead for sharding now, unless you simply want to try it out to see how it works. It is important to pick the correct shard key, so you would want to make sure your schema and insert/update usage is firm enough to know what to pick. Kristina Chodorow has a great blog entry about ...


3

I suggest a single time series entry per document. There are some problems with storing multiple entries per document: a single document is limited to a certain size (currently 16 MB); this limits how many entries can be stored in a single document as more entries are added to a document, the entire document (and time series) will needlessly be deleted and ...


3

If you look inside mongodb/bin folder (ls -l) You can find a couple of binaries. The mongoDB has import and export tools. If you're running mongod locally on the default port, you can just do: $ ./mongodump Example: Dumping Everything $ ./mongodump --host prod.example.com Example: Dumping a Single Collection $ ./mongodump --db blog --collection ...


3

By the literal interpretation of your question, this can't be done. A secondary/slave cannot be secondary/slave to multiple MongoDB instances. However, what you could do (and still is far from ideal and not recommended in production) is set up multiple MongoDB masters, each with one slave. These slaves all reside on the one server but each runs on a ...


3

I think you meant upsert rather than upstart (upstart being a type of job on an Ubuntu system). Upsert means "update the document if present; insert (a single document) if missing". MongoDB determines that the document is missing solely via examining the criteria document you pass to it. That query to determine whether the document exists is likely the ...


3

MongoDB will use available free memory for caching, and swap to disk as needed to yield memory to other applications on the same server. For the best performance you'll want to have enough RAM to keep your indices and frequently used data ("working set") in memory. Helpful reading: MongoDB FAQ: Does MongoDB require a lot of RAM MongoDB Wiki: Checking ...


3

That question is much too vague to answer. The problem defines the solution, not the other way around. For your specific use-case, I would recommend PostgreSQL + PostGIS. I have no personal experience with PostGIS, but it's a well-supported extension to PostgreSQL.


3

Left to its own devices, no, MongoDB will not move those unsharded databases to a different primary shard - the automatic balancing only applies to chunks from sharded collections. It will round robin through your shards as the databases are created to spread them out across all the shards from that perspective. If you had one shard originally and ...


3

db.dropDatabase() will drop the database, which will also drop all of the collections within a database. If you need to see what databases you have, you can do show dbs. Update: Here's a script to delete everything, make sure you really want to do this: var dbs = db.getSisterDB('admin').adminCommand("listDatabases").databases for(d in dbs) ...



Only top voted, non community-wiki answers of a minimum length are eligible