I can connect to all 3 servers from each other.
root@server-1:/# mongo --host server-2 --port 27017
MongoDB shell version v4.0.5
connecting to: mongodb://drjscgerlx042:27017/?gssapiServiceName=mongodb
Implicit session: session { “id” : UUID(“148d025f-8012-4c60-bcfd-3b28c1231ed2”) }
MongoDB server version: 4.0.5
graylog_sistemas:SECONDARY>
root@server-1:/# mongo --host server-3 --port 27017
MongoDB shell version v4.0.5
connecting to: mongodb://drjscgerlx043:27017/?gssapiServiceName=mongodb
Implicit session: session { “id” : UUID(“38b460a4-1774-4d53-8f29-bcc7e876105c”) }
MongoDB server version: 4.0.5
root@server-2:/# mongo --host server-1 --port 27017 -u root -p admin20
MongoDB shell version v4.0.5
connecting to: mongodb://server-1:27017/?gssapiServiceName=mongodb
Implicit session: session { “id” : UUID(“2ba6ea25-b0a4-4376-a13c-c23eea4a079d”) }
MongoDB server version: 4.0.5
Server has startup warnings:
2019-01-30T15:58:04.501-0200 I STORAGE [initandlisten]
2019-01-30T15:58:04.501-0200 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2019-01-30T15:58:04.501-0200 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem
2019-01-30T15:58:05.969-0200 I CONTROL [initandlisten]
2019-01-30T15:58:05.969-0200 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is ‘always’.
2019-01-30T15:58:05.969-0200 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2019-01-30T15:58:05.969-0200 I CONTROL [initandlisten]
2019-01-30T15:58:05.969-0200 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always’.
2019-01-30T15:58:05.969-0200 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2019-01-30T15:58:05.969-0200 I CONTROL [initandlisten]
Enable MongoDB’s free cloud-based monitoring service, which will then receive and display
metrics about your deployment (disk utilization, CPU, operation statistics, etc).
The monitoring data will be available on a MongoDB website with a unique URL accessible to you and anyone you share the URL with. MongoDB may use this information to make product
improvements and to suggest MongoDB products and deployment options to you.
To enable free monitoring, run the following command: db.enableFreeMonitoring()
To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
graylog_sistemas:PRIMARY>
root@server-2:/# mongo --host server-1 --port 27017
MongoDB shell version v4.0.5
connecting to: mongodb://drjscgerlx047:27017/?gssapiServiceName=mongodb
Implicit session: session { “id” : UUID(“8fe527df-c653-428c-bbab-4e7f30538ca0”) }
MongoDB server version: 4.0.5
graylog_sistemas:PRIMARY>
root@server-2:/# mongo --host server-3 --port 27017
MongoDB shell version v4.0.5
connecting to: mongodb://drjscgerlx043:27017/?gssapiServiceName=mongodb
Implicit session: session { “id” : UUID(“2118a1f8-464a-4a0a-a215-493779df1eca”) }
MongoDB server version: 4.0.5
root@server-3:/# mongo --host server-1 --port 27017 -u root -p admin20
MongoDB shell version v4.0.5
connecting to: mongodb://server-1:27017/?gssapiServiceName=mongodb
Implicit session: session { “id” : UUID(“3e316ad7-c30d-4cc4-ae25-0a4d9b7bd9e3”) }
MongoDB server version: 4.0.5
Server has startup warnings:
2019-01-30T15:58:04.501-0200 I STORAGE [initandlisten]
2019-01-30T15:58:04.501-0200 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2019-01-30T15:58:04.501-0200 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem
2019-01-30T15:58:05.969-0200 I CONTROL [initandlisten]
2019-01-30T15:58:05.969-0200 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is ‘always’.
2019-01-30T15:58:05.969-0200 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2019-01-30T15:58:05.969-0200 I CONTROL [initandlisten]
2019-01-30T15:58:05.969-0200 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always’.
2019-01-30T15:58:05.969-0200 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2019-01-30T15:58:05.969-0200 I CONTROL [initandlisten]
Enable MongoDB’s free cloud-based monitoring service, which will then receive and display
metrics about your deployment (disk utilization, CPU, operation statistics, etc).
The monitoring data will be available on a MongoDB website with a unique URL accessible to you
and anyone you share the URL with. MongoDB may use this information to make product
improvements and to suggest MongoDB products and deployment options to you.
To enable free monitoring, run the following command: db.enableFreeMonitoring()
To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
graylog_sistemas:PRIMARY>
root@server-3:/# mongo --host server-1 --port 27017
MongoDB shell version v4.0.5
connecting to: mongodb://10.216.76.12:27017/?gssapiServiceName=mongodb
Implicit session: session { “id” : UUID(“5935bd9f-4727-4838-933b-c43b829a228f”) }
MongoDB server version: 4.0.5
graylog_sistemas:PRIMARY>
root@server-3:/# mongo --host server-2 --port 27017
MongoDB shell version v4.0.5
connecting to: mongodb://drjscgerlx042:27017/?gssapiServiceName=mongodb
Implicit session: session { “id” : UUID(“68212cca-2c94-4757-845d-a1727a67623e”) }
MongoDB server version: 4.0.5
graylog_sistemas:SECONDARY>
I’m trying to understand why the server-3 didn’t change its status from STARTUP to STARTUP2, so it can get the configuration from the replica set.
root@server-3:/# mongo
MongoDB shell version v4.0.5
connecting to: mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb
Implicit session: session { “id” : UUID(“6e57c0e8-fe73-402d-97ac-3f76ed0a8692”) }
MongoDB server version: 4.0.5
rs.conf()
2019-02-01T11:51:15.565-0200 E QUERY [js] Error: Could not retrieve replica set config: {
“ok” : 0,
“errmsg” : “not authorized on admin to execute command { replSetGetConfig: 1.0, lsid: { id: UUID("6e57c0e8-fe73-402d-97ac-3f76ed0a8692") }, $db: "admin" }”,
“code” : 13,
“codeName” : “Unauthorized”
} :
rs.conf@src/mongo/shell/utils.js:1448:11
@(shell):1:1
rs.status()
{
“ok” : 0,
“errmsg” : “no replset config has been received”,
“code” : 94,
“codeName” : “NotYetInitialized”
}
use admin
switched to db admin
db.auth(“root”, “admin20”);
Error: Authentication failed.
rs.initiate()
{
“ok” : 0,
“errmsg” : “No host described in new configuration 1 for replica set graylog_sistemas maps to this node”,
“code” : 93,
“codeName” : “InvalidReplicaSetConfig”
}
rs.syncFrom(“server-1”)
{
“ok” : 0,
“errmsg” : “not authorized on admin to execute command { replSetSyncFrom: "server-1", lsid: { id: UUID("3af3a940-7be8-46a3-b8b6-232006c71551") }, $db: "admin" }”,
“code” : 13,
“codeName” : “Unauthorized”
}
Another thing that I find very awkward was that information
graylog_sistemas:PRIMARY> rs.printSlaveReplicationInfo()
source: server-2:27017
syncedTo: Fri Feb 01 2019 12:34:23 GMT-0200
0 secs (0 hrs) behind the primary
source: server-3:27017
syncedTo: Wed Dec 31 1969 21:00:00 GMT-0300
1549031663 secs (430286.57 hrs) behind the primary
But the server-3 has the right date. I think that thing is the cause of all the problems. But I couldn’t find the command to sync this.
Any clues?