一、安装MongoDB
sudo apt-get install mongodb
二、配置MongoDB
sudo service mongodb stop
mongod --bind_ip_all
三、springboot + MongoDB配置
- pom.xml配置
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
- application.properties配置
spring.data.mongodb.uri=mongodb://10.6.3.148:27017/mydb