Connect to appsmith mongodb from remote client

i map the mongodb port to host,but i can not connect it from remote client and some error as following

caused by :: Connection refused

Hey! Can you please tell us the use case here? Are you using this mongoDB for your Application? or as a external DB for Appsmith?

i want to connect the appsmith backend mongodb,and may edit the user information

From the images shared above I cannot guess from where you got the IP

If all the port mapping is done correctly, the mongo should be available at localhost:27017, if I am not wrong.

i can connect only in appsmith container, and can not connect to it from the docker host and remote client

the docker host ip is

Can you please share the steps you took to get the IP?

Ha,i have a centos7 linux machine which ip is, and is installed docker-ce.
Then i pull the appsmith images from dockerhub ,and create the container as following:
docker run -d --name appsmith --privileged=true -p 8079:80 -p 27017:27017 -p9001:9001 -v /data/appsmith/stacks:/appsmith-stacks appsmith/appsmith-ce
And i want to connect the appsmith mongodb from docker host machine or remote mongo client.

So, if you are trying to connect to mongo DB from the docker host machine itself, you should actually use localhost. For it to work with a remote client you’ll have to allow outside connection to your machine and expose the port 27017

the host firewalld is off. i can only connect it use localhost only in docker container, both from docker host machine and remote can’t connect ,it’s amagic.

Hi @wengad,
From the discusion above, I understand that you have deployed Appsmith on the host with the embedded/internal MongoDB running in it successfully.
You wanted to connect to that MongoDB from a remote client, for which you port-mapped the container 27017 to the host.
This will still not expose the MongoDB because of IP binding to the localhost. We have done this for better security, as it is not recommended to access and modify the data from anywhere else other than the appsmith backend.
There is a way to remove the ip-binding and expose the internal MongoDB, but we will not be responsible for the after-effects.

  • Open a bash shell to the Appsmith container
    docker exec -it exec e2f8 bash
  • Edit /opt/appsmith/templates/supervisord/mongodb.conf , and remove --bind_ip localhost option from the mongod command .
  • Restart the container.

Hi @Sumesh,
Continuing this issue, that I want to modify user acl (if any) / info, restrict them to login.
The case is when invited user has been removed from the workspace, they still can login & create another workspace & so on…
Where I may have the same concept, self-hosted, but i just did remove the bind ip & docker has exposed the mongodb port to outside, but no go…
Is there any workaround for this?
Thank you

Hi Dan! Deleting a user directly from the database is not recommended, because it might lead to unexpected behavior due to data corruption.
Unfortunately, deleting a user, or banning a user from logging in, is not possible yet, but we have this feature request on our roadmap: [Feature] Delete / Block signed up accounts · Issue #6356 · appsmithorg/appsmith · GitHub
Please add a comment with your use case on GitHub to help us prioritize it.