Install the docker
To prepare for the go mongodb operation, install mongodb, after going through various exit codes, decide to use Docker to install mongodb, BTW Mongo also uses JS
Daocloud daoCloud install command
$ curl -sSL https://get.daocloud.io/docker | sh
Copy the code
Docker installation mongoddb
$ docker images
# View available versions
$ docker search mongo
# pull the official image of the latest version
$ docker pull mongo:latest
Copy the code
Run the mongo container
Map port 27017 of the container service to port 27017 of the host. External users can access mongo services directly from host IP :27017
$ docker run -itd --name mongo -p 27017:27017 mongo --auth
$ docker exec -it mongo mongo admin
Copy the code
Add a user and set a password, and try to connect. Ok, nice, running
Connect to Mongo remotely
- Configure ali cloud security group to open port 27017
- Remote connection using Robo 3T