MongoDB configuration parameter description)

Source: Internet
Author: User
Tags mongo shell

IntroductionBytes ¶

Mongod is the main daemon of MongoDB to the host system. It can process data requests, manage data formats, and perform background management operations.

This document provides a complete overview of all command line options for mongod. These options are mainly used for testing. In common operations, useConfiguration FileAll operations of your database are described as follows:

OptionBytes ¶

Mongod

-- Help,-H success ¶

Returns a basic help and usage text.

-- Version history ¶

Returns the version of the mongod daemon.

-- Config <FILENAME>,-F <FILENAME> delimiter ¶

Specifies the configuration file. You can use it to specify the runtime configuration. The option is equivalent. You can use other command line parameters to configure the runtime configuration file as the preferred method mongod. See"Configuration File Options"File For more information about these options.

-- Verbose,-V clock ¶

Added a large number of internal reports to return standard output or specified log files-Log Path. Use V-shaped control details, including options multiple times, (eg-vvvvv .)

-- Quiet Networks ¶

For example, in a quiet mode, try to limit the output of running mongod. This option is disabled:

  • DATABASE CommandOutput, including drop, dropindex, diaglogging, verification, cleaning
  • Copy activity.
  • Connection acceptance event.
  • Connection Close event.

-- Port <port> restart ¶

The specified TCP port to listen to the mongod connection of the client. By default, mongod listens on port 27017.

A Unix system requires root permission to use a port number that is less than 1000.

-- Bind_ip <IP address> timeout ¶

The mongod process is bound to a connection with the IP address listener. By default, mongod listens to the address 127.0.0.1 on the local host .) You can also attach mongod to any interface. However, if you attach importance to the interface that mongod can access publicly, you have implemented correct authentication and/or firewall restrictions, to protect the integrity of your database.

-- Maxconns <number> limit ¶

The maximum number of simultaneous connections specified, which is accepted by mongod. This setting will have no effect. It is higher than the maximum connection trace threshold configured in your operating system.

-- Objcheck failed ¶

A forced mongod is used to verify all requests from the client to ensure that the database is never inserted when invalid objects are received. Enabling this option may affect the performance, rather than enabling it by default.

-- Logpath <path> logs ¶

The path of the specified log file. All diagnostic log information will be held.

Unless otherwise specified, mongod outputs all log information to the standard output. In addition, unless you can specify-LogappendWhen the log file is created, the overwriting process is restarted.

Others

In the near future, the behavior record system may change to server-4499 in the future.

-- Logappend Vertex ¶

Timed. This option ensures that the process starts again when mongod appends a new log file instead of overwriting the log Content.

-- Syslog producer ¶

All logs are output to the hostSystem LogsSystem, rather than standard output or use a log file-Log Path.

Warning

You may not use-System LogsAnd-Log Path.

-- Pidfilepath <path> delimiter ¶

"PID"Or the mongod process of the process ID. Used for tracking andMongodCombination Process-MongodCrossSelect.

If this option is not set, mongod will create a PID-free file.

-- Keyfile <File> delimiter ¶

The path of the specified key file stores authentication information. This option is only applicable to members of the connected sub-sets.

See.

"Copy setting Security"And"Replica set management. "

-- Nounixsocket timeout ¶

Disable listening to Unix sockets. Unless set to false, mongod and mongos provide a UNIX socket.

-- Unixsocketprefix <path> delimiter ¶

The path of the specified UNIX socket. Unless the value of this option is mongod mongos, create a socket/tmp as the prefix.

-- Fork Signature ¶

EnableDaemonRun mongod in the processing mode. This is a normal operation mode, in the production environment and production environment,HoweverTest is not advisable.

-- Auth Authentication ¶

Allow remote users to connect to the Database Authentication host. Configure the user throughMongoshell. If there are no users, the local host interface will continue to access the database until you create the first user.

See the Wikipedia page for more information about this feature for security and authentication.

-- CPU quota ¶

The percentage of CPU time written for the report by the Force's quota D is locked. Mongod generates output every four seconds. The Log Path option used by MongoDB to write the data to the standard output or log file.

-- Dbpath <path> Signature ¶

Specify a directory's mongod instance to store its data: typical regions include:/srv/MongoDB,/var/lib/MongoDB or/opt/MongoDB

Unless otherwise specified, mongod will find the default/data/DB directory in the data file. (Use the \ data \ dB directory in windows .) If you have entered SQL query in the installation package. Check the dbpath configuration of your package in the/etc/MongoDB. conf file.

-- Diaglog <value> values ¶

Create a very detailedDiagnostic logTroubleshooting and recording of various errors. In MongoDB, the string diaglog of a series of files starting from the dbpath directory where these log files are written and the end of the start time is recorded as a hexadecimal string.

The configuration details of the specified value. It may be the following values and their impact.

{0} {/0} Value

Set

0th days

Discount! No records.

1

Log write operation.

2

Log reading.

3

Log read and write operations.

7

Log writing and some read operations.

Replay output. You can use the dig sniff tool for investigation. A typical diaglog file is located in/data/DB/diaglog.4f76a58c. You can use a command to read these files in the following table:

Mongosniff -- source diaglog/data/DB/diaglog.4f76a58c

-DiaglogIs for internal use, not for the most user.

Warning

The diagnostic level is set to 0, which will cause the end of mongod.Diagnostic logFile write data. However, the mongod instance will continue to open the file even if it no longer writes data to the file. If you want to rename, move, or delete diagnostic logs, you must completely shut down the mongod instance before doing so.

-- Directoryperdb plugin ¶

The storage mode in the changed data directory stores the files of each database in different folders. This option will be created-DbpathOfThe directory is named every directory.

Use this option in conjunction with your file system and device MongoDB configuration to increase the write throughput or disk capacity of data stored on several different disk devices.

-- Journal logs ¶

Enable operation logs to ensure write durability and data consistency. By default, apsaradb for MongoDB logs are generated in a 64-bit version later than 2.0.

-- Journaloptions <arguments> logs ¶

Test the provided functions. It cannot be used for general purposes and may affect the integrity of the database.

-- Journalcommitinterval <value> Interval ¶

Specify the maximum allowed time between mongod log operations. The default value is 100 milliseconds, and the possible value range is 2 to 300, in milliseconds. The lower value increases the durability of the journal at the sacrifice of disk performance.

To force mongod to submit logs more frequently, you can specify "J:" true ". When J: The real write operation is pending, mongod will reduce the value of journalcommitinterval by 1/3.

-- IPv6 Subnet ¶

Specify this option to enable IPv6 support. This allows clients to use IPv6 to connect to mongodmongod. By default, IPv6 supports networks are disabled. Mongod and all tools.

-- Jsonp plugin ¶

LicenseJsonpAccess through an HTTP interface. Consider the security impact to enable this activity and then enable this option.

-- Noauth authorization ¶

Disable authentication. Current default value. Compatibility and clarity exist for the future.

-- Nohttpinterface restart ¶

Disable the HTTP interface.

-- Nojournal internal ¶

Disabled persistent logs. By default, after mongod is enabled, log 2.0 is in the 64-bit version.

-- Noprealloc failed ¶

Disable pre-allocated data files. This will shorten the startup time in some cases, but may cause significant performance penalty during normal operation.

-- Noscripting example ¶

Disable the script engine.

-- Notablescan failed ¶

Operation prohibited. A table scan is required.

-- Nssize <value> limit ¶

Specify the default value of the namespace file (that is, NS. Does this option affect the size of the existing namespace file.

The default value is 16 MB, which provides a valid namespace of 12000. The maximum size is 2 GB.

-- Profile <level> priority ¶

Changes the level of database analysis. This information is inserted into the output mongod's business performance or log file. The following levels are available:

Level

Set

0th days

Off. No analysis.

1

Only slow operations are included.

2

Enable all operations.

Profiling is disabled by default. Database analysis can affect database performance. This option is enabled only after careful consideration.

-- Quota resume ¶

The maximum number of data files allowed. Each database can have one. When running-QuotaThere is a maximum of 8 data files in each database. Adjust quota-Quotafiles.

-- Quotafiles <number> values ¶

Modify the limit on the number of data files in each database. Required by this option-Quota. Default Value-QuotafilesIs 8.

-- Rest APIs ¶

Enable simpleRestAPI.

-- Repair restart ¶

Maintenance procedures for all databases. This is equivalent to the command to shut down and run the repairdatabase database on all databases.

Warning

Generally, if you have a complete data copy, such as a recent backup or a complete member,Replica setHour, Do notUse repairdatabase or related database. repairdatabase to select () Mongo shell orMongod-Repair. <MSG name = "short_restore"> restore </MSG> from a complete data copy.

Others

When usingLogs, Almost never need to run repairdatabase. When an event fails to be shut down, the server automatically restores the recovered data files to the original state.

Change in version 2.1.2.

If you run the repair options,The data in the log file, mongod will refuse to start. In this case, you should-RepairOption, did not start mongod to allow mongod to recover data from the log. This will be completed more quickly, resulting in a more consistent and complete dataset.

Despite the log file, you need to continue the repair operation to close mongod clean, and then restart-RepairSelect.

-- Repairpath <path> Signature ¶

Specify the root directory, which contains the data file of MongoDB.-RepairOperation. Default Value-Dbpath.

-- Slowms <value> values ¶

The defined "slow" is-Company ProfileSelect. The database records all slow query logs, even when the event probe is not enabled. When the database analyzer, mongod analyzer writes system. Profile N. to collect more information, see the configuration file for the database analyzer.

-- Smallfiles Program ¶

When MongoDB is enabled, the default file mode {0} {/0} size is small. Specifically,-SmallfilesReduces the size of initially used data files and their limit to 512 MB.-SmallfilesAlso reduces the size of eachMagazines1 GB to 128 MB.

If you have a large number of databases-SmallfilesEach maintains a small amount of data.-SmallfilesIt can lead your mongod to create a large number of files, which may affect the performance of a larger database.

-- Shutdown failed ¶

UsedControl script,-CloseTerminate the mongod process cleanly and securely. You must set-DbpathOption.Configuration FileAnd-ConfigurationSelect.

-- Syncdelay <value> delimiter ¶

This setting controls the maximum number of seconds to synchronize between disks. Mongod always writes data to the disk. This setting controls the maximum interval between successful write operations and the next database refresh data written to the disk.

In many cases, the write operation and disk refresh ratio between actual time intervals are shorter.

If it is set to 0, mongod immediately refreshes all operations to the disk, which can have a significant performance impact. If-DiaryIs true, and all write operations will be persistent, through the magazine by the specified time-Journalcommitinterval.

-- Sysinfo producer ¶

Return the information of the Diagnosis System and exit. "The page size provided by the information, the number of physical pages, and the number of available physical pages.

-- Upgrade ¶

The file format specified for upgrading data on the disk-DbpathTo the latest version, if necessary.

This option only affects the operation of the mongod data file in an old format.

Others

In most casesNoYou should set this value so that you can exercise maximum control over your upgrade process. For more information about the upgrade process, see the MongoDB release instructions (download page.

-- Traceexceptions ¶

For internal diagnostics.

Copy OptionBytes ¶

-- Replset <setname> replset ¶

Use this option to configure the replica set for replication. You can specify a setname as a parameter. All Hosts must have the same settings name

See.

Copy"Replica set management,"Replica Set Configuration"

-- Oplogsize <value> delimiter ¶

The maximum size (in MB) specified by the copy operation (for exampleOplog). CreateOplog. It is a 64-bit system, and the computing log is generally 5% of the available disk space.

Once mongod has been created for the oplog time, it changes-OplogsizeDoes not affect the size of the oplog.

-- Fastsync resume ¶

InReplica setIn the case of replication, set this option if you have been vaccinated with the snapshot of this copyDbpath. Otherwise, mongod will try to perform full synchronization.

Warning

If the data has not been perfectly synchronizedAndMongod starts with fastsync and then secondary school or slave station will never sync Primary School, which may cause significant consistency issues.

-- Replindexprefetch success ¶

In the new version 2.2.

You must use-ReplindexprefetchReplset together. The default value is that all available options include:

  • None
  • All
  • _ Id_only

By default,Level 2OfReplica setThe oplog operation applied before all related metrics loaded to the memory by the Member. You can modify this behavior to help attach only the _ id index. Specify _ id_only or none to prevent mongodAnyThe index is loaded into the memory.

Master/Slave ReplicationBytes ¶

These options provide traditional master-slave database access replication, although this feature can still be used in MongoDB, replica set is the preferred configuration database replication.

-- Master slave ¶

Configure mongod run replication: Master

-- Slave failed ¶

Configure mongod to run the replication slave

-- Source

-SlaveOption-use the specified server as the source option. In this case, the server will be copied.

-- Only <Arg> Enabled ¶

For-SlaveOption-the unique option only specifies a singleDatabase.

-- Slavedelay <value> latency ¶

-Slavedelay-SlaveIn seconds.MasterNode application operations.

-- Autoresync resume ¶

For-SlaveOption,-AutoresyncThis option allows the slave to automatically synchronize local data. If it exceeds 10 seconds, the following: Master option may be faulty. IfOplogIs too small (control-OplogsizeOption .) IfOplogNot big enough, it is impossible to store the slaves in the current state and state between different masters. It is unnecessary to force the node to be re-synchronized. When you set-AutoresyncOption slaves will not try to automatically re-sync more than once within 10 minutes.

Partition cluster optionsBytes ¶

-- Configsvr restart ¶

Declare that the mongod instance actsConfigure Database. The default port of mongod is 27019. All data of mongod is written to the file/configdb-DbpathSub-directory.

-- Shardsvr ghost ¶

The configured shards are in the shard cluster of the mongod instance. The default port number of these instances is 27018.

-- Nomoveparanoia success ¶

Disable block migration for data writing in "paranoid mode. SeeBlock migrationAnd movechunk command documentation for more information.

By default, mongod will save on the "paranoid mode" during the migration of data blocks from "servers ". Set this option to disable this paranoia.

UsageBytes ¶

In common usage, calling mongod will initialize or control the script in a similar background:

Mongod -- config/etc/MongoDB. conf

See"Configuration File Options"Detailed information on how to use the configuration file to configure mongod.

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.