Deploy the database based on docker
sudo docker pull influxdb sudo docker pull mongo sudo docker run -p 27017:27017 -v xxx:/xxx—name xxxx -d mongo:latest sudo docker run -d -p8086:8086 —name xxx influxdb:latest
Initialize the mongodb database
Enter the mongo image to configure the user password
mongo 127.0.0.1
use admin;
db.createUser({user: "xxx", pwd: "xxx", roles: [{ role: "root", db: "admin" }]});
db.getUser("xxx")
Import data
Enter mongo container:
mongoimport -d aaa -c xxx.json
Check the import results:
mongo 127.0.0.1
show databases;
use aaa;
db.xxx.find();
Create the bbb database
use bbb
db
db.keynes_record.insert({"name":"test"})
show databases;
Initialize influxdb
Enter docker container:
influx
CREATE DATABASE keynes
SHOW DATABASES
conclusion
The above is this site to introduce the use of docker deployment influxdb and mongo common commands, I hope to help you, if you have any questions welcome to give me a message, this site will reply to you in time!