Error: mongod cannot start with error: keyFile too open permissions
Cause: Mongod key file accepts only mode 600 (read and write by owner only)
chmod 600 ./keyFile
Error: mongod cannot start with error: keyFile too open permissions
Cause: Mongod key file accepts only mode 600 (read and write by owner only)
chmod 600 ./keyFile
Error: When use rs.Add():
{
“errmsg” : “exception: can’t use localhost in repl set member names except when using it for all members”,
“code” : 13393,
“ok” : 0
}
Cause:
1. Your replica set is using localhost for it members and you are adding a new member with IP/hostname other than localhost
2. Your replica set is using IP/hostname for it members and you are adding a new member with localhost as hostname
Solution: Only use localhost for replica set members if you are sure that all mongod/mongos instance are on the same local machine. Otherwise, use hostname or IP.
Error: When use coomand rs.initiate()
{ “errmsg” : “couldn’t initiate : can’t find self in the replset config”, “ok” : 0 }
Cause: a hostname(s) of a replica set member(s) cannot be resolved
Solution: Add hostname(s) in /etc/hosts
Error: addShard() command returns error:
{
“ok” : 0,
“errmsg” : “couldn’t connect to new shard socket exception [CONNECT_ERROR] for replname/hostname:27017”
}
Cause:
1. hostname:27017 cannot be reached
2. if hostname:27017 can be reached, then your replica set [replname] configuration contains members with ‘localhost‘ as host name
Solution: Unless you are running all mongod/mongos instances on the same machine, then you can use ‘localhost’ in rs.Add() command. Otherwise, use hostname instead of localhost in all rs.Add(), sh.addShard() command. Note that when adding a host itself to replcaset/shard an usable hostname should be present in /etc/hosts, or you will get this error:
{ “errmsg” : “couldn’t initiate : can’t find self in the replset config”, “ok” : 0 }
1. Clean up yum db:
sudo rm -f /var/lib/rpm/__db*
sudo rpmdb -vv –rebuilddb
2. If the problem persists, check your proxy config:
sudo grep ‘proxy’ /etc/yum.conf
Note that the proxy config should be present in yum.conf, even if you already set a value for http_proxy
First, get the list of packages to be removed:
rpm -qa –qf=”%{n}-%{v}-%{r}.%{arch}n” ‘mongo*’ | sort
Then use yum remove
sudo yum remove <package names>
The old rule: Swap size should be twice of the RAM is only applicable in the old system when RAM is small (<1GB)
The new rule:
Swap = Equal RAM size (if RAM < 2GB)
Swap = 2GB size (if 2GB < RAM < 8GB)
Swap = 0.5 RAM size (if RAM > 8GB)
There is no benefit to put the swap size twice as RAM > 2GB since a system using up to mutiple GBs in swap memory should not be a good design for performance.
Error: replset couldn’t find a slave with id 1, not tracking <id>
Causes: After removing and adding replica to MongoDB replica set using rs.add() and rs.remove(), the replica set member id’s don’t follow a continuous order from _id: 0, for example:
{
“_id” : “rs0”,
“version” : 1,
“members” : [
{
“_id” : 4,
“host” : “mongodb0.example.net:27017”
},
{
“_id” : 5,
“host” : “mongodb1.example.net:27017”
},
{
“_id” : 7,
“host” : “mongodb2.example.net:27017”
}
]
}
Solution: You can use rs.reconfig() to re-etablish the order:
var cfg = {
“_id” : “rs0”,
“version” : 1,
“members” : [
{
“_id” : 0,
“host” : “mongodb0.example.net:27017”
},
{
“_id” : 1,
“host” : “mongodb1.example.net:27017”
},
{
“_id” : 2,
“host” : “mongodb2.example.net:27017”
}
]
}
rs.reconfig(cfg);
Error: When starting the MongoDB service in the prompt (c:mongodbbinmongod.exe), I get the following error:
exception in initAndListen:13082 getnameinfo error errno:10106
The requested service provider could not be loaded or initialized.. terminating
Cause: This is a WinSock error as in the mongod.log
WSAEPROVIDERFAILEDINIT [10106]: Service provider failed to initialize. This error is returned if either a service provider’s DLL could not be loaded (LoadLibrary failed) or the provider’s WSPStartup or NSPStartup function failed.
Solution: open cmd as admin, type the following and hit Enter to repair winsock.
netsh winsock reset
docker run image /bin/bash -c “cd /path/to/somewhere; python a.py”