mongodb 3.2.0.4安裝
下載地址
解壓
[root@trcloud-wujian-test02 disk]# tar -xf mongodb-linux-x86_64-3.2.4.tgz
[root@trcloud-wujian-test02 disk]# ls
lost+found mongodb-linux-x86_64-3.2.4 mongodb-linux-x86_64-3.2.4.tgz
將mongodb目錄名改成mongodb
[root@trcloud-wujian-test02 disk]# mv mongodb-linux-x86_64-3.2.4 mongodb
[root@trcloud-wujian-test02 disk]# ls
lost+found mongodb mongodb-linux-x86_64-3.2.4.tgz
[root@trcloud-wujian-test02 disk]# cd mongodb
建立資料目錄、日誌目錄和日誌檔案
[root@trcloud-wujian-test02 mongodb]# mkdir data
[root@trcloud-wujian-test02 mongodb]# mkdir log
[root@trcloud-wujian-test02 mongodb]# cd log/
[root@trcloud-wujian-test02 log]# touch mongodb.log
[root@trcloud-wujian-test02 log]# cd ../bin
啟動mongodb服務
[root@trcloud-wujian-test02 bin]# ./mongod --dbpath=/disk/mongodb/data/
2016-04-07T13:23:18.234+0800 I CONTROL [initandlisten] MongoDB starting : pid=20221 port=27017 dbpath=/disk/mongodb/data/ 64-bit host=trcloud-wujian-test02.novalocal
2016-04-07T13:23:18.234+0800 I CONTROL [initandlisten] db version v3.2.4
2016-04-07T13:23:18.234+0800 I CONTROL [initandlisten] git version: e2ee9ffcf9f5a94fad76802e28cc978718bb7a30
2016-04-07T13:23:18.234+0800 I CONTROL [initandlisten] allocator: tcmalloc
2016-04-07T13:23:18.234+0800 I CONTROL [initandlisten] modules: none
2016-04-07T13:23:18.234+0800 I CONTROL [initandlisten] build environment:
2016-04-07T13:23:18.234+0800 I CONTROL [initandlisten] distarch: x86_64
2016-04-07T13:23:18.234+0800 I CONTROL [initandlisten] target_arch: x86_64
2016-04-07T13:23:18.234+0800 I CONTROL [initandlisten] options: { storage: { dbPath: "/disk/mongodb/data/" } }
2016-04-07T13:23:18.257+0800 I - [initandlisten] Detected data files in /disk/mongodb/data/ created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2016-04-07T13:23:18.257+0800 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=1G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2016-04-07T13:23:20.954+0800 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2016-04-07T13:23:20.954+0800 I CONTROL [initandlisten]
2016-04-07T13:23:20.954+0800 I CONTROL [initandlisten]
2016-04-07T13:23:20.954+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2016-04-07T13:23:20.954+0800 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2016-04-07T13:23:20.954+0800 I CONTROL [initandlisten]
2016-04-07T13:23:20.954+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2016-04-07T13:23:20.954+0800 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2016-04-07T13:23:20.954+0800 I CONTROL [initandlisten]
2016-04-07T13:23:20.955+0800 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/disk/mongodb/data/diagnostic.data'
2016-04-07T13:23:20.955+0800 I NETWORK [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
2016-04-07T13:23:20.955+0800 I NETWORK [initandlisten] waiting for connections on port 27017
2016-04-07T13:23:20.978+0800 W NETWORK [HostnameCanonicalizationWorker] Failed to obtain address information for hostname trcloud-wujian-test02.novalocal: Name or service not known
^C2016-04-07T13:23:36.013+0800 I CONTROL [signalProcessingThread] got signal 2 (Interrupt), will terminate after current cmd ends
2016-04-07T13:23:36.013+0800 I FTDC [signalProcessingThread] Shutting down full-time diagnostic data capture
2016-04-07T13:23:36.015+0800 I CONTROL [signalProcessingThread] now exiting
2016-04-07T13:23:36.015+0800 I NETWORK [signalProcessingThread] shutdown: going to close listening sockets...
2016-04-07T13:23:36.015+0800 I NETWORK [signalProcessingThread] closing listening socket: 5
2016-04-07T13:23:36.015+0800 I NETWORK [signalProcessingThread] closing listening socket: 6
2016-04-07T13:23:36.015+0800 I NETWORK [signalProcessingThread] removing socket file: /tmp/mongodb-27017.sock
2016-04-07T13:23:36.015+0800 I NETWORK [signalProcessingThread] shutdown: going to flush diaglog...
2016-04-07T13:23:36.015+0800 I NETWORK [signalProcessingThread] shutdown: going to close sockets...
2016-04-07T13:23:36.015+0800 I STORAGE [signalProcessingThread] WiredTigerKVEngine shutting down
2016-04-07T13:23:36.146+0800 I STORAGE [signalProcessingThread] shutdown: removing fs lock...
2016-04-07T13:23:36.147+0800 I CONTROL [signalProcessingThread] dbexit: rc: 0
標紅處有3個警告和一處錯誤
錯誤是無法找到 trcloud-wujian-test02.novalocal主機
解決方法是在/etc/hosts檔案中加一條這個主機名的對映
127.0.0.1 trcloud-wujian-test02.novalocal
幾處警告的解決方法是
[root@trcloud-wujian-test02 bin]# echo "never" > /sys/kernel/mm/transparent_hugepage/enabled
[root@trcloud-wujian-test02 bin]# echo "never" > /sys/kernel/mm/transparent_hugepage/defrag
再次啟動服務
[root@trcloud-wujian-test02 bin]# ./mongod --dbpath=/disk/mongodb/data/
2016-04-07T13:24:42.989+0800 I CONTROL [initandlisten] MongoDB starting : pid=20260 port=27017 dbpath=/disk/mongodb/data/ 64-bit host=trcloud-wujian-test02.novalocal
2016-04-07T13:24:42.989+0800 I CONTROL [initandlisten] db version v3.2.4
2016-04-07T13:24:42.989+0800 I CONTROL [initandlisten] git version: e2ee9ffcf9f5a94fad76802e28cc978718bb7a30
2016-04-07T13:24:42.989+0800 I CONTROL [initandlisten] allocator: tcmalloc
2016-04-07T13:24:42.989+0800 I CONTROL [initandlisten] modules: none
2016-04-07T13:24:42.989+0800 I CONTROL [initandlisten] build environment:
2016-04-07T13:24:42.989+0800 I CONTROL [initandlisten] distarch: x86_64
2016-04-07T13:24:42.989+0800 I CONTROL [initandlisten] target_arch: x86_64
2016-04-07T13:24:42.989+0800 I CONTROL [initandlisten] options: { storage: { dbPath: "/disk/mongodb/data/" } }
2016-04-07T13:24:43.011+0800 E NETWORK [initandlisten] listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017
2016-04-07T13:24:43.011+0800 E NETWORK [initandlisten] addr already in use
2016-04-07T13:24:43.011+0800 E STORAGE [initandlisten] Failed to set up sockets during startup.
2016-04-07T13:24:43.011+0800 I CONTROL [initandlisten] dbexit: rc: 48
成功
設定mongodb日誌
[root@trcloud-wujian-test02 bin]# ./mongod --logpath=/disk/mongodb/log/mongodb.log
2016-04-07T13:40:45.695+0800 I CONTROL [main] log file "/disk/mongodb/log/mongodb.log" exists; moved to "/disk/mongodb/log/mongodb.log.2016-04-07T05-40-45".
進入互動介面
[root@trcloud-wujian-test02 bin]# ./mongo
MongoDB shell version: 3.2.4
connecting to: test
2016-04-07T13:27:48.214+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:35315 #2 (1 connection now open)
Server has startup warnings:
2016-04-07T13:24:18.194+0800 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2016-04-07T13:24:18.194+0800 I CONTROL [initandlisten]
>
將mongodb設定開機啟動
將 ./mongod ----dbpath=/disk/mongodb/data/ --logpath=/disk/mongodb/log/mongodb.log語句放入到/etc/rc.local檔案中
解壓
[root@trcloud-wujian-test02 disk]# tar -xf mongodb-linux-x86_64-3.2.4.tgz
[root@trcloud-wujian-test02 disk]# ls
lost+found mongodb-linux-x86_64-3.2.4 mongodb-linux-x86_64-3.2.4.tgz
將mongodb目錄名改成mongodb
[root@trcloud-wujian-test02 disk]# mv mongodb-linux-x86_64-3.2.4 mongodb
[root@trcloud-wujian-test02 disk]# ls
lost+found mongodb mongodb-linux-x86_64-3.2.4.tgz
[root@trcloud-wujian-test02 disk]# cd mongodb
建立資料目錄、日誌目錄和日誌檔案
[root@trcloud-wujian-test02 mongodb]# mkdir data
[root@trcloud-wujian-test02 mongodb]# mkdir log
[root@trcloud-wujian-test02 mongodb]# cd log/
[root@trcloud-wujian-test02 log]# touch mongodb.log
[root@trcloud-wujian-test02 log]# cd ../bin
啟動mongodb服務
[root@trcloud-wujian-test02 bin]# ./mongod --dbpath=/disk/mongodb/data/
2016-04-07T13:23:18.234+0800 I CONTROL [initandlisten] MongoDB starting : pid=20221 port=27017 dbpath=/disk/mongodb/data/ 64-bit host=trcloud-wujian-test02.novalocal
2016-04-07T13:23:18.234+0800 I CONTROL [initandlisten] db version v3.2.4
2016-04-07T13:23:18.234+0800 I CONTROL [initandlisten] git version: e2ee9ffcf9f5a94fad76802e28cc978718bb7a30
2016-04-07T13:23:18.234+0800 I CONTROL [initandlisten] allocator: tcmalloc
2016-04-07T13:23:18.234+0800 I CONTROL [initandlisten] modules: none
2016-04-07T13:23:18.234+0800 I CONTROL [initandlisten] build environment:
2016-04-07T13:23:18.234+0800 I CONTROL [initandlisten] distarch: x86_64
2016-04-07T13:23:18.234+0800 I CONTROL [initandlisten] target_arch: x86_64
2016-04-07T13:23:18.234+0800 I CONTROL [initandlisten] options: { storage: { dbPath: "/disk/mongodb/data/" } }
2016-04-07T13:23:18.257+0800 I - [initandlisten] Detected data files in /disk/mongodb/data/ created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2016-04-07T13:23:18.257+0800 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=1G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2016-04-07T13:23:20.954+0800 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2016-04-07T13:23:20.954+0800 I CONTROL [initandlisten]
2016-04-07T13:23:20.954+0800 I CONTROL [initandlisten]
2016-04-07T13:23:20.954+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2016-04-07T13:23:20.954+0800 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2016-04-07T13:23:20.954+0800 I CONTROL [initandlisten]
2016-04-07T13:23:20.954+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2016-04-07T13:23:20.954+0800 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2016-04-07T13:23:20.954+0800 I CONTROL [initandlisten]
2016-04-07T13:23:20.955+0800 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/disk/mongodb/data/diagnostic.data'
2016-04-07T13:23:20.955+0800 I NETWORK [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
2016-04-07T13:23:20.955+0800 I NETWORK [initandlisten] waiting for connections on port 27017
2016-04-07T13:23:20.978+0800 W NETWORK [HostnameCanonicalizationWorker] Failed to obtain address information for hostname trcloud-wujian-test02.novalocal: Name or service not known
^C2016-04-07T13:23:36.013+0800 I CONTROL [signalProcessingThread] got signal 2 (Interrupt), will terminate after current cmd ends
2016-04-07T13:23:36.013+0800 I FTDC [signalProcessingThread] Shutting down full-time diagnostic data capture
2016-04-07T13:23:36.015+0800 I CONTROL [signalProcessingThread] now exiting
2016-04-07T13:23:36.015+0800 I NETWORK [signalProcessingThread] shutdown: going to close listening sockets...
2016-04-07T13:23:36.015+0800 I NETWORK [signalProcessingThread] closing listening socket: 5
2016-04-07T13:23:36.015+0800 I NETWORK [signalProcessingThread] closing listening socket: 6
2016-04-07T13:23:36.015+0800 I NETWORK [signalProcessingThread] removing socket file: /tmp/mongodb-27017.sock
2016-04-07T13:23:36.015+0800 I NETWORK [signalProcessingThread] shutdown: going to flush diaglog...
2016-04-07T13:23:36.015+0800 I NETWORK [signalProcessingThread] shutdown: going to close sockets...
2016-04-07T13:23:36.015+0800 I STORAGE [signalProcessingThread] WiredTigerKVEngine shutting down
2016-04-07T13:23:36.146+0800 I STORAGE [signalProcessingThread] shutdown: removing fs lock...
2016-04-07T13:23:36.147+0800 I CONTROL [signalProcessingThread] dbexit: rc: 0
標紅處有3個警告和一處錯誤
錯誤是無法找到 trcloud-wujian-test02.novalocal主機
解決方法是在/etc/hosts檔案中加一條這個主機名的對映
127.0.0.1 trcloud-wujian-test02.novalocal
幾處警告的解決方法是
[root@trcloud-wujian-test02 bin]# echo "never" > /sys/kernel/mm/transparent_hugepage/enabled
[root@trcloud-wujian-test02 bin]# echo "never" > /sys/kernel/mm/transparent_hugepage/defrag
再次啟動服務
[root@trcloud-wujian-test02 bin]# ./mongod --dbpath=/disk/mongodb/data/
2016-04-07T13:24:42.989+0800 I CONTROL [initandlisten] MongoDB starting : pid=20260 port=27017 dbpath=/disk/mongodb/data/ 64-bit host=trcloud-wujian-test02.novalocal
2016-04-07T13:24:42.989+0800 I CONTROL [initandlisten] db version v3.2.4
2016-04-07T13:24:42.989+0800 I CONTROL [initandlisten] git version: e2ee9ffcf9f5a94fad76802e28cc978718bb7a30
2016-04-07T13:24:42.989+0800 I CONTROL [initandlisten] allocator: tcmalloc
2016-04-07T13:24:42.989+0800 I CONTROL [initandlisten] modules: none
2016-04-07T13:24:42.989+0800 I CONTROL [initandlisten] build environment:
2016-04-07T13:24:42.989+0800 I CONTROL [initandlisten] distarch: x86_64
2016-04-07T13:24:42.989+0800 I CONTROL [initandlisten] target_arch: x86_64
2016-04-07T13:24:42.989+0800 I CONTROL [initandlisten] options: { storage: { dbPath: "/disk/mongodb/data/" } }
2016-04-07T13:24:43.011+0800 E NETWORK [initandlisten] listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017
2016-04-07T13:24:43.011+0800 E NETWORK [initandlisten] addr already in use
2016-04-07T13:24:43.011+0800 E STORAGE [initandlisten] Failed to set up sockets during startup.
2016-04-07T13:24:43.011+0800 I CONTROL [initandlisten] dbexit: rc: 48
成功
設定mongodb日誌
[root@trcloud-wujian-test02 bin]# ./mongod --logpath=/disk/mongodb/log/mongodb.log
2016-04-07T13:40:45.695+0800 I CONTROL [main] log file "/disk/mongodb/log/mongodb.log" exists; moved to "/disk/mongodb/log/mongodb.log.2016-04-07T05-40-45".
進入互動介面
[root@trcloud-wujian-test02 bin]# ./mongo
MongoDB shell version: 3.2.4
connecting to: test
2016-04-07T13:27:48.214+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:35315 #2 (1 connection now open)
Server has startup warnings:
2016-04-07T13:24:18.194+0800 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2016-04-07T13:24:18.194+0800 I CONTROL [initandlisten]
>
將mongodb設定開機啟動
將 ./mongod ----dbpath=/disk/mongodb/data/ --logpath=/disk/mongodb/log/mongodb.log語句放入到/etc/rc.local檔案中
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29989552/viewspace-2076786/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 安裝mongodbMongoDB
- mongodb 安裝MongoDB
- MongoDB | Linux 安裝MongoDBLinux
- 【mongodb安裝配置】MongoDB
- MAC 安裝 MongoDBMacMongoDB
- MongoDB的安裝MongoDB
- Docker安裝mongodbDockerMongoDB
- Ubuntu安裝和解除安裝mongodbUbuntuMongoDB
- ubuntu透過安裝包安裝MongodbUbuntuMongoDB
- Windows下安裝MongoDBWindowsMongoDB
- Mac下安裝MongodbMacMongoDB
- MongoDB安裝配置教程MongoDB
- docker-安裝mongodbDockerMongoDB
- 【MongoDB】安裝與配置MongoDB
- linux上安裝mongodbLinuxMongoDB
- win10 mongodb安裝教程_win10 mongodb安裝步驟Win10MongoDB
- mongodb的安裝以及使用MongoDB
- MongoDB資料庫安裝MongoDB資料庫
- MongoDB下載與安裝MongoDB
- docker安裝mongoDB及使用DockerMongoDB
- Mac 安裝與配置mongodbMacMongoDB
- mac怎麼安裝mongodbMacMongoDB
- mongodb擴充套件安裝MongoDB套件
- CentOS7.7安裝mongodbCentOSMongoDB
- MongoDB日常運維-02安裝MongoDB運維
- 如何在 Ubuntu 上安裝 MongoDBUbuntuMongoDB
- CentOS7.2 安裝 MongoDB 3.4CentOSMongoDB
- windows安裝mongodb詳細教程WindowsMongoDB
- 快速掌握mongoDB(一)——mongoDB安裝部署和常用shell命令MongoDB
- mongodb macos 下的安裝和使用MongoDBMac
- Homestead 安裝 MongoDB 以及擴充套件!MongoDB套件
- 如何安裝MongoDB併成功啟動MongoDB
- mongodb的安裝和啟動方法MongoDB
- MongoDB基本介紹與安裝(1)MongoDB
- CentOS 7快速安裝Mongodb詳解CentOSMongoDB
- windows 下 MongoDB 的安裝與啟動WindowsMongoDB
- CentOS 7 安裝MongoDB詳細步驟CentOSMongoDB
- 如何使用m工具安裝和管理MongoDBMongoDB
- Linux – CentOS 7 yum方式快速安裝MongoDBLinuxCentOSMongoDB