2024年5月7日发(作者:)

2021-09-07T11:32:01.185+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.

2021-09-07T11:32:01.185+0800 I CONTROL [initandlisten] ** We suggest setting it to 'never'

2021-09-07T11:32:01.185+0800 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: FreeMonitoring()

To permanently disable this reminder, run the following command: eFreeMonitoring()

---

replzhibo:PRIMARY> show dbs

admin 0.000GB

config 0.000GB

local 0.000GB

mgdb_zhibo 0.000GB

replzhibo:PRIMARY> use mgdb_zhibo

switched to db mgdb_zhibo

replzhibo:PRIMARY> show tables

tb_test01

replzhibo:PRIMARY> _()

{ "_id" : ObjectId("6136baaaa1a3083a14385d2f"), "name" : "yiibai tutorials" }

从节点:

/usr/local/services/mongodb/bin/mongo 192.168.1.85:28002

[root@localhost conf]# /usr/local/services/mongodb/bin/mongo 192.168.1.85:28002

MongoDB shell version v4.2.9

connecting to: mongodb://192.168.1.85:28002/test?compressors=disabled&gssapiServiceName=mongodb

Implicit session: session { "id" : UUID("c239105b-ac85-431c-a5c2-78c00e02a177") }

MongoDB server version: 4.2.9

Server has startup warnings:

2021-09-08T11:31:13.449+0800 I CONTROL [initandlisten]

2021-09-08T11:31:13.449+0800 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.

2021-09-08T11:31:13.449+0800 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.

2021-09-08T11:31:13.449+0800 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.

2021-09-08T11:31:13.449+0800 I CONTROL [initandlisten]

2021-09-08T11:31:13.449+0800 I CONTROL [initandlisten]

2021-09-08T11:31:13.449+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.

2021-09-08T11:31:13.449+0800 I CONTROL [initandlisten] ** We suggest setting it to 'never'

2021-09-08T11:31:13.449+0800 I CONTROL [initandlisten]

2021-09-08T11:31:13.449+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.

2021-09-08T11:31:13.449+0800 I CONTROL [initandlisten] ** We suggest setting it to 'never'

2021-09-08T11:31:13.449+0800 I CONTROL [initandlisten]

2021-09-08T11:31:13.449+0800 I CONTROL [initandlisten] ** WARNING: soft rlimits too low. rlimits set to 4096 processes, 65536 files. Number of processes should be at least 32768 : 0.5 times numbe

2021-09-08T11:31:13.449+0800 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: FreeMonitoring()

To permanently disable this reminder, run the following command: eFreeMonitoring()

---

replzhibo:SECONDARY> show dbs

2021-09-08T11:37:12.468+0800 E QUERY [js] uncaught exception: Error: listDatabases failed:{

"operationTime" : Timestamp(1630985751, 1),

"ok" : 0,

"errmsg" : "not master and slaveOk=false",

"code" : 13435,

"codeName" : "NotMasterNoSlaveOk",

"$clusterTime" : {

"clusterTime" : Timestamp(1630985751, 1),

"signature" : {

"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),

"keyId" : NumberLong(0)

}

}

} :

_getErrorWithCode@src/mongo/shell/:25:13

/<@src/mongo/shell/:135:19

@src/mongo/shell/:87:12

@src/mongo/shell/:906:13

shellHelper@src/mongo/shell/:790:15

@(shellhelp2):1:1

解决办法:

SECONDARY> k();

继续查看

replzhibo:SECONDARY> show dbs

admin 0.000GB

config 0.000GB

local 0.000GB

mgdb_zhibo 0.000GB

replzhibo:SECONDARY> use mgdb_zhibo

switched to db mgdb_zhibo

replzhibo:SECONDARY> show tables;

tb_test01

replzhibo:SECONDARY> _()

{ "_id" : ObjectId("6136baaaa1a3083a14385d2f"), "name" : "yiibai tutorials" }

replzhibo:SECONDARY> show tables;

tb_test01

replzhibo:SECONDARY> _();

{ "_id" : ObjectId("6136baaaa1a3083a14385d2f"), "name" : "yiibai tutorials" }

{ "_id" : ObjectId("6136e0abdbe64e26fd84c9f2"), "name01" : "yiibai tutorials" }

replzhibo:SECONDARY>

-- The End --