mongodb (installation and configuration)

mongodb (installation and configuration)

Linux system installation
Upload the installation package, after decompression, modify the configuration file ${MONGO_HOME}/mongo.conf(create the configuration file)

systemLog:
   destination: file
   # 日志文件全路径
   path: "/opt/mongodb/log/mongod.log"
   logAppend: true
storage:
	# 数据存放目录
   dbPath: "/opt/mongodb/data/db"
   journal:
      enabled: true
processManagement:
   fork: true
# 指定IP和端口
net:
   bindIp: localhost,192.168.226.10
   port: 27017

After the configuration file is modified, if the specified data storage directory and log file directory do not exist, you need to manually create the following

Then you can start the mongodb service:, the ${MONGO_HOME}/bin/mongod -config <conf>configuration path is specified to the configuration file we just created

mongodbThe service cannot jpsview the process through the command, use the pscommand to view the process number:

Insert picture description here


you can see the process, indicating that the service started successfully

After the service is started, you can start the client, execute the ${MONGO_HOME}/bin/mongocommand, enter the client, enter the show dbs;command, you can see the database information:

Insert picture description here


here, mongodbthe installation is successful on the Linux platform

After the visualization tool mongodb-compress
installation package is decompressed, find the MongoDBCompass.exestartup under the decompression directory :

After the component is loaded:

Insert picture description here


enter the host name or IP and click to connect: the

Insert picture description here


connection is successful:

Insert picture description here


if you open the mongoDB Compass, ACTIVATING PLUGINS always appears, and the loading cannot be completed:

Solution: C:\Windows\System32\wbemAdd to the path of the environment variable and restart

Windows
Windows installation only needs to decompress the installation package of the corresponding version to the specified location, and then create the corresponding data storage directory.

Service startup method: mongod.exe --dbpath=.\data\db

Insert picture description here


after successful startup, it will enter the blocking page

Use a visualization tool to connect to mongodb on windows:

Insert picture description here