In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The mongodb3.x version has many new features, which can be found on the official website.
Mongodb3.x configuration file uses yaml format, which is the same as salt and ansible format, .
Download the mongodb3.2 version
[root@mongo-test ~] # wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel62-3.2.3.tgz
Decompress mongodb and rename mongodb
[root@mongo-test] # tar fxz mongodb-linux-x86_64-rhel62-3.2.3.tgz [root@mongo-test ~] # ll mongodb-linux-x86_64-rhel62-3.2.3total 100drwxr-xr-x 2 root root 4096 Mar 5 15:10 bin-rw-r--r-- 1 root root 34520 Feb 18 03:42 GNU-AGPL-3.0-rw-r--r-- 1 root root 16726 Feb 18 03:42 MPL-2-rw-r-- Rmuri-1 root root 1359 Feb 18 03:42 README-rw-r--r-- 1 root root 35910 Feb 18 03:42 THIRD-PARTY-NOTICES [root@mongo-test] # mv mongodb-linux-x86_64-rhel62-3.2.3 / usr/local/mongodb
Mongodb environment variable configuration
Vim / etc/profileexport PATH=$PATH:/usr/local/mongodb/bin
Load environment profile
[root@mongo-test ~] # source / ect/profile
Create an mongodb data directory
[root@mongo-test ~] # mkdir / data [root@mongo-test ~] # mkdir / data/ {logs,mongo-data,config} / / logs store log directory, mongo-data store data, config store configuration file [root@mongo-test ~] # tree / data//data/ ├── config ├── logs └── mongo-data3 directories, 0 files
The mongod configuration file is as follows:
[root@mongo-test config] # cat mongod.conf systemLog: destination: file path: / data/logs/mongod.log logAppend: trueprocessManagement: fork: true pidFilePath: "/ data/mongo-data/mongod.pid" net: port: 27017 http: enabled: truestorage: dbPath: "/ data/mongo-data" engine: wiredTiger wiredTiger: engineConfig: cacheSizeGB: 1 directoryForIndexes: true collectionConfig: blockCompressor: zlib indexConfig: prefixCompression: true journal: Enabled: true directoryPerDB: truesecurity: authorization: disable
Note: now the configuration files of future versions of mongo3.x are all in yaml format. The official description of the options related to the mongo configuration file, https://docs.mongodb.org/manual/reference/configuration-options/#configuration-file
Start mongodb and view the mongod port
[root@mongo-test config] # mongod-f mongod.conf about to fork child process, waiting until server is ready for connections.forked process: 17222child process started successfully Parent exiting [root@mongo-test config] # netstat-ntpl | grep mongodtcp 0 0 0 netstat 28 017 0 0 0 LISTEN 17222/mongod tcp 0 0 0 7 0 0 0 of the latter 27 017 0 0 0 LISTEN 17222/mongod
Log in to the mongod instance, create a zxl, insert a data query into the test collection, etc.
[root@mongo-test config] # mongo--port 27017MongoDB shell version: 3.2.3connecting to: testWelcome to the MongoDB shell.For interactive help, type "help" .for more comprehensive documentation, see http://docs.mongodb.org/Questions? Try the support group http://groups.google.com/group/mongodb-userServer has startup warnings: 2016-03-05T22:40:23.212+0800 I CONTROL [initandlisten] * * WARNING: You are running this process as the root user Which is not recommended.2016-03-05T22:40:23.212+0800 I CONTROL [initandlisten] 2016-03-05T22:40:23.213+0800 I CONTROL [initandlisten] 2016-03-05T22:40:23.213+0800 I CONTROL [initandlisten] * * WARNING: / sys/kernel/mm/transparent_hugepage/enabled is' always'.2016-03-05T22:40:23.213+0800 I CONTROL [initandlisten] * * We suggest setting it to 'never'2016-03-05T22:40:23 .213 + 0800 I CONTROL [initandlisten] 2016-03-05T22:40:23.213+0800 I CONTROL [initandlisten] * * WARNING: / sys/kernel/mm/transparent_hugepage/defrag is' always'.2016-03-05T22:40:23.213+0800 I CONTROL [initandlisten] * * We suggest setting it to 'never'2016-03-05T22:40:23.213+0800 I CONTROL [initandlisten] > show dbs Local 0.000GB > use zxl;switched to db zxl > db.test.insert ({name: "", age:18}) WriteResult ({"nInserted": 1}) > db.test.find () {"_ id": ObjectId ("56daf1eacfaf29514f85d236"), "name": "", "age": 18}
In the mongod instance web interface, the port is added to the original mongod instance port 27017 plus 1000, that is, 28017. If you look at the mongod instance port above, you can find 28017.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.