27

Yes.. Easily! mongo "mongodb://test:testpwd@localhost/test?authSource=admin" MongoDB shell version v3.4.6 connecting to: mongodb://test:testpwd@localhost/test?authSource=admin MongoDB server version: 3.4.6 MongoDB> db test MongoDB> You put your destination DB at end of "base" string and add authentication db to parameter authSource


9

ulimit can be set in the same terminal by ulimit -n 10000; You can change the value in /etc/security/limit.conf file by nofiles to 10000 #line the maximum no of files can be opened in any linux/unix system is 64000. be sure of this no. If your restoring of database size is huge then try to make them smaller pieces like create the database and then try ...


7

OK, let's start from basics! After you have connected to mongod with command mongo. List databases with command show dbs iot:PRIMARY> show dbs admin 0.000GB iot 0.020GB local 0.042GB test 0.000GB testi 0.000GB Select one of the DB's with use iot command iot:PRIMARY> use iot switched to db iot List collections on ...


7

Remove []. so solution is: bindIp: 127.0.0.1,192.168.20.1 and remember, no space characters anywhere in that string.


5

Link in the error message exactly explain what happened. A replica set member becomes “stale” when its replication process falls so far behind that the primary overwrites oplog entries the member has not yet replicated. The member cannot catch up and becomes “stale.” When this occurs, you must completely resynchronize the member by removing its ...


5

Ref: https://docs.mongodb.com/manual/tutorial/query-documents/ Select All Documents in a Collection To select all documents in the collection, pass an empty document as the query filter parameter to the find method. The query filter parameter determines the select criteria: db.inventory.find( {} ) These operation corresponds to the following SQL ...


4

Ref: https://docs.mongodb.com/manual/reference/connection-string/#connections-connection-options You will need to use below format and do not need to use admin database. mongodb://user:password@localhost/test?authSource=admin /database Optional. The name of the database to authenticate if the connection string includes authentication credentials in ...


4

Strange indeed. That local.oplog.rs is journaling what is enable (default) at 64 bit systems (32bit default value is false). So, running time for that thread should be same than your mongod uptime. But journaling should not rise CPU usage. When you have high CPU usage, what mongotop and mongostat shows? What is happening in the system? If you look ...


3

Originally, all database operation in MongoDB are encoded in the Wire Protocol. However, this would mean that creating a new command would involve: Creating a new opcode in the wire protocol, and Bumping the wire protocol version. Another disadvantage with this approach is that the format of the opcodes cannot change without changing the wire protocol ...


3

I guess MongoDB can do index seek and index scan ? Yes MongoDB can do index seek and index scan, but it can do both during one fetch. That is what happened in your case. If started with a seek to the leftmost record of your index cuisine_1 and did a scan on 25359 keys. During the scan of 25359 keys 1553 key matched your search criteria. Index not being a ...


3

This is by design. If you want to run with only one node, restart that node without replica set switch. If a majority of the replica set is inaccessible or unavailable to the current primary, the primary will step down and become a secondary. The replica set cannot accept writes after this occurs, but remaining members can continue to serve read ...


3

Do we need to keep extra memory for some kind of memory mapped files for MongoDB data files The mem.mapped and mem.mappedWithJournal metrics in serverStatus output are only applicable to the MMAPv1 storage engine, so are expected to be 0 with WiredTiger. These metrics predate the storage engine API (and WiredTiger) so will likely be moved to a storage-...


2

Use full path for keyfile. Don't use ~ -character there. Your mongod is started (probably) with user 'mongod' and that user don't have home directory. Additionally keyfile must be have chmod 0400 and ownership same than user who run mongod process (mongod).


2

OK.. It's look like that you have managed to mix things. So, you have working mongodb at "C:\program files\mongodb\data" and now you want to convert that mongodb to three node replica set?!? First after you have start that mongod process with --replSet replicaSetMGL parameter. Log in (with mongo -program) and give command rs.initiate(). Then remove all ...


2

Assuming you aren't using any newer features or index/collection options from MongoDB 3.2+ that aren't supported in MongoDB 3.0, you should be able to restore the backup. Before doing so, I would review the downgrade instructions in the MongoDB documentation to check for potential issues: Downgrade MongoDB 3.4 to 3.2 Downgrade MongoDB from 3.2 The ...


2

Not need. You just give user needed rights to the wanted non-admin database. User can use admin database as authentication database even user doesn't have read/write access to admin database. use products db.grantRolesToUser("productsUser",[ "readWrite" ]) grantRolesToUser documentation. UPDATE Let's create mongodb instance with --auth. Login as admin, ...


2

No, not directly! If your data is top of LVM, do a snapshot and copy that to another node, start it and connect it to the replica set. This only if you have lot's of data and normal initial sync (as @SqlWorldWide wrote) would take too long time.


2

I fixed the issue by adding below lines in /etc/mongod.conf replication: replSetName: yogi


2

Dmitry, As of MongoDB v3.6, MongoDB only supports the linearizable read concern on single documents, hence the wording of the documentation. However, it doesn't mean you have to run the query using a unique index, but that you have to be sure your query only returns one document. Of course, it can only help to have a query filter that uses a unique index (...


2

I have gone through your error and find out that in your case the Open file limit is 990000. Which is sufficient to open the mongos and mongod process. As per MongoDB BOL Here The default net.maxIncomingConnections should be Default: 65536 and by default LimitNOFILE should be Here LimitNOFILE=64000. The maximum number of simultaneous connections that mongos ...


2

Because nothing is written to log file, the first (and only) problem is (probably) ownership of log file. Usermongodb don't have access to that file. sudo chown -R mongodb: /var/log/mongodb should fix that. What comes to the original question of how to run mongod at the command line and see what is happening, you have two choices. First is comment out (from ...


2

I would like to know what could be the real reason for the replica sets to function slower compared to the standalone db. Replica sets provide high availability and data redundancy, but these benefits are best realized using separate server resources. With multiple data-bearing replica set members on a single server you are adding contention for the ...


2

Use the arrayFilters property: db.getCollection("test").updateOne( { "wid": 1 }, { $inc: { "items.$[aa].sent": 37, "items.$[bb].sent": 58, "items.$[cc].sent": 172 } }, { upsert: false, arrayFilters: [ { "aa.nid": 2 }, { "bb.nid"...


2

Since you are using a hosted database service (MongoDB Atlas), many administrative commands are limited as they are either provided via the management interface or likely to introduce performance/stability issues. The Atlas free tier has additional limitations since it is backed by a shared MongoDB instance. See: Unsupported Commands in M0/M2/M5 Clusters. ...


2

Mongo -command have multiple parameters that are handy in this case. '--eval' let you run commands and '--quiet' keep all clutter away out=$(mongo --quiet --eval="db.currentOp()") ; echo $out


1

Of course when you do regex query (starting with star), we cannot directly do index scan, we need to read all index entries thru. What comes to "seeks":1 it reports the number of times that we had to seek the IndexCursor to a new position in order to complete the index scan. I guess that only developers/architects can answer to question "why there is no ...


1

Since you're using MongoDB 3.4.7 with WiredTiger, there are certain defaults in place if you run MongoDB with the default values (journal is enabled): If newly created, the replica set would use protocol version 1 (see Replica Set Protocol Versions) Default write concern is {w:1} (see Write Concern) With {w:'majority'}, the default is {j:true} if journal is ...


1

The answer to your question: Writing data change to disk. When journaling is on, the first change is written to the journal, then it is written to data blocks.


1

Hmm.. You have MMAPv1 engine in use... If your mongodb version is BEFORE 3.0, you can use mongodump and --dbpath parameter to read data directly from data files.


1

@Zhao Yi,what you are looking ? I hope so that you shall find out your solution Here For example i am attaching a one example as shown below The Explanation of the code is : The first step is to specify the username and password which needs to be created. The second step is to assign a role for the user which in this case since it needs to be a database ...


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