Docker安装MongoDB

1. 拉取镜像
sudo docker pull mongo

2. 运行镜像
sudo docker run --name mongo -p 27017:27017 -v /srv/mongo/db:/data/db -v /srv/mongodb/backup:/data/backup -d mongo --auth

3. 进入mongo容器,
docker exec -it mongo mongo admin

4. 添加用户
db.createUser({ 
    user: "admin", 
    pwd: "123456", 
    roles: [ { role: "userAdminAnyDatabase", db: "admin" } ], 
    mechanisms : ["SCRAM-SHA-1"] 
});

Docker安装MongoDB

上一篇:WebSessionStore: Could not obtain reference to HttpContext


下一篇:jmeter深入3,采集数据库数据逐条发送请求