Server Configuration Flags
Dragonfly can be tuned and configured by a set of config flags. These flags can be:
- Passed to a Dragonfly as command line arguments. E.g,
dragonfly --port=6379. - Loaded from a file. E.g.
dragonfly --flagfile=path_to_flags/flags.txt - Can be set via env variables by adding the prefix
DFLY_followed by the flag name. E.g.export DFLY_port=6379(note it's case sensitive) - At runtime via
CONFIG SETcommand. Not all flags can be configured at runtime.
You can try dragonfly --helpfull to get a list of all flags or --help=substring shows help for
flags which include specified substring in either in the name, description or path.
Available Flags
--port
Redis port. 0 disables the port, -1 will bind on a random available port.
default: 6379
--cache_mode
If true, the backend behaves like a cache, by evicting entries when getting close to maxmemory limit
default: false
--cf_bucket_size
Default cuckoo filter bucket size, in slots per bucket, when a filter is created without an explicit bucket size.
default: 2
--cf_expansion_factor
Default growth factor for cuckoo filter sub-filters.
default: 1
--cf_initial_size
Default initial capacity for a cuckoo filter.
default: 1024
--cf_max_expansions
Maximum number of sub-filters a cuckoo filter can grow to through CF.ADD, CF.ADDNX, CF.INSERT, or CF.INSERTNX before those commands start failing.
default: 32
--cf_max_iterations
Default maximum number of cuckoo filter relocation iterations before an insert fails.
default: 20
--cluster_mode
Set cluster mode. Available options are: yes, emulated and empty "".
default: ""
--maxmemory
Limit on maximum-memory that is used by the database. 0 - means the program will automatically determine its maximum memory usage.
default: 0B
--dbnum
Number of databases.
default: 16
--bind
Bind address. If empty - binds on all interfaces. It's not advised due to security implications.
default: ""
--requirepass
Password for AUTH authentication. If empty, it can also be set with the DFLY_PASSWORD environment variable.
default: ""
--dbfilename
The filename to save/load the DB. In addition to {timestamp}, the {Y}, {m}, and {d} macros can be used.
default: "dump-{timestamp}"
--dir
Working directory
default: ""
--snapshot_cron
Cron expression for the time to save a snapshot, crontab style.
default:
--snapshot_egress_limit_bytes
Per-shard-thread socket egress bandwidth budget in bytes per second. Each shard throttles its snapshot traversal loop to stay under this rate. Accepts human-readable sizes such as 100mb and 1gb. A value of 0 disables throttling.
default: 0B
--admin_bind
If set, the admin console TCP connection would be bind to the given address. This supports both HTTP and RESP protocols.
default: ""
--admin_port
If set, would enable admin access to console on the assigned port. This supports both HTTP and RESP protocols.
default: 0
--max_client_iobuf_len
Maximum io buffer length that is used to read client requests.
default: 32.0KiB
--iobuf_min_shrink_interval_sec
Minimum time, in seconds, before a client input buffer may shrink. A value of 0 disables shrinking.
default: 30
--max_multi_bulk_len
Maximum multi-bulk (array) length that is allowed to be accepted when parsing RESP protocol
default: 65536
--migrate_connections
When enabled, Dragonfly will try to migrate connections to the target thread on which they operate. Currently this is only supported for Lua script invocations, and can happen at most once per connection.
default: true
--no_tls_on_admin_port
Allow non-tls connections on admin port.
default: false
--publish_buffer_limit
Amount of memory to use for storing publish commands per IO thread. This is the soft Pub/Sub back-pressure limit; publishers are only parked once the per-thread subscriber memory reaches this value times the internal hard-limit multiplier.
default: 196.00MiB
--pubsub_slow_subscriber_timeout_ms
If a subscriber connection keeps a Pub/Sub socket write blocked for at least this many milliseconds, Dragonfly closes it when either its queued Pub/Sub memory reaches one-sixteenth of publish_buffer_limit or the per-IO-thread subscriber memory is above publish_buffer_limit. A value of 0 disables this slow-subscriber protection. This is a startup-only flag, like publish_buffer_limit.
default: 0
--pipeline_squash
Number of queued pipelined commands above which squashing is enabled, 0 means disabled.
default: 1
--primary_port_http_enabled
If true allows accessing http console on main TCP port.
default: true
--request_cache_limit
Amount of memory to use for request cache in bytes per IO thread.
default: 64.00MiB
--tcp_nodelay
Configures dragonfly connections with socket option TCP_NODELAY.
default: true
--conn_io_thread_start
Starting thread id for handling server connections.
default: 0
--conn_io_threads
Number of threads used for handing server connections.
default: 0
--conn_use_incoming_cpu
If true uses incoming cpu of a socket in order to distribute incoming connections.
default: false
--container_iteration_yield_interval_usec
Yield the fiber every N microseconds during container iteration. 0 disables yielding.
default: 500
--tcp_keepalive
The period in seconds of inactivity after which keep-alives are triggerred, the duration until an inactive connection is terminated is twice the specified time.
default: 300
--timeout
Close the connection after it is idle for N seconds (0 to disable).
default: 0
--tls
Enable tls.
default: false
--tls_ca_cert_dir
Certified authority signed certificates directory. Use c_rehash on the directory before specifying this flag.
default: ""
--tls_ca_cert_file
Certified authority signed certificate to validate tls connections.
default: ""
--tls_cert_file
Cert file(public key) for tls connections.
default: ""
--tls_key_file
Private Key file for tls connections.
default: ""
--restricted_commands
Commands restricted to connections on the admin port.
default:
--lock_on_hashtags
When true, locks are done in the {hashtag} level instead of key level. Only use this with --cluster_mode=emulated|yes.
default: false
--enable_heartbeat_eviction
Enable eviction during heartbeat when memory is under pressure.
default: true
--max_eviction_per_heartbeat
The maximum number of key-value pairs that will be deleted in each eviction when heartbeat based eviction is triggered under memory pressure.
default: 100
--max_segment_to_consider
The maximum number of dashtable segments to scan in each eviction when heartbeat based eviction is triggered under memory pressure.
default: 4
--force_epoll
If true - uses linux epoll engine underneath. Can fit for kernels older than 5.10.
default: false
--pidfile
If not empty - server writes its pid into the file).
default: ""
--unixsocket
If not empty - specifies path for the Unix socket that will be used for listening for incoming connections.
default: ""
--unixsocketperm
Set permissions for unixsocket, in octal value.
default: ""
--version_check
If true, Will monitor for new releases on Dragonfly servers once a day.
default: true
--hz
Base frequency at which the server performs other background tasks. Warning: not advised to decrease in production.
default: 100
--masterauth
Password for authentication with master.
default: ""
--replicaof
Specifies a host and port which point to a target master to replicate.
Format should be <IPv4>:<PORT> or host:<PORT> or [<IPv6>]:<PORT>.
default:
--mem_defrag_page_utilization_threshold
Memory page under utilization threshold. Ratio between used and committed size, below this, memory in this page will defragmented.
default: 0.8
--mem_defrag_threshold
Minimum percentage of used memory relative to maxmemory cap before running defragmentation.
default: 0.7
--mem_defrag_waste_threshold
The ratio of wasted/committed memory above which we run defragmentation.
default: 0.2
--mem_defrag_check_sec_interval
Number of seconds between every defragmentation necessity check.
default: 60
--mem_defrag_max_burst_duration_us
Maximum real time, measured in microseconds, that DefragTask() may run at the proactor's highest on-idle priority before forcing a cooldown. A value of 0 disables the duty-cycle cap.
default: 0
--mem_defrag_backoff_duration_us
Duration in microseconds to drop to low on-idle priority after mem_defrag_max_burst_duration_us is reached, before resuming at high priority.
default: 0
--shard_round_robin_prefix
Deprecated and will be removed.
When non-empty, keys which start with this prefix are not distributed across shards based on their value but instead via round-robin. Use cautiously! This can efficiently support up to a few hundreds of prefixes. Note: the prefix is inspected inside hashtags when cluster mode is enabled.
default: ""
--tiered_prefix
Enables tiered storage if set. The string denotes the path and prefix of the files associated
with tiered storage. For example, tiered_prefix=/path/to/file-prefix.
default: ""