[root@cmodb801 etc]# service mongos start Redirecting to /bin/systemctl start mongos.service [root@cmodb801 etc]# [root@cmodb801 mongodb]# mongo MongoDB shell version v4.2.0 connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb Implicit session: session { "id" : UUID("363a5deb-abba-4bb2-82ab-1249d7283e20") } MongoDB server version: 4.2.0 Server has startup warnings: 2019-08-30T11:19:36.768+0000 I CONTROL [main] 2019-08-30T11:19:36.768+0000 I CONTROL [main] ** WARNING: Access control is not enabled for the database. 2019-08-30T11:19:36.768+0000 I CONTROL [main] ** Read and write access to data and configuration is unrestricted. 2019-08-30T11:19:36.768+0000 I CONTROL [main] mongos> sh.addShard("shard0003/cmodb812.togewa.com:27018,cmodb813.togewa.com:27018") { "shardAdded" : "shard0003", "ok" : 1, "operationTime" : Timestamp(1567163996, 2), "$clusterTime" : { "clusterTime" : Timestamp(1567163996, 2), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) } } } mongos> ^C bye [root@cmodb801 mongodb]# service mongos restart Redirecting to /bin/systemctl restart mongos.service [root@cmodb801 mongodb]# mongo MongoDB shell version v4.2.0 connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb 2019-08-30T11:20:10.650+0000 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt 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-08-30T11:20:10.653+0000 F - [main] exception: connect failed 2019-08-30T11:20:10.653+0000 E - [main] exiting with code 1 [root@cmodb801 mongodb]# ^C