标签:
根据服务器的硬盘情况,其中/home为固态盘,/data为固态盘 /storage为机械盘
[root@mail ~]# df -lh
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 197G 1.6G 186G 1% /
tmpfs 63G 0 63G 0% /dev/shm
/dev/sda1 380M 70M 290M 20% /boot
/dev/sdb1 733G 197M 696G 1% /data
/dev/sda5 410G 235M 389G 1% /home
/dev/sdc1 9.0T 40M 8.5T 1% /storage
如果没有numactl命令,使用yum安装
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](/user/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/
标签:
原文地址:http://www.cnblogs.com/cy163/p/4439418.html