spring boot mongodb ssh隧道
我已经使用AWS cloudplatform快速启动创建了mongodb安装程序,可在此处找到:。我可以从我的EC2实例成功地连接到我的,因此它已正确设置 因为我需要通过spring应用程序连接到它,所以我需要设置一个SSH隧道,通过EC2实例连接到mongodb节点 我能找到的唯一相关答案是使用mysql和某种需要模式参数的DataSource对象(我没有,数据库将充满不同种类的实体),因此我不确定如何继续 我的问题:spring boot mongodb ssh隧道,spring,mongodb,amazon-web-services,spring-boot,ssh-tunnel,Spring,Mongodb,Amazon Web Services,Spring Boot,Ssh Tunnel,我已经使用AWS cloudplatform快速启动创建了mongodb安装程序,可在此处找到:。我可以从我的EC2实例成功地连接到我的,因此它已正确设置 因为我需要通过spring应用程序连接到它,所以我需要设置一个SSH隧道,通过EC2实例连接到mongodb节点 我能找到的唯一相关答案是使用mysql和某种需要模式参数的DataSource对象(我没有,数据库将充满不同种类的实体),因此我不确定如何继续 我的问题: 如何设置SSH隧道?如何传入.pem密钥文件 连接到数据库时,我的appl
我在我的私有子网中设置了一个堡垒,并使用ssh隧道通过git bash访问我的MongoDb集群: ~/.ssh/config
Host bastion-host-mongo-forward
User ec2-user
Port 22
IdentityFile ~/admin.pem
HostName ec2-xx-xxx-xx-xxx.compute-1.amazonaws.com
Localforward 3307 ip-10-50-2-24.ec2.internal:27017
Localforward 3308 ip-10-50-3-143.ec2.internal:27017
Localforward 3309 ip-10-50-3-103.ec2.internal:27017
启动隧道:
ssh bastion-host-mongo-forward
之后,您可以设置application.yaml并以uri为目标:
spring:
profiles: local
data:
mongodb:
uri: mongodb://user:password@localhost:3307,localhost:3308,localhost:3309/databaseName
我在我的私有子网中设置了一个堡垒,并使用ssh隧道通过git bash访问我的MongoDb集群: ~/.ssh/config
Host bastion-host-mongo-forward
User ec2-user
Port 22
IdentityFile ~/admin.pem
HostName ec2-xx-xxx-xx-xxx.compute-1.amazonaws.com
Localforward 3307 ip-10-50-2-24.ec2.internal:27017
Localforward 3308 ip-10-50-3-143.ec2.internal:27017
Localforward 3309 ip-10-50-3-103.ec2.internal:27017
启动隧道:
ssh bastion-host-mongo-forward
之后,您可以设置application.yaml并以uri为目标:
spring:
profiles: local
data:
mongodb:
uri: mongodb://user:password@localhost:3307,localhost:3308,localhost:3309/databaseName