mongodb installation and visualization tool MongoDBCompass


mongodb 安装

[[email protected] software]# tar -zxf mongodb-linux-x86_64-rhel70-4.0.24.tgz
[[email protected] software]# mv mongodb-linux-x86_64-rhel70-4.0.24 mogodb
[[email protected] software]# cd mongodb

新建数据库目录: /root/software/mongodb/data/db
新建数据库日志:/root/software/mongodb/log
[[email protected] mongodb]# mkdir -p ./data/db
[[email protected] mongodb]# mkdir -p ./log


[[email protected] mongodb]# vi ./mongo.conf

systemLog:
   destination: file
   path: "/root/software/mongodb/log/mongod.log"
   logAppend: true
storage:
   dbPath: "/root/software/mongodb/data/db"
   journal:
      enabled: true
processManagement:
   fork: true
net:
   bindIp: localhost,192.168.107.103
   port: 27017


// 启动mongo
[[email protected] mongodb]# ./bin/mongod -config ./mongo.conf

//查看mongo服务是否起  不是用jps
[[email protected] mongodb]# ps -ef | grep mongo

//进入到shell 
[[email protected] mongodb]# ./bin/mongo

> show dbs;
admin   0.000GB
config  0.000GB
local   0.000GB
> use kb11            //新建库
switched to db kb11
> show dbs;
admin   0.000GB
config  0.000GB
local   0.000GB
> db.createCollection("students")   //新建表  之后才能看到库
{ "ok" : 1 }
> show dbs
admin   0.000GB
config  0.000GB
kb11    0.000GB
local   0.000GB


Unzip MongoDBCompass.exe and
click Connect in the upper left corner. The following window will appear.
Click Fill in connection fields individually

Insert picture description here


Enter the address and connect

Insert picture description here


as shown below

Insert picture description here

//---------------Start mongoDB under windows----------------------

Go to the file directory as shown in the figure, the bin directory after mongo decompression

Insert picture description here


Enter cmd to jump directly to the cdm window and the directory level is the current

Insert picture description here


Insert picture description here


input. \bin\mongo.exe
did not succeed.

Insert picture description here


Start the mongodb of windows according to the linux startup mongdb logic

Create a new data\db
at the same level as bin Create a log at the same level as bin Create a
new mongo.conf
conf content:

systemLog:
   destination: file
   path: D:\Softs\mogodb\mongo—windows\mongodb\log
   logAppend: true
storage:
   dbPath: D:\Softs\mogodb\mongo—windows\mongodb\data\db
   journal:
      enabled: true
#processManagement:
#   fork: true
net:
   bindIp: localhost,192.168.107.1
   port: 27017

Close the windows firewall cmd window and enter the command
.\bin\mongod --config .\mongo.conf\

//------------------------------------------------ ------

Connect to linux mongodb
.\bin\mongo --host=192.168.107.103 --port=27017

Insert picture description here