在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
安装部分 2. 脚本文件 3. 安装mongodb /etc/yum.repos.d/mongodb.repo -> [mongodb] name=MongoDB Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/ gpgcheck=0 enabled=1 如果是32bit系统 [mongodb] name=MongoDB Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686/ gpgcheck=0 enabled=1 3.2 安装mongodb版本 sudo yum install mongodb-org 安装指定版本mongodb /etc/yum.conf -> exclude=mongodb-org,mongodb-org-server,mongodb-org-shell,mongodb-org-mongos,mongodb-org-tools 注意mongodb的默认端口和SELinux服务的状态。 数据文件目录:/var/lib/mongo ,日志文件目录: /var/log/mongo。 改变/var/lib/mongo和/var/log/mongo权限为mongodb的运行者。 4.1 启动mongodb
sudo service mongod start 4.2 证实mongodb启动成功 sudo chkconfig mongod on 4.3 关闭mongodb服务 sudo service mongod stop 4.4 重启mongodb服务 sudo service mongod restart 4.5 开始使用mongodb 配置文件部分 我的mongodb配置文件: systemLog: destination: file path: "/var/log/mongo/mongod.log" quiet: true logAppend: true timeStampFormat: iso8601-utc storage: dbPath: "/var/lib/mongo" directoryPerDB: true indexBuildRetry: false preallocDataFiles: true nsSize: 16 # quota: # enforced: false # maxFilesPerDB: 8 smallFiles: false syncPeriodSecs: 60 # repairPath: "/var/lib/mongo/_tmp" journal: enabled: true # debugFlags: 1 commitIntervalMs: 100 processManagement: fork: true pidFilePath: "/var/run/mongodb/mongod.pid" net: # bindIp: 192.168.11.52 port: 27017 http: enabled: true RESTInterfaceEnabled: false # ssl: # mode: "requireSSL" # PEMKeyFile: "/etc/ssl/mongodb.pem" operationProfiling: slowOpThresholdMs: 100 mode: "slowOp" security: keyFile: "/var/lib/mongo/mongodb-keyfile" clusterAuthMode: "keyFile" authorization: "disabled" replication: oplogSizeMB: 50 replSetName: "repl_test" secondaryIndexPrefetch: "all" 设置选项: 1. systemLog systemLog.verbosity integer 日志文件输出的级别,越大级别越低。 systemLog.quite boolean 在quite模式下会限制输出信息: systemLog.traceAllExceptions string 打印verbose信息来调试,用来记录证额外的异常日志。 systemLog.syslogFacility string,默认为user systemLog.path string 发送所有的诊断信息日志,默认重启后会覆盖。 systemLog.logAppend boolean systemLog.destination string systemLog.timeStampFormat string,默认为iso8601-local ctime,iso8601-utc,iso8601-local 2. processManagement processManagement.pidFilePath string processManagement.fork boolean,默认为false 3. net net.port interger,默认为27017 net.bindIp string,2.6版本默认为127.0.0.1 net.maxIncomingConnections integer 默认为1000000 net.wireObjectCheck boolean,默认为true net.http.enabled boolean,默认为false net.unixDomainSocket.enabled boolean,默认为false net.unixDomainSocket.pathPrefix string,默认为/tmp net.ipv6 boolean,默认为false net.http.JSONPEnabled boolean,默认为false net.http.RESTInterfaceEnabled boolean,默认为false 4. security security.keyFile string security.clusterAuthMode string keyFile,sendKeyFile,sendX509,x509 默认的mongodb发行版是不支持ssl的,可以使用专业版的或重新自行编译mongodb。 security.authorization string,默认为disabled 5. operationProfiling operationProfiling.slowOpThresholdMs integer,默认100 operationProfiling.mode integer,默认0 6. storage storage.dbPath string storage.directoryPerDB boolean,默认关闭 storage.indexBuildRetry boolean,默认为true storage.preallocDataFiles boolean,默认true storage.nsSize integer,默认16 storage.quota.enforced boolean,默认false storage.quota.maxFilesPerDB integer,默认为8 storage.smallFiles boolean,默认为false storage.syncPeriodSecs number,默认60 storage.journal.enabled boolean,默认64bit为true,32bit为false storage.journal.debugFlags integer storage.journal.commitIntervalMs number,默认为100或30 7. replication replication.oplogSizeMB integer,默认为磁盘的5% replication.replSetName string replication.secondaryIndexPrefetch string,默认为all 8. sharding sharding.clusterRole string sharding.archiveMovedChunks integer 9. auditLog auditLog.destination string auditLog.format string auditLog.path string auditLog.filter document { atype : <expression> } { atype: <expression>, "param.db": <database> } 10. snmp snmp.subagent boolean snmp.master boolean PS: replication.localPingThresholdMs integer,默认15 sharding.autoSplit boolean sharding.configDB string sharding.chunkSize integer,默认为64 2.Windows服务选项 processManagement.windowsService.serviceName string,默认为MongoDB processManagement.windowsService.displayName string,默认为MongoDB processManagement.windowsService.description string,默认为MongoDB Server processManagement.windowsService.serviceUser 指定运行mongodb服务的用户 processManagement.windowsService.servicePassword 指定运行mongodb服务的用户的密码 |
请发表评论