Lab: Deploy a Replica Set - problem - Unable to connect to mongo at all

Hi,
I am trying to do
Chapter 2: Replication

Lab: Deploy a Replica Set.

I am getting the following error. After completing all the replica setup i got this error. And I reset the workspace and I am just trying to connect to mongo before starting the lab. I am not able to connect, is the ip address or any other configuration do I need add or change?

Error:

Chapter 2: Replication

bash-4.4# mongo --port 27001
MongoDB shell version v4.0.5
connecting to: mongodb://127.0.0.1:27001/?gssapiServiceName=mongodb
2020-12-26T20:33:28.404+0000 E QUERY [js] Error: couldn’t connect to server 127.0.0.1:27001, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27001 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:328:13
@(connect):1:6
exception: connect failed
bash-4.4#

Thanks in Advance.

It is better if you post a screenshot of the whole IDE.

In this particular case, we are interested to see how you started your mongod processes.

You mean the mongod_1.conf info. This lab after [Reset Workspace] I just typed, and the current dir is as follows:
bash-4.4# pwd
/root/workspace
bash-4.4# mongo --port 27001.

For the reference I am pasting the content of mongod_1.conf
storage:
dbPath: /var/mongodb/db/1
net:
bindIp: localhost
port: 27001
security:
authorization: enabled
systemLog:
destination: file
path: /var/mongodb/logs/mongod1.log
logAppend: true
processManagement:
fork: true

– Thanks

Did you initialize the server?

mongod -f mongod_1.conf

But in any case, that’s not in replica set mode. So that needs to be added in the config.


Also, even if this works, it would be good (for you) to check the dbPath actually exist on the system, so you know where mongoDB stores data. And probably check out the log directory too, where you’ll find errors and a lot of good data.

1 Like

Let me try this. I did it before, anyhow let me try one by one again.
Thanks for the suggestion.

You configuration file is also missing:

  • authenticate internally using the keyfile /var/mongodb/pki/m103-keyfile

I did not configure yet for the replication.
I will try Santiago_Miranda suggestion after completing the configuraion.
Thanks,

Hi @Thazul_PM,

Let us know if you are still facing any issues.