Tag Info

New answers tagged

0

sh.removeShardTag() and sh.addShardTag() is optional, not necessary to change ranges on the tag unless adding new or removing redundant shard tags. db.tags.remove() and sh.addTagRange() is required to implement changes in the existing tag range.


0

If you lose one of the three config servers, you just halt migrations, so in a balanced system where you're not exceeding 80% capacity, you should have hours and hours of time to page the duty DBA and bring back that one server. You could virtualize them or place them on management band / highly reliable servers if you really can't afford to have down time ...


0

sh.status() can only be executed on your mongos. As you posted your "sharding status" with sh.status() in your question yourself. You can't do that on the separate shards. Sharding is for distributing your documents. For example documents ABC on shard0000 and documents DEF on shard0001. So Sharding is not Replication. If you want to replicate your documents ...


0

You can just go to your mongod.conf file which is present in /etc in case of ubuntu and comment it and then start your server without authentication. or type mongod --auth in case of authorisation and then mongo -u username -p password --authenticationDatabase admin type mongod --noauth then mongo will start with no authentication and you can create a new ...


2

MongoDB Ops Manager does not (as at 1.8.x) provide monitoring for disk space usage. There's an open feature request you can watch/upvote for this: MMS-569 Alerts/Charts - track disk usage. If you have already installed Munin-node for monitoring CPU & I/O stats you might want to look into using the Munin df plugin to track free disk space. Munin supports ...


0

It'd help more if you could be more specific about what you're modeling, as it's hard to picture at the moment, for me at least. For tree structures, in SQL, any database that supports Recursive Common Table Expressions is a good choice (any major one other than MySQL). For historical data, the History Table pattern has proven to be effective. For table ...


0

The reason The answer is quite simple: when two voting nodes of three are down, the remaining one reverts to secondary, to which – by definition – one can't write. The default read preference is to read from and write to the primary of a replica set only. Hence, when only a secondary remains in the replica set, you can not read. tl;dr You have to change ...


0

You might already know the answer just posting the answer here for someone else like me ending in this post :D vi /etc/mongo.conf smallfiles = true This would set smallfiles true once you restart your mongodb. UPDATE: Rounding a little bit more the answer smallfiles option in mongo what does is reducing the initial and journal data files size, this is ...


0

IIRC MongoDB doesn't directly use memory for data, it uses memory mapped files and lets the OS manage how much is loaded via the normal VFS behaviour. Changing per-process limits is unlikely to affect this. You don't state what platform you are using at all, but if you are already using virtualisation could you could run Mongo in its own VM with a RAM ...


2

On your indices Ok, first things first. Assuming some structure like this { _id: new ObjectId(), date: new ISODate(), message: "Hello, Multikey Indices!", tags: ["MongoDB","Indices","Multikey"] } indexing tags would result in a multikey index. For the document above, the index would have three entries: "MongoDB", "Indices" and "Multikey", all ...


0

I think just -- exporting db and taking out the json file and import in another system. Or You can directly copy the db from one location to another---- http://docs.mongodb.org/manual/reference/method/db.copyDatabase/


1

found the solution by myself. use db.printCollectionStats() in the output you will find the mentioned algorithm in the "wiredTiger.creationString" section. "wiredTiger" : { "metadata" : { "formatVersion" : 1 }, "creationString" : ...


1

Create an admin to create users: > use admin > ( rs.initiate() ) > db.createUser({user:"siteUserAdmin",pwd:"password",roles:[{role:"userAdminAnyDatabase",db:"admin"}]}) Login as userAdmin: $ mongo -u siteUserAdmin -p password --authenticationDatabase admin Create an admin for the cluster: > use admin > ...


0

Found answer here: http://stackoverflow.com/questions/1296358/subtract-days-from-a-date-in-javascript db.system.profile.find({ "timestamp" : { $lt: new Date(), $gte: new Date(new Date().setDate(new Date().getDate()-1)) } })


3

There are a number of system command equivalents available: ls() mkdir() hostname() pwd() sleep() (not a system command, but similar functionality) It should be noted that these are all executed on the client (local) machine, not the server. There is no general construct for executing arbitrary system commands that I know of in the shell. To be honest, ...


2

The pattern you describe is known as "friend of a friend." Here are a couple of answers on SO which may guide you. In the relational database world the friends would be found by following foreign keys. Document DBs, however, eschew explicit foreign keys enforced in the DBMS and join-like functionality in favour of other benefits. It is down to your ...


1

Wiki answer generated from question comments by SDillon No; at least in versions prior to 2.6. After 2.6 I am not 100% sure. I've had this happen in development, thankfully a while ago. I dropped the collection and recovered the data to it. Here is a MongoDB email group post regarding this topic and your exact challenge. Another mistake I made, once, was ...


0

You can use ETL tools like Talend,pentaho,informatica and other tools..my suggestion is that use Talend ETL tool it provides lots of features and its a open source tool.


1

Reproducing the situation : mc1 collection already created on shard0000 before sharding mc2 collection already created on shard0001 before sharding Create a test-shard: $ mongo --nodb mongo> config={d0:{smallfiles:"",noprealloc:"",nopreallocj : ""}, d1 : {smallfiles : "", noprealloc : "", nopreallocj : "" }}; mongo> cluster = new ...


1

You'll need to increase the chunk size (default:64MB), otherwise you'll be limited there. http://blog.mongodb.org/post/100676030403/sharding-pitfalls-part-iii-chunk-balancing-and General limit information from MongoDB : Database Size The MMAPv1 storage engine limits each database to no more than 16000 data files. This means that a single MMAPv1 ...


0

The '...AnyDatabase' roles should be added to the admin database : use admin db.createUser({ user: "mongoadmin" , pwd: "mongoadmin", roles: ["userAdminAnyDatabase", "dbAdminAnyDatabase", "readWriteAnyDatabase"]} Any database: Database User Roles Database Administration Roles Admin databse: Cluster Administration Roles Backup and Restoration Roles ...


-1

MongoDB nodes will vote of who can be next Primary, with a majority of votes. 3 nodes : at least 2 have to choose a certain node. When 2 of the 3 can't vote, the the remaining one, has 1 vote out of 3 => no majority 3 nodes + arbiter : now you have 2 votes out of 4, what is still no majority. Solutions: You could have a script or manually startup an ...


0

I believe the slowdown is caused by running in Windows. I am going to attempt this on a Linux box once our new server arrives. However, the 26GB limit is because of the WiredTiger default configuration which only caches 50% up to max ram. You can change this using the ...


0

So, it turned out that issue was in .ns file of one of the database. I had to delete that file and restart the server. Server started successfully however, the database whose .ns I deleted was lost. For newbies in mongoDB .ns file is the namespace file that mongo creates for each database in its data (/data) directory.


0

Maybe narrow down your code to find where it goes wrong. The following code I have tested with success: <?php $a='55d55a5a706d0917fcc7b103'; $b='newData'; $c='otherData'; $d='1'; $e='2'; $f='3'; $g='4'; $h='5'; $m = new MongoClient( "mongodb://192.168.5.88" ); // connect to ...


1

>use mmsdbagentlog switched to db mmsdbagentlog > show collections app.agentLogs > db.app.agentLogs.stats() { "ns" : "mmsdbagentlog.app.agentLogs", "count" : 1711298, "size" : 524287948, "avgObjSize" : 306, "storageSize" : 71323648, "capped" : true, "max" : -1, "maxSize" : 524288000, ... } Looking in OpsManager ...


0

First a probably silly question, are you replacing all the , , etc placeholders with the actual values from your compose.io database? If you are already doing that, maybe you can debug the connection using the mongo shell to connect to your DB instances. If you have local install of mongodb you can use: mongo host:port/database-name -u user -ppassword ...


0

A Canonical Name record (abbreviated as CNAME record) is a type of resource record in the Domain Name System (DNS) used to specify that a domain name is an alias for another domain, the "canonical" domain. So, you give a 'dnsname' to your config servers. For example mongoCfg1, mongoCfg2 and mongoCfg3. Those dns you can register on a dns server, or in ...


0

You can send rs.stepDown(300) to the replicas on the SSD disks that you want as Secondary. Then they won't get chosen for the next 5 minutes. The replica on the HDD should be Primary when all the others step down. Also make sure that you can read from your secondaries with rs.slaveOK(). In case that your primary has problems, one of your secondaries will ...


0

You created the user correctly, but you missed a parameter when connecting to mongod. By default, the authentication process assumes that the user is stored in the database you connect to, which in your case simply isn't true. You need to specify the autheticationDatabase option: mongo yourMongodIpAddress:27000/targetDb \ --authenticationDatabase admin -u ...


1

I think Ops Manager (can be deployed as local MMS) fits your requirement: … Ops Manager assists with: Deployment. Any topology, at any scale Management. Deploy new clusters. Manage, monitor, and back up existing ones Upgrades. In minutes, with no downtime Scaling. Add capacity, without taking the application offline Point-in-time, ...


0

Please have a look at the Built-in Roles documentation of Mongo. There are different admin roles that can indeed only do some administration. But you can add multiple roles to your user. So adding the 'readWriteAnyDatabase' would give that admin 'user'-rights to use any other database also. 'test'-database is indeed the default database where you enter ...


2

Reasons for unexpected data growth of data files. "Data fragmentation" and data file preallocation When a document is deleted, it's space is used right away if the new document fits into that space. Let's say you delete a document which takes 1kb of disk space and a new document requiring 0.9 Kb of disk space is synced to disk, then the first free space ...


1

Community wiki answer generated from comments on the question by Markus W Mahlberg: You might want to use bulk operations during insert. In case not all your RAM is used, it is safe to assume that either the disks or the inserting program is the limiting factor. With bulk ops, you speed up things for both limiting factors. There is something seriously ...


1

The error/exception is because you point to a local database with --configdb. That should be a serverip:port: ##shards/replicas: mongod --shardsvr --replSet ReplName --dbpath /data/mongodb (--port 27018) --logpath /data/log/log.log ... ##configservers: mongod --configsvr --dbpath /data/cfg (--port 27019) --logpath /data/log/log.cfg ##mongos routers: mongos ...


1

What does "page written failed to compress" indicate? WiredTiger's general strategy is to only compress pages on-disk where there is a storage benefit. The "page written failed to compress" counter is incremented when compression was attempted but didn't result in an on-disk storage saving (so a page was stored uncompressed). Another metric for pages ...


3

MongoDB doesn't have an automatic backup feature built-in -- you have to choose an appropriate backup strategy using command-line or third party tools. The backup procedure will vary depending on your deployment type (standalone, replica set, sharded cluster), disk/dbpath configuration, and backup requirements. Unless you are using a third party tool, ...


0

The best approach is to use a 3 member replica set. Periodically you will stop one of the secondaries, wipe the data directory and start it. The secondary will begin an initial sync which will remove all fragmentation since it will re-write all datafiles from scratch. Then do the same for the other secondary and perform a stepdown. The stepdown will ...


0

You could try this if it gives enough rights to function: db.createUser({user:"nagios",pwd:"pwd",roles:[{role:"read",db:"mydb"},{role:"read",db:"myotherdb"}]}) This gives only read privileges on the database that you want (admin/config/...).


0

For your 7 collections on the primary shard: Enter as administrator on the primary replica (if you shard your replica) and create your collection there by inserting 1 document or creating an index there. When you create a collection via the mongos - shard client - then the collection is started on a random shard; if you create it on the shard itself first, ...



Top 50 recent answers are included