18

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


6

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


5

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 ...


4

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 ...


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

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

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

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 ...


2

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

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

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 ...


2

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 ...


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

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

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. ...


1

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 ...


1

If you now command: sudo chown -R mongodb:mongodb /home/user/mongodb sudo service mongod restart It will work! Problems here was that you gave command sudo mongod --dbpath /home/user/mongodb/data/ what created ROOT ownded files to that /home/user/mongodb/data/ directory and your "normal" mongodb user don't have right to overwrite those. So, NEVER start ...


1

You cannot add a MongoDB 3.4.x member to a MongoDB 3.0.x replica set. Replication between mixed versions is only supported for adjacent MongoDB major releases (for example, 3.0 and 3.2 or 3.2 and 3.4), and even then generally only intended to be used transiently for the purposes of a rolling upgrade. what does it mean this find command not yet ...


1

First.. You cannot have two same name replica sets in one cluster (rs0), rename that second one to rs1. (Ports 27020 - 270122). Error message is telling directly what you should do.. So, add --shardsvr to every started replica set. From mongod --replSet xxx to mongod --shardsvr --replSet xxx And of course after log in to mongoS service, you need to add ...


1

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 /database Optional. The name of the database to authenticate if the connection string includes authentication credentials in the form of ...


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

@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 ...


1

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, ...


1

If you have modified X nodes priority at rs.conf() higher number than Y node, switch over should automatically happen WHEN X has replicated all information from Y node. Not before that. If switch doesn't happen, check rs.printSlaveReplicationInfo() that your X is really 0 second behind. It sounds like that your Y is so slow that even X cannot read opLog fast ...


1

You get that "role" : "enableSharding" for customerdb because of "role" : "dbAdmin". So, that use can shard customerdb, but nothing else.


1

As per your log i am able to see you are using linux O.S. So, the below grep command you are able to see how connections open to the MongoDB port (27017) on my computer. $ sudo lsof | grep mongod | grep TCP As per you log statement, After execution the above query . which you have already said in your question statement. I am able to see your log ...


1

I check on same version on windows server with mongodb 3.4.6. Please find below scripts. 1) run shard servers "C:\Program Files\MongoDB\Server\3.4\bin\mongod.exe" --shardsvr --replSet rs0 --dbpath "C:\Mongodb_Databases\MongoDB_Shard\WT_mongod1" --logpath "C:\Mongodb_Databases\MongoDB_Shard\WT_mongod1\log.int1" --port 27000 --logappend "C:\Program Files\...


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