Reputation: 589
I am using mongodb 4.2 version. I am trying to make replicaset following this article but when I try to bind like in this screenshot
mongo service fails to restart and show errors like:
any ways to fix this? have tried all the Q&A about mongo from stackoverflow
Upvotes: 3
Views: 1423
Reputation: 41
edit: My answer only addresses the problem of a failing mongodb service after system reboot. If your service is failing after a service restart on a running system you have a different problem.
The problem is that at the time of mongodb service start the IP address is not yet available.
To fix this you can set up a systmed service overwrite rule:
sudo mkdir -p /etc/systemd/system/mongodb.service.d
sudo vim /etc/systemd/system/mongodb.service.d/ip_bind.conf
Add the following lines
[Unit]
After=network-online.target
This will overwrite the default rule After=network.target
. On my system (Ubuntu 20.04) the default mongodb service configuration is located in /usr/lib/systemd/system/mongodb.service
.
Upvotes: 1
Reputation: 1720
First of all, as bindIp
parameter accepts string, the syntax of your value looks fine.
You can get the complete output of your service using journalctl
command, you can use the following command,
journalctl -xe -u mongod.service
The logs there, will show you the complete error logs.
You can also check the logs of mongod process
which is configured in your configuration file under systemLog.path
.
You should be using the only IP Addresses at which the mongod will be listening
, so you can check your IP addresses once again.
Below is my configuration file,
net:
bindIp: 127.0.0.1,192.168.100.101
port: 27018
It works just fine.
Upvotes: 0
Reputation: 101
Try this :- bindIp: 127.0.0.1;192.168.1.178;192.168.1.111 replace comma(,) to semicolon(;)
Upvotes: 3