logo

MongoDB 3.0版本安装介质 MongoDB 3.0版本安装包比以前更细化,有的朋友可能不太了解区别,简单说明一下: Linux 64-bit legacy 这个版本即mongodb-linux-x86_64-3.0.0.tgz 不推荐在正式环境使用,这个版本特点是没有连接ssl相关的库,并且可能缺少针对操作系统的一些性能优化,但是可以测试用,安装简单。 推荐按相应操作系统版本选择对应的安装包如centos6 rhel6选择RHEL 6 Linux 64-bit,即mongodb-linux-x86_64-rhel62-3.0.0.tgz这个安装包。 有朋友反应安装不上,因为还需要安装相应的依赖库如OpenSSL 相关的库。 如下所示,就是缺少OpenSSL 相关的库 ``` ldd mongodb-linux-x86_64-rhel62-3.0.0/bin/mongod mongodb-linux-x86_64-rhel62-3.0.0/bin/mongod: /usr/lib64/libssl.so.10: no version information available (required by mongodb-linux-x86_64-rhel62-3.0.0/bin/mongod) mongodb-linux-x86_64-rhel62-3.0.0/bin/mongod: /usr/lib64/libcrypto.so.10: no version information available (required by mongodb-linux-x86_64-rhel62-3.0.0/bin/mongod) mongodb-linux-x86_64-rhel62-3.0.0/bin/mongod: /usr/lib64/libcrypto.so.10: no version information available (required by mongodb-linux-x86_64-rhel62-3.0.0/bin/mongod) linux-vdso.so.1 => (0x00007ffffd961000) libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003d5b600000) libssl.so.10 => /usr/lib64/libssl.so.10 (0x0000003d62e00000) libcrypto.so.10 => /usr/lib64/libcrypto.so.10 (0x0000003d60e00000) librt.so.1 => /lib64/librt.so.1 (0x0000003d5be00000) libdl.so.2 => /lib64/libdl.so.2 (0x0000003d5ae00000) libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00000039bc800000) libm.so.6 => /lib64/libm.so.6 (0x0000003d5ba00000) libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000003d5ce00000) libc.so.6 => /lib64/libc.so.6 (0x0000003d5b200000) /lib64/ld-linux-x86-64.so.2 (0x0000003d5aa00000) libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x0000003d61a00000) libkrb5.so.3 => /lib64/libkrb5.so.3 (0x0000003d60a00000) libcom_err.so.2 => /lib64/libcom_err.so.2 (0x0000003d5e200000) libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x0000003d60600000) libz.so.1 => /lib64/libz.so.1 (0x0000003d5c200000) libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x0000003d61e00000) libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x0000003d60200000) libresolv.so.2 => /lib64/libresolv.so.2 (0x0000003d5d600000) libselinux.so.1 => /lib64/libselinux.so.1 (0x0000003d5ca00000)


安装好后

[root@ccj-sf export]# ldd /export/mongodb/bin/mongod linux-vdso.so.1 => (0x00007fff8f7ff000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f6e0d5a9000) libssl.so.10 => /usr/lib64/libssl.so.10 (0x00007f6e0d33d000) libcrypto.so.10 => /usr/lib64/libcrypto.so.10 (0x00007f6e0cf59000) librt.so.1 => /lib64/librt.so.1 (0x00007f6e0cd51000) libdl.so.2 => /lib64/libdl.so.2 (0x00007f6e0cb4d000) libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007f6e0c846000) libm.so.6 => /lib64/libm.so.6 (0x00007f6e0c5c2000) libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f6e0c3ac000) libc.so.6 => /lib64/libc.so.6 (0x00007f6e0c017000) /lib64/ld-linux-x86-64.so.2 (0x00007f6e0d7cf000) libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007f6e0bdd3000) libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007f6e0baed000) libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007f6e0b8e8000) libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007f6e0b6bc000) libz.so.1 => /lib64/libz.so.1 (0x00007f6e0b4a6000) libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007f6e0b29a000) libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007f6e0b097000) libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f6e0ae7d000) libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f6e0ac5d000) ```

配置文件 mmapv1引擎,配置文件与2.x版本完全相同。如: ```

cat mongod.cnf

dbpath=/export/data/mongodb30/mongod logpath=/export/data/mongodb30/log/mongod.log pidfilepath=/export/data/mongodb30/pid/mongod.pid directoryperdb=true replSet=a3 logappend=true keyFile=/export/data/mongodb30/key port=20000 fork=true wireTiger引擎配置增加相关参数即可,以副本集为例,如:

cat mongod.cnf

dbpath=/export/data/mongodb30/mongod logpath=/export/data/mongodb30/log/mongod.log pidfilepath=/export/data/mongodb30/pid/mongod.pid directoryperdb=true replSet=a3 logappend=true keyFile=/export/data/mongodb30/key port=20000 fork=true storageEngine=wiredTiger wiredTigerCacheSizeGB=10 wiredTigerStatisticsLogDelaySecs=0 wiredTigerJournalCompressor=snappy wiredTigerDirectoryForIndexes=true wiredTigerCollectionBlockCompressor=snappy wiredTigerIndexPrefixCompression=1 YAML 格式配置文件: 2.6版本就引入,以上面副本集为例: $ cat mongodb.cnf systemLog: destination: file path: /export/data/mongodb30/log/mongod.log logAppend: true storage: journal: enabled: true dbPath: /export/data/mongodb30/mongod directoryPerDB: true engine: wiredTiger wiredTiger: engineConfig: cacheSizeGB: 10 directoryForIndexes: true collectionConfig: blockCompressor: snappy indexConfig: prefixCompression: true net: port: 20000 replication: replSetName: a3 security: keyFile: /export/data/mongodb30/key processManagement: pidFilePath: /export/data/mongodb30/pid/mongod.pid fork: true setParameter: enableLocalhostAuthBypass: false 单机去掉replication及keyfile设置即可,分片增加一些参数,如: mongod增加 sharding: clusterRole: shardsvr configer server sharding: clusterRole: configsvr ```

参考: http://docs.mongodb.org/manual/reference/configuration-options/

10 回复
wanglong08
#1 wanglong08 • 2015-03-12 14:26

@ccj_nosql, 这个帖子写得太及时了,很到位,我线下测试了下,3.0还是很不错的

wanglong08
#2 wanglong08 • 2015-03-12 15:22

2015-03-12T15:19:05.285+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is ‘always’. 2015-03-12T15:19:05.286+0800 I CONTROL [initandlisten] ** We suggest setting it to ‘never’ 2015-03-12T15:19:05.286+0800 I CONTROL [initandlisten] 2015-03-12T15:19:05.286+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always’. 2015-03-12T15:19:05.286+0800 I CONTROL [initandlisten] ** We suggest setting it to ‘never’ Mongodb3.0.0 启动日志里建议将这两个系统参数设置成 never

jintaiyu520
#3 jintaiyu520 • 2015-03-12 16:07

要做成conf配置文件方式,不知如何配置? 默认配置下,我线下测试了下,mongorestore的性能3.0还不如2.6

ccj
#4 ccj • 2015-03-12 16:23

@jintaiyu520 如果是默认的mmapv1引擎,配置文件不变啊,跟2.x的版本一样,如果用wiretiger的引擎参数需要变化。

jintaiyu520
#5 jintaiyu520 • 2015-03-13 09:59

@ccj 能详细说下wiretiger的配置吗? 单机模式,以conf方式配置。谢谢ccj

ccj
#6 ccj • 2015-03-13 15:20

@jintaiyu520 和副本集类似啊,去掉replSet和keyFile就可以了。一般主要两个参数就够了: storageEngine=wiredTiger wiredTigerCacheSizeGB=20

一般情况下,其他参数默认的就可以了。

jintaiyu520
#7 jintaiyu520 • 2015-03-13 16:00

@ccj 我之前使用的就是这样方式,mongorestore的性能3.0还不如2.6,差一倍以上

我是直接下载包运行的,难道你们还自己编译?

ccj
#8 ccj • 2015-03-13 23:14

@jintaiyu520 你下载是的对应的操作系统的版本么?

jintaiyu520
#9 jintaiyu520 • 2015-03-14 21:08

@ccj 这个必须是

ccj
#10 ccj • 2015-03-17 14:08

@jintaiyu520 mongorestore性能就比较复杂了,涉及mongorestore本身和mongodb 版本,但理论上不会有太大差距。

需要 登录 后方可回复, 如果你还没有账号你可以 注册 一个帐号。