Redhat 6.4 下安装MongoDB的步骤
折腾了一下午,终于在Redhat6.4下把MongoDB安装配置好了
--按照的官方教程按照到此结束,然后就是配置启动
[root@localhost bin]# ./mongod --dbpath /data/db/
./mongod: /usr/lib64/libssl.so.10: no version information available (required by ./mongod)
./mongod: /usr/lib64/libcrypto.so.10: no version information available (required by ./mongod)
./mongod: /usr/lib64/libcrypto.so.10: no version information available (required by ./mongod)
2015-09-02T07:32:19.166-0700 E NETWORK [initandlisten] listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017
2015-09-02T07:32:19.166-0700 E NETWORK [initandlisten] addr already in use
2015-09-02T07:32:19.167-0700 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /data/db/ not found., terminating
2015-09-02T07:32:19.167-0700 I CONTROL [initandlisten] dbexit: rc: 100
--这个问题是因为Openssl不是最新版, 我们查询当前安装的Openssl的版本信息
[root@localhost bin]# yum list openssl* | more
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use su
bscription-manager to register.
Installed Packages
openssl.x86_64 1.0.0-27.el6 @anaconda-RedHatEnterpriseLinux-201301301459.x86_64/
6.4
--由此可以看出这个是2013年的,不是最新。
--本来可以用yum下载安装,但是redhat要收费,所以去http://mirrors.163.com/centos/6/os/x86_64/Packages/下载最新版的openssl更新包
--下载好最新的.rpm包后,我们升级当前的openssl
[root@localhost bin]# rpm -Uvh /openssl-1.0.1e-42.el6.x86_64.rpm
warning: /openssl-1.0.1e-42.el6.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing... ########################################### [100%]
1:openssl ########################################### [100%]
--升级完成后,再次查看当前版本信息
[root@localhost bin]# yum info openssl
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Installed Packages
Name : openssl
Arch : x86_64
Version : 1.0.1e
Release : 42.el6
Size : 4.0 M
Repo : installed
Summary : A general purpose cryptography library with TLS implementation
URL : http://www.openssl.org/
License : OpenSSL
Description : The OpenSSL toolkit provides support for secure communications
: between machines. OpenSSL includes a certificate management tool
: and shared libraries which provide various cryptographic
: algorithms and protocols.
--已经升级好了,现在安装mongodb
[root@localhost bin]# mongod --dbpath /data/db
2015-09-02T08:15:44.446-0700 E NETWORK [initandlisten] listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017
2015-09-02T08:15:44.446-0700 E NETWORK [initandlisten] addr already in use
2015-09-02T08:15:44.447-0700 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating
2015-09-02T08:15:44.447-0700 I CONTROL [initandlisten] dbexit: rc: 100
[root@localhost bin]# mkdir /data/db
mkdir: cannot create directory `/data/db': No such file or directory
[root@localhost bin]# mkdir /data/db/
mkdir: cannot create directory `/data/db/': No such file or directory
[root@localhost bin]# mongod --dbpath /data/db
2015-09-02T08:16:49.032-0700 E NETWORK [initandlisten] listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017
2015-09-02T08:16:49.032-0700 E NETWORK [initandlisten] addr already in use
2015-09-02T08:16:49.070-0700 I JOURNAL [initandlisten] journal dir=/data/db/journal
2015-09-02T08:16:49.071-0700 I JOURNAL [initandlisten] recover : no journal files present, no recovery needed
2015-09-02T08:16:49.723-0700 I JOURNAL [initandlisten] preallocateIsFaster=true 6.72
2015-09-02T08:16:50.050-0700 I JOURNAL [initandlisten] preallocateIsFaster=true 5.06
2015-09-02T08:16:51.337-0700 I JOURNAL [initandlisten] preallocateIsFaster=true 3.58
2015-09-02T08:16:51.338-0700 I JOURNAL [initandlisten] preallocating a journal file /data/db/journal/prealloc.0
2015-09-02T08:16:54.177-0700 I - [initandlisten] File Preallocator Progress: 167772160/1073741824 15%
2015-09-02T08:16:57.283-0700 I - [initandlisten] File Preallocator Progress: 251658240/1073741824 23%
2015-09-02T08:17:01.303-0700 I - [initandlisten] File Preallocator Progress: 325058560/1073741824 30%
2015-09-02T08:17:07.380-0700 I - [initandlisten] File Preallocator Progress: 440401920/1073741824 41%
2015-09-02T08:17:10.132-0700 I - [initandlisten] File Preallocator Progress: 461373440/1073741824 42%
2015-09-02T08:17:13.412-0700 I - [initandlisten] File Preallocator Progress: 503316480/1073741824 46%
2015-09-02T08:17:16.187-0700 I - [initandlisten] File Preallocator Progress: 629145600/1073741824 58%
2015-09-02T08:17:19.047-0700 I - [initandlisten] File Preallocator Progress: 775946240/1073741824 72%
2015-09-02T08:17:22.589-0700 I - [initandlisten] File Preallocator Progress: 838860800/1073741824 78%
2015-09-02T08:17:25.129-0700 I - [initandlisten] File Preallocator Progress: 954204160/1073741824 88%
2015-09-02T08:17:28.432-0700 I - [initandlisten] File Preallocator Progress: 985661440/1073741824 91%
2015-09-02T08:17:32.353-0700 I - [initandlisten] File Preallocator Progress: 1038090240/1073741824 96%
2015-09-02T08:17:34.989-0700 I JOURNAL [initandlisten] preallocating a journal file /data/db/journal/prealloc.1
2015-09-02T08:17:37.181-0700 I - [initandlisten] File Preallocator Progress: 178257920/1073741824 16%
2015-09-02T08:17:40.401-0700 I - [initandlisten] File Preallocator Progress: 325058560/1073741824 30%
2015-09-02T08:17:43.362-0700 I - [initandlisten] File Preallocator Progress: 492830720/1073741824 45%
2015-09-02T08:17:46.032-0700 I - [initandlisten] File Preallocator Progress: 576716800/1073741824 53%
2015-09-02T08:17:49.079-0700 I - [initandlisten] File Preallocator Progress: 660602880/1073741824 61%
2015-09-02T08:17:52.007-0700 I - [initandlisten] File Preallocator Progress: 692060160/1073741824 64%
2015-09-02T08:17:55.084-0700 I - [initandlisten] File Preallocator Progress: 901775360/1073741824 83%
2015-09-02T08:17:58.247-0700 I - [initandlisten] File Preallocator Progress: 1006632960/1073741824 93%
2015-09-02T08:18:01.130-0700 I - [initandlisten] File Preallocator Progress: 1017118720/1073741824 94%
2015-09-02T08:18:04.146-0700 I - [initandlisten] File Preallocator Progress: 1059061760/1073741824 98%
2015-09-02T08:18:05.074-0700 I JOURNAL [initandlisten] preallocating a journal file /data/db/journal/prealloc.2
2015-09-02T08:18:08.701-0700 I - [initandlisten] File Preallocator Progress: 136314880/1073741824 12%
2015-09-02T08:18:11.016-0700 I - [initandlisten] File Preallocator Progress: 199229440/1073741824 18%
2015-09-02T08:18:14.259-0700 I - [initandlisten] File Preallocator Progress: 796917760/1073741824 74%
2015-09-02T08:18:17.788-0700 I - [initandlisten] File Preallocator Progress: 859832320/1073741824 80%
2015-09-02T08:18:21.135-0700 I - [initandlisten] File Preallocator Progress: 996147200/1073741824 92%
2015-09-02T08:18:30.296-0700 I JOURNAL [durability] Durability thread started
2015-09-02T08:18:30.296-0700 I JOURNAL [journal writer] Journal writer thread started
2015-09-02T08:18:30.306-0700 I CONTROL [initandlisten] MongoDB starting : pid=3590 port=27017 dbpath=/data/db 64-bit host=localhost.localdomain
2015-09-02T08:18:30.306-0700 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2015-09-02T08:18:30.306-0700 I CONTROL [initandlisten]
2015-09-02T08:18:30.318-0700 I CONTROL [initandlisten]
2015-09-02T08:18:30.318-0700 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2015-09-02T08:18:30.318-0700 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2015-09-02T08:18:30.318-0700 I CONTROL [initandlisten]
2015-09-02T08:18:30.318-0700 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2015-09-02T08:18:30.318-0700 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2015-09-02T08:18:30.318-0700 I CONTROL [initandlisten]
2015-09-02T08:18:30.318-0700 I CONTROL [initandlisten] db version v3.0.6
2015-09-02T08:18:30.319-0700 I CONTROL [initandlisten] git version: 1ef45a23a4c5e3480ac919b28afcba3c615488f2
2015-09-02T08:18:30.319-0700 I CONTROL [initandlisten] build info: Linux ip-10-67-194-123 2.6.32-220.el6.x86_64 #1 SMP Wed Nov 9 08:03:13 EST 2011 x86_64 BOOST_LIB_VERSION=1_49
2015-09-02T08:18:30.319-0700 I CONTROL [initandlisten] allocator: tcmalloc
2015-09-02T08:18:30.319-0700 I CONTROL [initandlisten] options: { storage: { dbPath: "/data/db" } }
2015-09-02T08:18:30.332-0700 I INDEX [initandlisten] allocating new ns file /data/db/local.ns, filling with zeroes...
2015-09-02T08:18:30.649-0700 I STORAGE [FileAllocator] allocating new datafile /data/db/local.0, filling with zeroes...
2015-09-02T08:18:30.649-0700 I STORAGE [FileAllocator] creating directory /data/db/_tmp
2015-09-02T08:18:30.675-0700 I STORAGE [FileAllocator] done allocating datafile /data/db/local.0, size: 64MB, took 0.001 secs
2015-09-02T08:18:30.803-0700 I CONTROL [initandlisten] now exiting
2015-09-02T08:18:30.803-0700 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2015-09-02T08:18:30.813-0700 I NETWORK [initandlisten] shutdown: going to flush diaglog...
2015-09-02T08:18:30.813-0700 I NETWORK [initandlisten] shutdown: going to close sockets...
2015-09-02T08:18:30.814-0700 I STORAGE [initandlisten] shutdown: waiting for fs preallocator...
2015-09-02T08:18:30.814-0700 I STORAGE [initandlisten] shutdown: final commit...
2015-09-02T08:18:30.841-0700 I JOURNAL [initandlisten] journalCleanup...
2015-09-02T08:18:30.841-0700 I JOURNAL [initandlisten] removeJournalFiles
2015-09-02T08:18:30.866-0700 I JOURNAL [initandlisten] Terminating durability thread ...
2015-09-02T08:18:30.920-0700 I JOURNAL [journal writer] Journal writer thread stopped
2015-09-02T08:18:30.923-0700 I JOURNAL [durability] Durability thread stopped
2015-09-02T08:18:30.923-0700 I STORAGE [initandlisten] shutdown: closing all files...
2015-09-02T08:18:30.927-0700 I STORAGE [initandlisten] closeAllFiles() finished
2015-09-02T08:18:30.927-0700 I STORAGE [initandlisten] shutdown: removing fs lock...
2015-09-02T08:18:30.928-0700 I CONTROL [initandlisten] dbexit: rc: 48
--连接MongoDB
[root@localhost bin]# ./mongo
MongoDB shell version: 3.0.6
connecting to: test
Welcome 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-user
Server has startup warnings:
2015-09-02T07:20:30.024-0700 I CONTROL [initandlisten]
2015-09-02T07:20:30.024-0700 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2015-09-02T07:20:30.024-0700 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2015-09-02T07:20:30.024-0700 I CONTROL [initandlisten]
2015-09-02T07:20:30.025-0700 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2015-09-02T07:20:30.025-0700 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2015-09-02T07:20:30.025-0700 I CONTROL [initandlisten]
2015-09-02T07:20:30.025-0700 I CONTROL [initandlisten] ** WARNING: soft rlimits too low. rlimits set to 1024 processes, 64000 files. Number of processes should be at least 32000 : 0.5 times number of files.
2015-09-02T07:20:30.025-0700 I CONTROL [initandlisten]
--连接成功,开始插入数据
> db.person.insert({"name":"benjamin","age":33})
WriteResult({ "nInserted" : 1 })
> db.person.insert({"name":"jackie","age":33})
WriteResult({ "nInserted" : 1 })
> db.person.insert({"name":"howard","age":30})
WriteResult({ "nInserted" : 1 })
> db.person.insert({"name":"carl","age":23})
WriteResult({ "nInserted" : 1 })
--查询所有数据
> db.person.find()
{ "_id" : ObjectId("55e71a4e9966bd0a99495eca"), "name" : "benjamin", "age" : 33 }
{ "_id" : ObjectId("55e71a629966bd0a99495ecb"), "name" : "jackie", "age" : 33 }
{ "_id" : ObjectId("55e71a6e9966bd0a99495ecc"), "name" : "howard", "age" : 30 }
{ "_id" : ObjectId("55e71a809966bd0a99495ecd"), "name" : "carl", "age" : 23 }
--退出
> exit
bye
[root@localhost bin]#
版权声明:本站【趣百科】文章素材来源于网络或者用户投稿,未经许可不得用于商用,如转载保留本文链接:https://www.qubaik.com/answer/139644.html