MongoDB on Debian 10

I have installed Mongo on Debian 10, The system was / is stable but now I have some odd errors, I can’t connect remotely via ssh but then when I try again I can.

Currently I want all IP’s to be able to connect I have this set

# network interfaces

net:
port: 27017
bindIp: 0.0.0.0

security:
authorization: enabled

But mongod reports still bound to local host - if I make a typo in /etc/mongod.conf it borks the server so it is being read I believe.

Also the Debia specific directives to raise page limits etc are not transparent, I believe I have to make a service file and specify the soft limit as the process is identified by PID.
using systemd
Thanks.

## The server generated these startup warnings when booting:
2021-10-08T13:04:28.504+01:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
2021-10-08T13:04:28.504+01:00: You are running this process as the root user, which is not recommended
2021-10-08T13:04:28.504+01:00: This server is bound to localhost. Remote systems will be unable to connect to this server. Start the server with --bind_ip to specify which IP addresses it should serve responses from, or with --bind_ip_all to bind to all interfaces. If this behavior is desired, start the server with --bind_ip 127.0.0.1 to disable this warning
2021-10-08T13:04:28.505+01:00: /sys/kernel/mm/transparent_hugepage/enabled is ‘always’. We suggest setting it to ‘never’
2021-10-08T13:04:28.505+01:00: Soft rlimits for open file descriptors too low
2021-10-08T13:04:28.505+01:00: currentValue: 1024
2021-10-08T13:04:28.505+01:00: recommendedMinimum: 64000

Also the allow all Ip’s as you can see in /etc/mongod.conf I’ve set to o.o.o.o but it still thinks its bound to localhost.

By default mongod binds to local interface only and it will restrict remote connections
Comment out the bindip parameter if you want any remote connections to be accepted(not recommended)
Did you try bindIp: “127.0.0.1,0.0.0.0”
Using 0.0.0.0 is also not recommended

Also it appears you started mongod as root.You should not run mongod as root
Start it as normal user i think mongod is the owner

1 Like

I installed as root, how would I start as Mongod user ?
I did try bindIp: “127.0.0.1,0.0.0.0” but got a typo error which was not resolveable.
I will try commenting out totally.

Try bindip without quotes around two IP addresses

Did you install mongod as service?
If yes when you start service as sudo it will call mongod internally thru init scripts
If you are starting mongod manually do not use sudo mongod
Just use mongod --port --dbpath --logpath etc

hmmmm
so I can connect…
mongod is listening but systemctl shows this…
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2021-10-13 09:08:42 BST; 3min 13s ago

I assume it is not being started via systemctl ?

How do I check ?

also I need to raise limits for pages etc

if I type mongod on cli it starts so I need to enable systemctl or pm2

Yes you have to enable it for auto start
Check this link with update from Stennie on limit settings

You are able to connect because the mongod you started manually came up successfully on default port 27017
So when you issue mongo it will connect

I can’t find it in his posts

Check this.

MongoDB 4.4 and limits