Mongodb Startup Parameters

Source: Internet
Author: User
Tags auth

Use the following command to view the startup parameters for the service: @
    1. mongod --help 或者mongod -h
Additional command parameters in detail: @
  1. * 基本配置
  2. -----------------------------------------------------------------------------
  3. --quiet # 安静输出
  4. --port arg # 指定服务端口号,默认端口27017
  5. --bind_ip arg # 绑定服务IP,若绑定127.0.0.1,则只能本机访问,不指定默认本地所有IP
  6. --logpath arg # 指定MongoDB日志文件,注意是指定文件不是目录
  7. --logappend # 使用追加的方式写日志
  8. --pidfilepath arg # PID File 的完整路径,如果没有设置,则没有PID文件
  9. --keyFile arg # 集群的私钥的完整路径,只对于Replica Set 架构有效
  10. --unixSocketPrefix arg # UNIX域套接字替代目录,(默认为 /tmp)
  11. --fork # 以守护进程的方式运行MongoDB,创建服务器进程
  12. --auth # 启用验证
  13. --cpu # 定期显示CPU的CPU利用率和iowait
  14. --dbpath arg # 指定数据库路径
  15. --diaglog arg # diaglog选项 0=off 1=W 2=R 3=both 7=W+some reads
  16. --directoryperdb # 设置每个数据库将被保存在一个单独的目录
  17. --journal # 启用日志选项,MongoDB的数据操作将会写入到journal文件夹的文件里
  18. --journalOptions arg # 启用日志诊断选项
  19. --ipv6 # 启用IPv6选项
  20. --jsonp # 允许JSONP形式通过HTTP访问(有安全影响)
  21. --maxConns arg # 最大同时连接数 默认2000
  22. --noauth # 不启用验证
  23. --nohttpinterface # 关闭http接口,默认关闭27018端口访问
  24. --noprealloc # 禁用数据文件预分配(往往影响性能)
  25. --noscripting # 禁用脚本引擎
  26. --notablescan # 不允许表扫描
  27. --nounixsocket # 禁用Unix套接字监听
  28. --nssize arg (=16) # 设置信数据库.ns文件大小(MB)
  29. --objcheck # 在收到客户数据,检查的有效性,
  30. --profile arg # 档案参数 0=off 1=slow, 2=all
  31. --quota # 限制每个数据库的文件数,设置默认为8
  32. --quotaFiles arg # number of files allower per db, requires --quota
  33. --rest # 开启简单的rest API
  34. --repair # 修复所有数据库run repair on all dbs
  35. --repairpath arg # 修复库生成的文件的目录,默认为目录名称dbpath
  36. --slowms arg (=100) # value of slow for profile and console log
  37. --smallfiles # 使用较小的默认文件
  38. --syncdelay arg (=60) # 数据写入磁盘的时间秒数(0=never,不推荐)
  39. --sysinfo # 打印一些诊断系统信息
  40. --upgrade # 如果需要升级数据库
  41. * Replicaton 参数
  42. -----------------------------------------------------------------------------
  43. --fastsync # 从一个dbpath里启用从库复制服务,该dbpath的数据库是主库的快照,可用于快速启用同步
  44. --autoresync # 如果从库与主库同步数据差得多,自动重新同步,
  45. --oplogSize arg # 设置oplog的大小(MB)
  46. * 主/从参数
  47. -----------------------------------------------------------------------------
  48. --master # 主库模式
  49. --slave # 从库模式
  50. --source arg # 从库端口号
  51. --only arg # 指定单一的数据库复制
  52. --slavedelay arg # 设置从库同步主库的延迟时间
  53. * Replica set(副本集)选项:
  54. -----------------------------------------------------------------------------
  55. --replSet arg # 设置副本集名称
  56. * Sharding(分片)选项
  57. -----------------------------------------------------------------------------
  58. --configsvr # 声明这是一个集群的config服务,默认端口27019,默认目录/data/configdb
  59. --shardsvr # 声明这是一个集群的分片,默认端口27018
  60. --noMoveParanoia # 关闭偏执为moveChunk数据保存?
All of the above parameters can be written in the mongod.conf configuration document for example: @
  1. dbpath = /data/mongodb
  2. logpath = /data/mongodb/mongodb.log
  3. logappend = true
  4. port = 27017
  5. fork = true
  6. auth = true

Mongodb Startup Parameters

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.