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

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?


Chapter 2: Replication

bash-4.4# mongo --port 27001
MongoDB shell version v4.0.5
connecting to: mongodb://
2020-12-26T20:33:28.404+0000 E QUERY [js] Error: couldn’t connect to server, connection attempt failed: SocketException: Error connecting to :: caused by :: Connection refused :
exception: connect failed

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
bash-4.4# mongo --port 27001.

For the reference I am pasting the content of mongod_1.conf
dbPath: /var/mongodb/db/1
bindIp: localhost
port: 27001
authorization: enabled
destination: file
path: /var/mongodb/logs/mongod1.log
logAppend: true
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.

Hi @Thazul_PM,

Let us know if you are still facing any issues.