[Python reptile] MongoDB Installation & Configuration

A, mongo configuration

  1, the new folder
    C: \ MongoDB \ Server \ 3.4 \ the Data \ db
    C: \ MongoDB \ Server \ 3.4 \ the Data \ logs
  2, configure the environment variables
    C: \ MongoDB \ Server \ 3.4 \ bin configured into the path system environment variables in.
  3, to test whether the configuration is successful
    the mongod --dbpath C: \ MongoDB \ Server \ 3.4 \ the Data \ db
  4, configure the service
    mongod --dbpath C: \ MongoDB \ Server \ 3.4 \ data \ db --logpath C: \ MongoDB \ Server \ 3.4 \ data \ logs \ mongo.log --logappend --port 27017 --serviceName "MongoDB" --install

Second, the client and server command

  Turning on the server using the server command, turn on the server can store data, search data.
  Client server connection, do crud operations.

  Server command: mongod
        path --dbpath --- database for storing data files
        --port port, bind future server on this port.
  Client command: mongo
        --port port number: Specify which port the server connection.

  Task: Turn on two servers in a mongo cmd, the port 27018,27019, they were connected with the client.
      --host --- "- h
  open 27018, open a cmd input:
    the mongod --dbpath C: \ MongoDB \ Server \ 3.4 \ the Data \ db --port 27018
  open 27019, reopen cmd, enter:
    New db folder : C: \ MongoDB \ Server \ 3.4 \ the Data \ the DB2
    the mongod --dbpath C: \ MongoDB \ Server \ 3.4 \ the Data \ the DB2 --port 27019

  open client
    connections 27018:
      mongo --port 27018
    connection 27019:
      mongo - port 27019

Guess you like

Origin www.cnblogs.com/Tree0108/p/12093445.html