Skip to main content

Garnet Configuration

How to Configure Garnet

The Garnet server (GarnetServer.exe) can be configured using a configuration file (e.g. garnet.conf or redis.conf), while command line arguments can be used to override any settings specified in the file. / Any settings not specified in either configuration file or command line arguments are set to default valued specified in the defaults.conf file (path to this file can be overridden via the command line arguments).

Garnet currently supports two configuration file formats:

  1. The garnet.conf file format (default) - a JSON-formatted collection of settings
  2. The redis.conf file format - a collection of settings in the Redis configuration file format:
    keyword argument1 argument2 argument3 ... argumentN
    See Redis docs for reference./ Important: Not all redis.conf keywords are supported in Garnet. In order to have full configuration settings coverage, use the garnet.conf format.

Specifying a configuration file path (and a default file path) can be done via the command line parameters./

  1. For garnet.conf:
    GarnetServer.exe --config-import-path <file-path>
  2. For redis.conf:
    GarnetServer.exe --config-import-path <file-path> --config-import-format RedisConf

Note: To change the path (and/or format) of the defaults configuration file, use the config-default-import-path and config-default-import-format keywords respectively.

garnet.conf

The default configuration file format for Garnet, which supports the full-range of configurable Garnet settings./ garnet.conf is a JSON-formatted file containing a collection of configuration settings. For all the available settings, see the defaults.conf file or refer to the complete Garnet settings list.

redis.conf

Garnet supports the redis.conf file format as a configuration file. Note that not all redis.conf keywords are supported. Please see the following list of supported redis.conf keywords:

redis.conf keywordgarnet.conf keywordNotes
bindbindOnly first address used
portport
maxmemorymemory
logfilefile-logger
loglevellogger-level
dircheckpointdir
requirepasspassword
aclfileacl-file
cluster-enabledcluster
cluster-node-timeoutcluster-timeout
tls-porttlsValue used to indicate if TLS should be used, port number is otherwise ignored
tls-cert-filecert-file-nameGarnet currently supports TLS using a .pfx file and passphrase, while Redis supportes TLS using .crt and .key files. In order to use TLS in Garnet while using redis.conf, convert your certificate to .pfx format (see details in the security section), then use the .pfx file path as the tls-cert-file value. If a passphrase was used when creating the original certificate, specify it in the tls-key-file-pass parameter as you would in Redis (or via the --cert-password command line argument). When starting the server, use the --cert-subject-name command line argument to set the certificate subject name, if applicable.
tls-key-filecert-passwordSee tls-cert-file notes
tls-auth-clientsclient-certificate-requiredSee tls-cert-file notes
latency-trackinglatency-monitor
io-threadsnumthreads
repl-diskless-sync-delayreplica-sync-delay

Command line arguments

Any setting in Garnet can be also configured by specifying a command line argument. / If the setting is also specified in the configuration file, it will be overridden by the value specified in the command line. / For all available command line settings, run GarnetServer.exe -h or GarnetServer.exe -help, or refer to the complete Garnet settings list.

Configurable Settings

garnet.conf
keyword
Command line keyword(s)TypeValid ValuesDescription
Port--portintInteger in range:
[0, 65535]
Port to run server on
Address--bindstringIP Address in v4/v6 formatIP address to bind server to (default: any)
MemorySize-m
--memory
stringMemory sizeTotal log memory used in bytes (rounds down to power of 2)
PageSize-p
--page
stringMemory sizeSize of each page in bytes (rounds down to power of 2)
SegmentSize-s
--segment
stringMemory sizeSize of each log segment in bytes on disk (rounds down to power of 2)
IndexSize-i
--index
stringMemory sizeStart size of hash index in bytes (rounds down to power of 2)
IndexMaxSize--index-max-sizestringMemory sizeMax size of hash index in bytes (rounds down to power of 2)
MutablePercent--mutable-percentintPercentage of log memory that is kept mutable
EnableReadCache--readcacheboolEnables read cache for faster access to on-disk records
ReadCacheMemorySize--readcache-memorystringMemory sizeTotal read cache log memory used in bytes (rounds down to power of 2)
ReadCachePageSize--readcache-pagestringMemory sizeSize of each read cache page in bytes (rounds down to power of 2)
ObjectStoreHeapMemorySize--obj-heap-memorystringMemory sizeObject store heap memory size in bytes (Sum of size taken up by all object instances in the heap)
ObjectStoreLogMemorySize--obj-log-memorystringMemory sizeObject store log memory used in bytes (Size of only the log with references to heap objects, excludes size of heap memory consumed by the objects themselves referred to from the log)
ObjectStorePageSize--obj-pagestringMemory sizeSize of each object store page in bytes (rounds down to power of 2)
ObjectStoreSegmentSize--obj-segmentstringMemory sizeSize of each object store log segment in bytes on disk (rounds down to power of 2)
ObjectStoreIndexSize--obj-indexstringMemory sizeStart size of object store hash index in bytes (rounds down to power of 2)
ObjectStoreIndexMaxSize--obj-index-max-sizestringMemory sizeMax size of object store hash index in bytes (rounds down to power of 2)
ObjectStoreMutablePercent--obj-mutable-percentintPercentage of object store log memory that is kept mutable
EnableObjectStoreReadCache--obj-readcacheboolEnables object store read cache for faster access to on-disk records
ObjectStoreReadCacheLogMemorySize--obj-readcache-log-memorystringMemory sizeTotal object store read cache log memory used in bytes (rounds down to power of 2)
ObjectStoreReadCachePageSize--obj-readcache-pagestringMemory sizeSize of each object store read cache page in bytes (rounds down to power of 2)
ObjectStoreReadCacheHeapMemorySize--obj-readcache-heap-memorystringMemory sizeObject store read cache heap memory size in bytes (Sum of size taken up by all object instances in the heap)
EnableStorageTier--storage-tierboolEnable tiering of records (hybrid log) to storage, to support a larger-than-memory store. Use --logdir to specify storage directory.
CopyReadsToTail--copy-reads-to-tailboolWhen records are read from the main store's in-memory immutable region or storage device, copy them to the tail of the log.
ObjectStoreCopyReadsToTail--obj-copy-reads-to-tailboolWhen records are read from the object store's in-memory immutable region or storage device, copy them to the tail of the log.
LogDir-l
--logdir
stringStorage directory for tiered records (hybrid log), if storage tiering (--storage-tier) is enabled. Uses current directory if unspecified.
CheckpointDir-c
--checkpointdir
stringStorage directory for checkpoints. Uses logdir if unspecified.
Recover-r
--recover
boolRecover from latest checkpoint and log, if present.
DisablePubSub--no-pubsubboolDisable pub/sub feature on server.
EnableIncrementalSnapshots--incsnapboolEnable incremental snapshots.
PubSubPageSize--pubsub-pagesizestringMemory sizePage size of log used for pub/sub (rounds down to power of 2)
DisableObjects--no-objboolDisable support for data structure objects.
EnableCluster--clusterboolEnable cluster.
CleanClusterConfig--clean-cluster-configboolStart with clean cluster config.
AuthenticationMode--authGarnetAuthenticationModeNoAuth, Password, Aad, ACLAuthentication mode of Garnet. This impacts how AUTH command is processed and how clients are authenticated against Garnet. Value options: NoAuth, Password, Aad, ACL
Password--passwordstringAuthentication string for password authentication.
ClusterUsername--cluster-usernamestringUsername to authenticate intra-cluster communication with.
ClusterPassword--cluster-passwordstringPassword to authenticate intra-cluster communication with.
AclFile--acl-filestringExternal ACL user file.
AadAuthority--aad-authoritystringThe authority of AAD authentication.
AadAudiences--aad-audiencesstringThe audiences of AAD token for AAD authentication. Should be a comma separated string.
AadIssuers--aad-issuersstringThe issuers of AAD token for AAD authentication. Should be a comma separated string.
AuthorizedAadApplicationIds--aad-authorized-app-idsstringThe authorized client app Ids for AAD authentication. Should be a comma separated string.
EnableAOF--aofboolEnable write ahead logging (append-only file).
AofMemorySize--aof-memorystringMemory sizeTotal AOF memory buffer used in bytes (rounds down to power of 2) - spills to disk after this limit
AofPageSize--aof-page-sizestringMemory sizeSize of each AOF page in bytes(rounds down to power of 2)
CommitFrequencyMs--aof-commit-freqintInteger in range:
[-1, MaxValue]
Write ahead logging (append-only file) commit issue frequency in milliseconds. 0 = issue an immediate commit per operation, -1 = manually issue commits using COMMITAOF command
WaitForCommit--aof-commit-waitboolWait for AOF to flush the commit before returning results to client. Warning: will greatly increase operation latency.
AofSizeLimit--aof-size-limitstringMemory sizeMaximum size of AOF (rounds down to power of 2) after which unsafe truncation will be applied. Left empty AOF will grow without bound unless a checkpoint is taken
CompactionFrequencySecs--compaction-freqintInteger in range:
[0, MaxValue]
Background hybrid log compaction frequency in seconds. 0 = disabled (compaction performed before checkpointing instead)
CompactionType--compaction-typeLogCompactionTypeNone, Shift, Scan, LookupHybrid log compaction type. Value options: None - No compaction, Shift - shift begin address without compaction (data loss), Scan - scan old pages and move live records to tail (no data loss), Lookup - lookup each record in compaction range, for record liveness checking using hash chain (no data loss)
CompactionForceDelete--compaction-force-deleteboolForcefully delete the inactive segments immediately after the compaction strategy (type) is applied. If false, take a checkpoint to actually delete the older data files from disk.
CompactionMaxSegments--compaction-max-segmentsintInteger in range:
[0, MaxValue]
Number of log segments created on disk before compaction triggers.
ObjectStoreCompactionMaxSegments--obj-compaction-max-segmentsintInteger in range:
[0, MaxValue]
Number of object store log segments created on disk before compaction triggers.
GossipSamplePercent--gossip-spintPercent of cluster nodes to gossip with at each gossip iteration.
GossipDelay--gossip-delayintInteger in range:
[0, MaxValue]
Cluster mode gossip protocol per node sleep (in seconds) delay to send updated config.
ClusterTimeout--cluster-timeoutintInteger in range:
[0, MaxValue]
Cluster node timeout is the amount of seconds a node must be unreachable.
ClusterTlsClientTargetHost--cluster-tls-client-target-hoststringName for the client target host when using TLS connections in cluster mode.
EnableTLS--tlsboolEnable TLS.
CertFileName--cert-file-namestringTLS certificate file name (example: testcert.pfx).
CertPassword--cert-passwordstringTLS certificate password (example: placeholder).
CertSubjectName--cert-subject-namestringTLS certificate subject name.
CertificateRefreshFrequency--cert-refresh-freqintInteger in range:
[0, MaxValue]
TLS certificate refresh frequency in seconds (0 to disable).
ClientCertificateRequired--client-certificate-requiredboolWhether TLS client certificate required.
CertificateRevocationCheckMode--certificate-revocation-check-modeX509RevocationModeNoCheck, Online, OfflineCertificate revocation check mode for certificate validation (NoCheck, Online, Offline).
IssuerCertificatePath--issuer-certificate-pathstringFull path of file with issuer certificate for validation. If empty or null, validation against issuer will not be performed.
LatencyMonitor--latency-monitorboolTrack latency of various events.
MetricsSamplingFrequency--metrics-sampling-freqintInteger in range:
[0, MaxValue]
Metrics sampling frequency in seconds. Value of 0 disables metrics monitor task.
QuietMode-q
--
boolEnabling quiet mode does not print server version and text art.
LogLevel--logger-levelLogLevelTrace, Debug, Information, Warning, Error, Critical, NoneLogging level. Value options: Trace, Debug, Information, Warning, Error, Critical, None
DisableConsoleLogger--disable-console-loggerboolDisable console logger.
FileLogger--file-loggerstringEnable file logger and write to the specified path.
ThreadPoolMinThreads--minthreadsintInteger in range:
[0, MaxValue]
Minimum worker and completion threads in thread pool, 0 uses the system default.
ThreadPoolMaxThreads--maxthreadsintInteger in range:
[0, MaxValue]
Maximum worker and completion threads in thread pool, 0 uses the system default.
UseAzureStorage--use-azure-storageboolUse Azure Page Blobs for storage instead of local storage.
AzureStorageConnectionString--storage-stringstringThe connection string to use when establishing connection to Azure Blobs Storage.
CheckpointThrottleFlushDelayMs--checkpoint-throttle-delayintInteger in range:
[-1, MaxValue]
Whether and by how much should we throttle the disk IO for checkpoints: -1 - disable throttling; >= 0 - run checkpoint flush in separate task, sleep for specified time after each WriteAsync
EnableFastCommit--fast-commitboolUse FastCommit when writing AOF.
FastCommitThrottleFreq--fast-commit-throttleintInteger in range:
[0, MaxValue]
Throttle FastCommit to write metadata once every K commits.
NetworkSendThrottleMax--network-send-throttleintInteger in range:
[0, MaxValue]
Throttle the maximum outstanding network sends per session.
EnableScatterGatherGet--sg-getboolWhether we use scatter gather IO for MGET or a batch of contiguous GET operations - useful to saturate disk random read IO.
ReplicaSyncDelayMs--replica-sync-delayintInteger in range:
[0, MaxValue]
Whether and by how much (milliseconds) should we throttle the replica sync: 0 - disable throttling
MainMemoryReplication--main-memory-replicationboolUse main-memory replication model.
OnDemandCheckpoint--on-demand-checkpointboolUsed with main-memory replication model. Take on demand checkpoint to avoid missing data when attaching
UseAofNullDevice--aof-null-deviceboolWith main-memory replication, use null device for AOF. Ensures no disk IO, but can cause data loss during replication.
ConfigImportPath--config-import-pathstringImport (load) configuration options from the provided path
ConfigImportFormat--config-import-formatConfigFileTypeGarnetConf, RedisConfFormat of configuration options in path specified by config-import-path
ConfigExportFormat--config-export-formatConfigFileTypeGarnetConf, RedisConfFormat to export configuration options to path specified by config-export-path
UseAzureStorageForConfigImport--use-azure-storage-for-config-importboolUse Azure storage to import config file
ConfigExportPath--config-export-pathstringExport (save) current configuration options to the provided path
UseAzureStorageForConfigExport--use-azure-storage-for-config-exportboolUse Azure storage to export config file
UseNativeDeviceLinux--use-native-device-linuxboolUse native device on Linux for local storage
RevivBinRecordSizes--reviv-bin-record-sizesint[]#,#,...,#: For the main store, the sizes of records in each revivification bin, in order of increasing size. Supersedes the default --reviv; cannot be used with --reviv-in-chain-only
RevivBinRecordCounts--reviv-bin-record-countsint[]#,#,...,#: For the main store, the number of records in each bin: Default (not specified): If reviv-bin-record-sizes is specified, each bin is 256 records # (one value): If reviv-bin-record-sizes is specified, then all bins have this number of records, else error #,#,...,# (multiple values): If reviv-bin-record-sizes is specified, then it must be the same size as that array, else error Supersedes the default --reviv; cannot be used with --reviv-in-chain-only
RevivifiableFraction--reviv-fractiondoubleDouble in range:
[0, 1]
#: Fraction of mutable in-memory log space, from the highest log address down to the read-only region, that is eligible for revivification. Applies to both main and object store.
EnableRevivification--revivboolA shortcut to specify revivification with default power-of-2-sized bins. This default can be overridden by --reviv-in-chain-only or by the combination of reviv-bin-record-sizes and reviv-bin-record-counts.
RevivNumberOfBinsToSearch--reviv-search-next-higher-binsintInteger in range:
[0, MaxValue]
Search this number of next-higher bins if the search cannot be satisfied in the best-fitting bin. Requires --reviv or the combination of rconeviv-bin-record-sizes and reviv-bin-record-counts
RevivBinBestFitScanLimit--reviv-bin-best-fit-scan-limitintInteger in range:
[0, MaxValue]
Number of records to scan for best fit after finding first fit. Requires --reviv or the combination of reviv-bin-record-sizes and reviv-bin-record-counts 0: Use first fit #: Limit scan to this many records after first fit, up to the record count of the bin
RevivInChainOnly--reviv-in-chain-onlyboolRevivify tombstoned records in tag chains only (do not use free list). Cannot be used with reviv-bin-record-sizes or reviv-bin-record-counts. Propagates to object store by default.
RevivObjBinRecordCount--reviv-obj-bin-record-countintInteger in range:
[0, MaxValue]
Number of records in the single free record bin for the object store. The Object store has only a single bin, unlike the main store. Ignored unless the main store is using the free record list.
ObjectScanCountLimit--object-scan-count-limitintInteger in range:
[0, MaxValue]
Limit of items to return in one iteration of *SCAN command
ExtensionBinPaths--extension-bin-pathsstring[]List of directories on server from which custom command binaries can be loaded by admin users
ExtensionAllowUnsignedAssemblies--extension-allow-unsignedboolAllow loading custom commands from digitally unsigned assemblies (not recommended)
IndexResizeFrequencySecs--index-resize-freqintInteger in range:
[1, MaxValue]
Index resize check frequency in seconds
IndexResizeThreshold--index-resize-thresholdintInteger in range:
[1, 100]
Overflow bucket count over total index size in percentage to trigger index resize
EnableLua--luaboolEnable Lua scripts on server
LuaTransactionMode--lua-transaction-modeboolRun Lua scripts as a transaction (lock keys - run script - unlock keys)