1、获取某个配置参数的值:
db.runCommand( { getParameter :1,tcmallocAggressiveMemoryDecommit:1} )
2、设置某个配置参数的值:
db.adminCommand({setParameter:1,tcmallocAggressiveMemoryDecommit:1})
restcloud1:SECONDARY> db.runCommand( { getParameter :1,tcmallocAggressiveMemoryDecommit:1} )
{
"tcmallocAggressiveMemoryDecommit" : 0,
"ok" : 1,
"$clusterTime" : {
"clusterTime" : Timestamp(1729839283, 5),
"signature" : {
"hash" : BinData(0,"ow9/m9VuRu0MTE8DLPETaJHDOmc="),
"keyId" : NumberLong("7399092378755137537")
}
},
"operationTime" : Timestamp(1729839283, 5)
}
restcloud1:SECONDARY>
restcloud1:SECONDARY> db.adminCommand({setParameter:1,tcmallocAggressiveMemoryDecommit:1})
{
"was" : 0,
"ok" : 1,
"$clusterTime" : {
"clusterTime" : Timestamp(1729839357, 3),
"signature" : {
"hash" : BinData(0,"WM+I3xe2GYg6kMTsf+zAlkEIAXo="),
"keyId" : NumberLong("7399092378755137537")
}
},
"operationTime" : Timestamp(1729839357, 3)
}
restcloud1:SECONDARY> db.runCommand( { getParameter :1,tcmallocAggressiveMemoryDecommit:1} )
{
"tcmallocAggressiveMemoryDecommit" : 1,
"ok" : 1,
"$clusterTime" : {
"clusterTime" : Timestamp(1729839365, 2),
"signature" : {
"hash" : BinData(0,"8HcHh/hgduHsTbn57foz8x36xb4="),
"keyId" : NumberLong("7399092378755137537")
}
},
"operationTime" : Timestamp(1729839365, 2)
}
restcloud1:SECONDARY>
3、获取所有配置参数的值:
db.runCommand( { getParameter : '*' } )
restcloud1:SECONDARY> db.runCommand( { getParameter : '*' } )
{
"AlwaysRecordTraffic" : "",
"KeysRotationIntervalSec" : 7776000,
"ShardingTaskExecutorPoolHostTimeoutMS" : 300000,
"ShardingTaskExecutorPoolMaxConnecting" : 2,
"ShardingTaskExecutorPoolMaxSize" : 32767,
"ShardingTaskExecutorPoolMaxSizeForConfigServers" : -1,
"ShardingTaskExecutorPoolMinSize" : 1,
"ShardingTaskExecutorPoolMinSizeForConfigServers" : -1,
"ShardingTaskExecutorPoolRefreshRequirementMS" : 60000,
"ShardingTaskExecutorPoolRefreshTimeoutMS" : 20000,
"ShardingTaskExecutorPoolReplicaSetMatching" : "automatic",
"TransactionRecordMinimumLifetimeMinutes" : 30,
"adaptiveServiceExecutorIdlePctThreshold" : 60,
"adaptiveServiceExecutorMaxQueueLatencyMicros" : 500,
"adaptiveServiceExecutorRecursionLimit" : 8,
"adaptiveServiceExecutorReservedThreads" : -1,
"adaptiveServiceExecutorRunTimeJitterMillis" : 500,
"adaptiveServiceExecutorRunTimeMillis" : 5000,
"adaptiveServiceExecutorStuckThreadTimeoutMillis" : 250,
"allowRolesFromX509Certificates" : true,
"allowSecondaryReadsDuringBatchApplication" : true,
"authSchemaVersion" : 5,
"authenticationMechanisms" : [
"MONGODB-X509",
"SCRAM-SHA-1",
"SCRAM-SHA-256"
],
"authorizationManagerCacheSize" : 100,
"authorizationManagerPinnedUsers" : [ ],
"authorizationManagerPinnedUsersRefreshIntervalMillis" : NumberLong(1000),
"bgSyncOplogFetcherBatchSize" : 13981010,
"cachePressureThreshold" : 95,
"checkCachePressurePeriodSeconds" : 5,
"clientCursorMonitorFrequencySecs" : 4,
"cloudFreeMonitoringEndpointURL" : "https://cloud.mongodb.com/freemonitoring/mongo",
"clusterAuthMode" : "keyFile",
"collectionClonerBatchSize" : 0,
"collectionClonerUsesExhaust" : true,
"connPoolMaxConnsPerHost" : 200,
"connPoolMaxInUseConnsPerHost" : 2147483647,
"connPoolMaxShardedConnsPerHost" : 200,
"connPoolMaxShardedInUseConnsPerHost" : 2147483647,
"createRollbackDataFiles" : true,
"cursorTimeoutMillis" : NumberLong(600000),
"diagnosticDataCollectionDirectoryPath" : "/data/mongo27018/db/diagnostic.data",
"diagnosticDataCollectionDirectorySizeMB" : 200,
"diagnosticDataCollectionEnabled" : true,
"diagnosticDataCollectionFileSizeMB" : 10,
"diagnosticDataCollectionPeriodMillis" : 1000,
"diagnosticDataCollectionSamplesPerChunk" : 300,
"diagnosticDataCollectionSamplesPerInterimUpdate" : 10,
"disableIndexSpecNamespaceGeneration" : false,
"disableJavaScriptJIT" : true,
"disableLogicalSessionCacheRefresh" : false,
"disableNonSSLConnectionLogging" : false,
"disableNonTLSConnectionLogging" : false,
"disabledSecureAllocatorDomains" : [ ],
"enableElectionHandoff" : true,
"enableFlowControl" : true,
"enableHybridIndexBuilds" : true,
"enableIndexBuildsCoordinatorForCreateIndexesCommand" : false,
"enableLocalhostAuthBypass" : true,
"enableOverrideClusterChainingSetting" : false,
"enableShardedIndexConsistencyCheck" : true,
"enableTestCommands" : false,
"enforceUserClusterSeparation" : true,
"failIndexKeyTooLong" : true,
"featureCompatibilityVersion" : {
"version" : "4.2"
},
"findChunksOnConfigTimeoutMS" : 900000,
"flowControlDecayConstant" : 0.5,
"flowControlFudgeFactor" : 0.95,
"flowControlMaxSamples" : 1000000,
"flowControlMinTicketsPerSecond" : 100,
"flowControlSamplePeriod" : 1000,
"flowControlTargetLagSeconds" : 10,
"flowControlThresholdLagPercentage" : 0.5,
"flowControlTicketAdderConstant" : 1000,
"flowControlTicketMultiplierConstant" : 1.05,
"flowControlWarnThresholdSeconds" : 10,
"forceRollbackViaRefetch" : false,
"globalConnPoolIdleTimeoutMinutes" : 2147483647,
"heapProfilingEnabled" : false,
"heapProfilingSampleIntervalBytes" : NumberLong(262144),
"honorSystemUmask" : false,
"incrementChunkMajorVersionOnChunkSplits" : false,
"initialSyncOplogBuffer" : "collection",
"initialSyncOplogBufferPeekCacheSize" : 10000,
"initialSyncOplogFetcherBatchSize" : 13981010,
"initialSyncSourceReadPreference" : "",
"internalDocumentSourceCursorBatchSizeBytes" : 4194304,
"internalDocumentSourceGroupMaxMemoryBytes" : NumberLong(104857600),
"internalDocumentSourceLookupCacheSizeBytes" : 104857600,
"internalDocumentSourceSortMaxBlockingSortBytes" : NumberLong(104857600),
"internalGeoNearQuery2DMaxCoveringCells" : 16,
"internalGeoPredicateQuery2DMaxCoveringCells" : 16,
"internalInsertMaxBatchSize" : 64,
"internalLookupStageIntermediateDocumentMaxSizeBytes" : NumberLong(104857600),
"internalPipelineLengthLimit" : 2147483647,
"internalProhibitShardOperationRetry" : false,
"internalQueryAllowShardedLookup" : false,
"internalQueryAlwaysMergeOnPrimaryShard" : false,
"internalQueryCacheDisableInactiveEntries" : false,
"internalQueryCacheEvictionRatio" : 10,
"internalQueryCacheFeedbacksStored" : 20,
"internalQueryCacheListPlansNewOutput" : false,
"internalQueryCacheMaxSizeBytesBeforeStripDebugInfo" : NumberLong(536870912),
"internalQueryCacheSize" : 5000,
"internalQueryCacheWorksGrowthCoefficient" : 2,
"internalQueryDisableExchange" : false,
"internalQueryEnumerationMaxIntersectPerAnd" : 3,
"internalQueryEnumerationMaxOrSolutions" : 10,
"internalQueryEnumerationPreferLockstepOrEnumeration" : false,
"internalQueryExecMaxBlockingSortBytes" : 33554432,
"internalQueryExecYieldIterations" : 128,
"internalQueryExecYieldPeriodMS" : 10,
"internalQueryExplainSizeThresholdBytes" : 10485760,
"internalQueryFacetBufferSizeBytes" : 104857600,
"internalQueryFacetMaxOutputDocSizeBytes" : NumberLong(104857600),
"internalQueryForceIntersectionPlans" : false,
"internalQueryIgnoreUnknownJSONSchemaKeywords" : false,
"internalQueryMaxAddToSetBytes" : NumberLong(104857600),
"internalQueryMaxPushBytes" : 104857600,
"internalQueryMaxRangeBytes" : 104857600,
"internalQueryMaxScansToExplode" : 200,
"internalQueryPlanEvaluationCollFraction" : 0.3,
"internalQueryPlanEvaluationMaxResults" : 101,
"internalQueryPlanEvaluationWorks" : 10000,
"internalQueryPlanOrChildrenIndependently" : true,
"internalQueryPlannerEnableHashIntersection" : false,
"internalQueryPlannerEnableIndexIntersection" : true,
"internalQueryPlannerGenerateCoveredWholeIndexScans" : false,
"internalQueryPlannerMaxIndexedSolutions" : 64,
"internalQueryProhibitBlockingMergeOnMongoS" : false,
"internalQueryProhibitMergingOnMongoS" : false,
"internalQueryS2GeoCoarsestLevel" : 0,
"internalQueryS2GeoFinestLevel" : 23,
"internalQueryS2GeoMaxCells" : 20,
"internalValidateFeaturesAsMaster" : true,
"javascriptProtection" : false,
"journalCommitInterval" : 100,
"jsHeapLimitMB" : 1100,
"localLogicalSessionTimeoutMinutes" : 30,
"logComponentVerbosity" : {
"verbosity" : 0,
"accessControl" : {
"verbosity" : -1
},
"command" : {
"verbosity" : -1
},
"control" : {
"verbosity" : -1
},
"executor" : {
"verbosity" : -1
},
"geo" : {
"verbosity" : -1
},
"index" : {
"verbosity" : -1
},
"network" : {
"verbosity" : -1,
"asio" : {
"verbosity" : -1
},
"bridge" : {
"verbosity" : -1
},
"connectionPool" : {
"verbosity" : -1
}
},
"query" : {
"verbosity" : -1
},
"replication" : {
"verbosity" : -1,
"election" : {
"verbosity" : -1
},
"heartbeats" : {
"verbosity" : -1
},
"initialSync" : {
"verbosity" : -1
},
"rollback" : {
"verbosity" : -1
}
},
"sharding" : {
"verbosity" : -1,
"shardingCatalogRefresh" : {
"verbosity" : -1
}
},
"storage" : {
"verbosity" : -1,
"recovery" : {
"verbosity" : -1
},
"journal" : {
"verbosity" : -1
}
},
"write" : {
"verbosity" : -1
},
"ftdc" : {
"verbosity" : -1
},
"tracking" : {
"verbosity" : -1
},
"transaction" : {
"verbosity" : -1
}
},
"logLevel" : 0,
"logicalSessionRefreshMillis" : 300000,
"maxAcceptableLogicalClockDriftSecs" : NumberLong(31536000),
"maxBSONDepth" : 200,
"maxCatchUpPercentageBeforeBlockingWrites" : 10,
"maxIndexBuildDrainBatchSize" : 1000,
"maxIndexBuildDrainMemoryUsageMegabytes" : 16,
"maxIndexBuildMemoryUsageMegabytes" : 200,
"maxLogSizeKB" : 10,
"maxNumberOfTransactionOperationsInSingleOplogEntry" : 2147483647,
"maxOplogTruncationPointsAfterStartup" : NumberLong(100),
"maxOplogTruncationPointsDuringStartup" : NumberLong(100),
"maxSessions" : 1000000,
"maxSyncSourceLagSecs" : 30,
"maxTargetSnapshotHistoryWindowInSeconds" : 5,
"maxTransactionLockRequestTimeoutMillis" : 5,
"migrateCloneInsertionBatchDelayMS" : 0,
"migrateCloneInsertionBatchSize" : 0,
"migrationLockAcquisitionMaxWaitMS" : 500,
"minMillisBetweenSnapshotWindowDec" : 500,
"minMillisBetweenSnapshotWindowInc" : 500,
"minNumChunksForSessionsCollection" : 1024,
"minOplogTruncationPoints" : NumberLong(10),
"notablescan" : false,
"numInitialSyncAttempts" : 10,
"numInitialSyncCollectionCountAttempts" : 3,
"numInitialSyncCollectionFindAttempts" : 3,
"numInitialSyncConnectAttempts" : 10,
"numInitialSyncListCollectionsAttempts" : 3,
"numInitialSyncListDatabasesAttempts" : 3,
"numInitialSyncListIndexesAttempts" : 3,
"numInitialSyncOplogFindAttempts" : 3,
"opensslCipherConfig" : "",
"opensslDiffieHellmanParameters" : "",
"oplogFetcherInitialSyncMaxFetcherRestarts" : 10,
"oplogFetcherSteadyStateMaxFetcherRestarts" : 1,
"oplogInitialFindMaxSeconds" : 60,
"oplogRetriedFindMaxSeconds" : 2,
"oplogTruncationPointSizeMB" : 0,
"opportunisticSecondaryTargeting" : false,
"orphanCleanupDelaySecs" : 900,
"periodicNoopIntervalSecs" : 10,
"priorityTakeoverFreshnessWindowSeconds" : 2,
"quiet" : false,
"rangeDeleterBatchDelayMS" : 20,
"rangeDeleterBatchSize" : 0,
"recoverFromOplogAsStandalone" : false,
"recoverToOplogTimestamp" : "",
"replBatchLimitBytes" : 104857600,
"replBatchLimitOperations" : 5000,
"replElectionTimeoutOffsetLimitFraction" : 0.15,
"replWriterMinThreadCount" : 0,
"replWriterThreadCount" : 16,
"reportOpWriteConcernCountersInServerStatus" : false,
"reservedServiceExecutorRecursionLimit" : 8,
"rewriteStateChangeErrors" : true,
"roleGraphInvalidationIsFatal" : false,
"rollbackRemoteOplogQueryBatchSize" : 2000,
"rollbackTimeLimitSecs" : 86400,
"saslHostName" : "localhost.localdomain",
"saslServiceName" : "mongodb",
"saslauthdPath" : "",
"scramIterationCount" : 10000,
"scramSHA256IterationCount" : 15000,
"scriptingEngineInterruptIntervalMS" : 1000,
"shardedConnPoolIdleTimeoutMinutes" : 2147483647,
"shardedIndexConsistencyCheckIntervalMS" : 600000,
"skipCorruptDocumentsWhenCloning" : false,
"skipShardingConfigurationChecks" : false,
"skipShellCursorFinalize" : false,
"snapshotWindowAdditiveIncreaseSeconds" : 2,
"snapshotWindowMultiplicativeDecrease" : 0.75,
"sslMode" : "disabled",
"sslWithholdClientCertificate" : false,
"startupAuthSchemaValidation" : true,
"startupRecoveryForRestore" : false,
"storeFindAndModifyImagesInSideCollection" : false,
"suppressNoTLSPeerCertificateWarning" : false,
"syncdelay" : 60,
"synchronousServiceExecutorRecursionLimit" : 8,
"takeUnstableCheckpointOnShutdown" : false,
"taskExecutorPoolSize" : 1,
"tcmallocAggressiveMemoryDecommit" : 1,
"tcmallocMaxTotalThreadCacheBytes" : NumberLong(1073741824),
"tcmallocReleaseRate" : 1,
"testingSnapshotBehaviorInIsolation" : false,
"tlsCATrusts" : null,
"tlsMode" : "disabled",
"tlsOCSPVerifyTimeoutSecs" : 5,
"tlsWithholdClientCertificate" : false,
"traceExceptions" : false,
"traceWriteConflictExceptions" : false,
"trafficRecordingDirectory" : "",
"transactionLifetimeLimitSeconds" : 60,
"transactionSizeLimitBytes" : NumberLong("9223372036854775807"),
"ttlMonitorEnabled" : true,
"ttlMonitorSleepSecs" : 60,
"useReadOnceCursorsForIndexBuilds" : true,
"waitForSecondaryBeforeNoopWriteMS" : 10,
"waitForStepDownOnNonCommandShutdown" : true,
"watchdogPeriodSeconds" : -1,
"wiredTigerConcurrentReadTransactions" : 128,
"wiredTigerConcurrentWriteTransactions" : 128,
"wiredTigerCursorCacheSize" : -100,
"wiredTigerEngineRuntimeConfig" : "",
"wiredTigerFileHandleCloseIdleTime" : 100000,
"wiredTigerFileHandleCloseMinimum" : 250,
"wiredTigerFileHandleCloseScanInterval" : 10,
"wiredTigerMaxCacheOverflowSizeGB" : 0,
"wiredTigerSessionCloseIdleTimeSecs" : 300,
"wiredTigerSkipTableLoggingChecksOnStartup" : false,
"writePeriodicNoops" : true,
"ok" : 1,
"$clusterTime" : {
"clusterTime" : Timestamp(1729847329, 1),
"signature" : {
"hash" : BinData(0,"moIf1x75pVCHdhgeq4/kFmGWrU4="),
"keyId" : NumberLong("7399092378755137537")
}
},
"operationTime" : Timestamp(1729847329, 1)
}
restcloud1:SECONDARY>