[admin@cmodb801 ~]$ mongo MongoDB shell version v4.2.0 connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb Implicit session: session { "id" : UUID("56809a6a-503d-4661-a60c-dd8461c2dc86") } MongoDB server version: 4.2.0 Server has startup warnings: 2019-09-04T06:33:47.184+0000 I CONTROL [main] 2019-09-04T06:33:47.184+0000 I CONTROL [main] ** WARNING: Access control is not enabled for the database. 2019-09-04T06:33:47.184+0000 I CONTROL [main] ** Read and write access to data and configuration is un restricted. 2019-09-04T06:33:47.184+0000 I CONTROL [main] mongos> sh.status() --- Sharding Status --- sharding version: { "_id" : 1, "minCompatibleVersion" : 5, "currentVersion" : 6, "clusterId" : ObjectId("5d5e45a7ac9313827bdd8ab9") } shards: { "_id" : "shard0000", "host" : "shard0000/cmodb806.togewa.com:27018,cmodb807.togewa.com:27018", "stat e" : 1 } { "_id" : "shard0001", "host" : "shard0001/cmodb808.togewa.com:27018,cmodb809.togewa.com:27018", "stat e" : 1 } { "_id" : "shard0002", "host" : "shard0002/cmodb810.togewa.com:27018,cmodb811.togewa.com:27018", "stat e" : 1 } active mongoses: "4.2.0" : 1 autosplit: Currently enabled: yes balancer: Currently enabled: yes Currently running: no Failed balancer rounds in last 5 attempts: 0 Migration Results for the last 24 hours: No recent migrations databases: { "_id" : "config", "primary" : "config", "partitioned" : true } config.system.sessions shard key: { "_id" : 1 } unique: false balancing: true chunks: shard0000 1 { "_id" : { "$minKey" : 1 } } -->> { "_id" : { "$maxKey" : 1 } } on : shard0000 Timestamp (1, 0) mongos> sh.addShard("shard0003/cmodb812.togewa.com:27018,cmodb813.togewa.com:27018") { "shardAdded" : "shard0003", "ok" : 1, "operationTime" : Timestamp(1567578860, 2), "$clusterTime" : { "clusterTime" : Timestamp(1567578860, 2), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) } } } mongos> sh.status() --- Sharding Status --- sharding version: { "_id" : 1, "minCompatibleVersion" : 5, "currentVersion" : 6, "clusterId" : ObjectId("5d5e45a7ac9313827bdd8ab9") } shards: { "_id" : "shard0000", "host" : "shard0000/cmodb806.togewa.com:27018,cmodb807.togewa.com:27018", "stat e" : 1 } { "_id" : "shard0001", "host" : "shard0001/cmodb808.togewa.com:27018,cmodb809.togewa.com:27018", "stat e" : 1 } { "_id" : "shard0002", "host" : "shard0002/cmodb810.togewa.com:27018,cmodb811.togewa.com:27018", "stat e" : 1 } { "_id" : "shard0003", "host" : "shard0003/cmodb812.togewa.com:27018,cmodb813.togewa.com:27018", "stat e" : 1 } active mongoses: "4.2.0" : 1 autosplit: Currently enabled: yes balancer: Currently enabled: yes Currently running: no Failed balancer rounds in last 5 attempts: 0 Migration Results for the last 24 hours: No recent migrations databases: { "_id" : "config", "primary" : "config", "partitioned" : true } config.system.sessions shard key: { "_id" : 1 } unique: false balancing: true chunks: shard0000 1 { "_id" : { "$minKey" : 1 } } -->> { "_id" : { "$maxKey" : 1 } } on : shard0000 Timestamp (1, 0) mongos> ^C bye [root@cmodb801 ~]# service mongos restart Redirecting to /bin/systemctl restart mongos.service [root@cmodb801 ~]# service mongos status Redirecting to /bin/systemctl status mongos.service ? mongos.service - High-performance, schema-free document-oriented database Loaded: loaded (/usr/lib/systemd/system/mongos.service; enabled; vendor preset: disabled) Active: active (running) since Wed 2019-09-04 06:34:50 UTC; 5s ago Docs: https://docs.mongodb.org/manual Process: 18839 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS) Process: 18836 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS) Process: 18835 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS) Main PID: 18841 (mongos) CGroup: /system.slice/mongos.service +-18841 /usr/bin/mongos -f /etc/mongos.conf +-18845 /usr/bin/mongos -f /etc/mongos.conf +-18846 /usr/bin/mongos -f /etc/mongos.conf Sep 04 06:34:50 cmodb801.togewa.com systemd[1]: Starting High-performance, schema-free document-oriented d...e... Sep 04 06:34:50 cmodb801.togewa.com systemd[1]: Started High-performance, schema-free document-oriented database. Sep 04 06:34:50 cmodb801.togewa.com mongos[18841]: about to fork child process, waiting until server is re...ons. Sep 04 06:34:50 cmodb801.togewa.com mongos[18841]: forked process: 18846 Hint: Some lines were ellipsized, use -l to show in full. [root@cmodb801 ~]# mongo MongoDB shell version v4.2.0 connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb 2019-09-04T06:35:00.273+0000 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attem pt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused : connect@src/mongo/shell/mongo.js:341:17 @(connect):2:6 2019-09-04T06:35:00.274+0000 F - [main] exception: connect failed 2019-09-04T06:35:00.274+0000 E - [main] exiting with code 1 [root@cmodb801 ~]# mongo --port 27017 MongoDB shell version v4.2.0 connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb 2019-09-04T06:36:02.152+0000 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attem pt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused : connect@src/mongo/shell/mongo.js:341:17 @(connect):2:6 2019-09-04T06:36:02.153+0000 F - [main] exception: connect failed 2019-09-04T06:36:02.154+0000 E - [main] exiting with code 1 [root@cmodb801 ~]# mongo --port 27017 --host localhost MongoDB shell version v4.2.0 connecting to: mongodb://localhost:27017/?compressors=disabled&gssapiServiceName=mongodb 2019-09-04T06:36:07.895+0000 E QUERY [js] Error: couldn't connect to server localhost:27017, connection attem pt failed: SocketException: Error connecting to localhost:27017 (127.0.0.1:27017) :: caused by :: Connection refu sed : connect@src/mongo/shell/mongo.js:341:17 @(connect):2:6 2019-09-04T06:36:07.896+0000 F - [main] exception: connect failed 2019-09-04T06:36:07.896+0000 E - [main] exiting with code 1 [root@cmodb801 ~]# service mongos stop Redirecting to /bin/systemctl stop mongos.service