简体   繁体   English

访问远程 mongodb 服务器

[英]Access a remote mongodb server

I have a ubuntu remote machine which I access using ssh and I have installed mongodb on it, and I wish to access it remotely using the uri of the mongodb which is I have a ubuntu remote machine which I access using ssh and I have installed mongodb on it, and I wish to access it remotely using the uri of the mongodb which is

mongodb://<machine_ip_address>:27017/<database_name>

I have also tried to change the /etc/mongod.conf and the edited file is this:我也尝试更改 /etc/mongod.conf 和编辑的文件是这样的:

systemLog:
      destination: file
      path: "/var/log/mongodb/mongod.log"
      logAppend: true
  storage:
      journal:
          enabled: true
  processManagement:
      fork: true
  net:
      bindIp: 127.0.0.1,my_ip
      port: 27017
  setParameter:
      enableLocalhostAuthBypass: false

Is there a way I can give my local machine access to the remote server db by entering the uri of the remote server mongodb in my spring boot application?有没有办法通过在我的 spring 启动应用程序中输入远程服务器 mongodb 的 uri 来让我的本地计算机访问远程服务器数据库?

change your bindIp set bindIp to bindIp:0.0.0.0将您的 bindIp 设置 bindIp 更改为 bindIp:0.0.0.0

and also open your port on aws并在 aws 上打开您的端口

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM