We are building our environment with a replica set configuration with MongoDB.
The DB server, config server, is working properly.
Unable to connect to mongos server.
mThe mongos server is connected to the config server.
[root@mongos user] #mongo MongoDB shell version v3.4.7 connecting to:mongodb://127.0.0.1:27017 2017-08-29T07:50:01.514+0000W NETWORK [thread 1] Failed to connect to 127.0.0.1:27017, in (checking socket for error after poll), reason: Connection refused 2017-08-29 T07:50:01.514+0000 EQUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: connect@src/mongo/shell/mongo.js:237:13 @(connect): 1:6 exception:connect failed
The Mongos configuration file is as follows:
# mongod.conf # for documentation of all options, see: # # http://docs.mongodb.org/manual/reference/configuration-options/ # where to write logging data. systemLog: destination:file logAppend —true path: /var/log/mongodb/mongos.log # Where and how to store data. # storage: # dbPath: /var/lib/mongos # journal: # enabled —true # engine: # mmapv1: # wiredTiger: # How the process runs processManagement: fork —true# fork and run in background pidFilePath:/var/run/mongodb/mongos.pid #locationofpidfile # network interfaces net: port —27017 # bindIp —127.0.0.1 # Listen to local interface only, comment to listen on all interfaces. # security: # operationProfiling: # replication: sharding: configDB:rep/192.168.1.100:27019 ## Enterprise-Only Options #auditLog: # snmp:
I would appreciate it if anyone knows how to solve it.
Thank you for your cooperation.
Replica sets alone do not require mongos or config servers.The mongos and config servers are required for shadow clusters.
https://docs.mongodb.com/manual/core/sharded-cluster-config-servers/
Config servers store the metadata for a sharded cluster.
The connection state is
Failed to connect to 127.0.0.1:27017, in (checking socket for error after poll), reason: Connection refused
So I'm trying to connect to port 27017 of the same machine that I hit "mongo", but it's not connected.
Are you starting mongos on the same machine that you are typing mongo?
© 2024 OneMinuteCode. All rights reserved.