[ root@xxxx local]# curl -o mongodb-linux-x86_64-3.4.6.tgz https://fas tdl.mongodb.org/linux/mongodb-linux-x86_64-3.4.6.tgz
Here is the installation process
Use the command: curl
In Linux, curl is a file transfer tool that uses URL rules to work on the command line. It can be said to be a very powerful http command line tool. It supports file uploading and downloading and is a comprehensive transmission tool, but according to tradition, it is customary to call url a download tool.
Common parameters
- A/--user-agent <string>Set the user agent to send to the server
- b/--cookie <name=string/file>Cookie string or file reading position
- c/--cookie-jar <file>Write the cookie to this file after the operation is over
- C/--continue-at <offset>Breakpoint resume
- D/--dump-header <file>Write the header information to the file
- e/--referer source URL
- f/--fail do not display http error when connection fails
- o/--output write the output to the file
- O/--remote-name write the output to the file, keep the file name of the remote file
- r/--range <range>Retrieved from HTTP/1.1 or FTP server byte range
- s/--silent Silent mode. Output nothing
- T/--upload-file <file>upload files
- u/--user <user[:password]>Set the user and password of the server
- w/--write-out [format]What output is complete
- x/--proxy <host[:port]>Use HTTP proxy on the given port
- # /--progress-bar The progress bar shows the current transfer status
The following is the installed interface
Next, we decompress.
Since I have reached the current path, I just need to perform decompression
# tar zxvf mongodb-linux-x86_64-3.4.6.tgz
If you do not enter the path, just specify it
# tar zxvf mongodb-linux-x86_64-3.4.6.tgz -C /usr/local
The attention referred to here is a permission issue.
Below is a screenshot of the operation.
Next from the named file: mv mongodb-linux-x86_64-3.4.6 mongodb
[ root@localhost local]# cd mongodb
[ root@localhost mongodb]# mkdir data/log && mkdir data/db
vi /etc/profile
export MONGODB_HOME=/usr/local/mongodb
export PATH=$PATH:$MONGODB_HOME/bin
After saving, restart the system configuration
source /etc/profile
Create a file mongodb.conf under /usr/local/mongodb/bin with the following content:
systemLog:
destination: file
path:"/usr/local/mongodb/data/log/mongodb.log"
logAppend:true
storage:
journal:
enabled:true
dbPath:"/usr/local/mongodb/data/db"
directoryPerDB:false
engine: wiredTiger
wiredTiger:
engineConfig:
cacheSizeGB:4
directoryForIndexes:false
journalCompressor: zlib
collectionConfig:
blockCompressor: zlib
indexConfig:
prefixCompression:true
net:
port:27017
processManagement:
fork:true
security:
authorization: disabled
fork = true
logappend = true
Under /usr/local/mongodb/bin
mongod -f /usr/local/mongodb/bin/mongodb.conf
[ root@localhost mongodb]# lsof -i :27017
(In the mongodb 27017, the first 7 plus 1, that is 28017 is the HTTP service port)
http://IP:28017
[ root@localhost mongodb]# bin/mongo
MongoDB shell version v3.4.6
connecting to: mongodb://127.0.0.1:27017
MongoDB server version:3.4.6
1 ,Address already in use linux
Reason: Port occupied
Solution: ps command, check the occupied program, kill it
2 ,LoaderExceptions
Reason: In the configuration file, a space is missing after the colon
Solution: Go to the configuration file, modify it, and restart the service.
3 , Unable to lock the lock file: /var/lib/mongo/mongod.lock
Reason: The file is locked and cannot be copied
Solution: Just delete it directly
4. Under centos, the command lsof cannot be used, and the following message appears:
Solution
We can install it through yum:
# yum install lsof
Recommended Posts