Skip to main content

Environment Variables

Here we provide a complete list of environment variables that can be used to configure the daemon. These variables allow you to customize various aspects of the daemon's behavior, including database connections, storage options and more.

A variable set to an empty value (e.g. MOSAICOD_STORE_BUCKET=) is treated as unset: it does not override the config file value, and falls through to it or to the default instead.

General​

  • MOSAICOD_GRPC_MAX_DECODE_MESSAGE_SIZE: The maximum allowed size, in bytes, of an incoming gRPC message (the server's decode limit). If a message exceeds this size, a protocol error will be returned. Default is 50 MiB. Must be between 4 MiB and 512 MiB. If you need to update this value be aware that it is tipically smaller than MOSAICOD_PARQUET_IN_MEMORY_ENCODING_BUFFER_SIZE. The server's outgoing message size is fixed independently of this value, so lowering it later never affects the retrievability of previously-accepted data.

  • MOSAICOD_GRPC_TARGET_ENCODE_MESSAGE_SIZE: Target message size in bytes used during data streaming. The daemon will try to aggregate a number of RecordBatches to create a sufficiently large message. If the resulting batch size exceeds the limit, it will be capped by MOSAICOD_MAX_BATCH_SIZE. Defaults to 25 MiB.

  • MOSAICOD_MAX_CONCURRENT_WRITES: The maximum number of concurrent encoding and serialization operations. This setting controls how many data batches can be processed and sent to the object store simultaneously. It is important to note that this does not limit the number of topics the server can handle; rather, it constrains the parallel execution of the encoding/serialization pipeline. Each operation runs in a dedicated thread to handle CPU-bound compression and I/O-bound storage tasks. This value should be tuned based on available RAM and CPU. Excessive parallelism may lead to scheduler thrashing or memory exhaustion. Must be greater than 0. Defaults to MOSAICOD_DEFAULT_PARALLELISM.

  • MOSAICOD_MAX_CONCURRENT_CHUNK_QUERIES: Maximum number of concurrent queries that can be executed against data chunks. Must be greater than 0. Default is 4.

  • MOSAICOD_MAX_BATCH_SIZE: Maximum batch size (number of elements inside an Arrow RecordBatch) used during data streaming. Must be greater than 0. Defaults to DataFusion default batch size 8192.

  • MOSAICOD_DEFAULT_PARALLELISM: Sets the default degree of parallelism. While this is typically detected automatically based on available hardware, this field allows for a manual override in environments where automatic detection might fail or be inaccurate. Must be greater than 0. Defaults to the number of CPUs available to the process; if it is not set and detection fails, mosaicod fails to start. Currently it only affects MOSAICOD_MAX_CONCURRENT_WRITES default fallback.

  • MOSAICOD_QUERY_ENGINE_MEMORY_POOL_SIZE: Defines the amount of memory (in bytes) used by the query engine. Set this value to a number greater than 0 to enforce a hard limit on the memory allocated by the query engine. Use this setting if mosaicod encounters OOM (Out Of Memory) errors or you plan to use mosaicod in a memory constrained environment. Defaults to 0 (no limit).

  • MOSAICOD_PARQUET_IN_MEMORY_ENCODING_BUFFER_SIZE: Size (in bytes) of the in-memory buffer used for encoding parquet data. Defaults to 70 MiB.

  • MOSAICOD_MAX_SIZE_PLAIN_LIST_EQ: Maximum number of elements unrolled when decomposing a list eq/neq filter into per-element scalar comparisons. Queries with a filter whose value array exceeds this limit are rejected with a bad request error, to avoid generating pathologically large query expressions. Must be greater than 0. Defaults to 1024.

Logging​

  • MOSAICOD_LOG_LEVEL: Log verbosity level. One of warning, info, debug. Defaults to warning. Overridden by the --log-level CLI argument if set, and ignored if RUST_LOG is set.

  • MOSAICOD_LOG_FORMAT: Log output format. One of json, pretty, plain. Defaults to pretty. Overridden by the --log-format CLI argument if set.

Server​

  • MOSAICOD_HOST: Host address the server listens on. Defaults to the loopback address 127.0.0.1. Overridden by the --host CLI argument of the server command if set.

  • MOSAICOD_PORT: Port the server listens on. Must be greater than 0. Defaults to 6726. Overridden by the --port CLI argument of the server command if set.

  • MOSAICOD_GZIP_ENABLED: Whether gzip compression is enabled for gRPC requests and responses. Default is false.

  • MOSAICOD_API_KEY_ENABLED: Whether API key enforcement is enabled. See the mosaicod api-key command. Default is false.

TLS​

  • MOSAICOD_TLS_ENABLED: Whether TLS is enabled for the server. Requires MOSAICOD_TLS_CERT_FILE and MOSAICOD_TLS_PRIVATE_KEY_FILE to be set. Default is false.

  • MOSAICOD_TLS_CERT_FILE: Path to the TLS certificate file used for secure communication. Default is an empty string.

  • MOSAICOD_TLS_PRIVATE_KEY_FILE: Path to the TLS private key file used for secure communication. Default is an empty string.

DBMS​

  • MOSAICOD_DB_URL: Database connection URL, without credentials (e.g. postgresql://host:port/dbname). Use MOSAICOD_DB_USER and MOSAICOD_DB_PASSWORD to provide credentials. TLS is configured through the standard PostgreSQL URL parameters sslmode, sslrootcert, sslcert and sslkey. Required.

  • MOSAICOD_DB_USER: Database user used to establish the connection. Default is an empty string, as some databases do not require a user to be specified.

  • MOSAICOD_DB_PASSWORD: Database password used to establish the connection. Default is an empty string, as some databases do not require a password to be specified. May also be provided via MOSAICOD_DB_PASSWORD_FILE, set to the path of a file containing the password, instead of setting it directly; setting both MOSAICOD_DB_PASSWORD and MOSAICOD_DB_PASSWORD_FILE is an error. Trailing newlines in the file are ignored; any other whitespace is kept and considered part of the password.

  • MOSAICOD_MAX_DB_CONNECTIONS: Maximum number of database connections that can be established. Must be greater than 0. Default is 10.

Store​

  • MOSAICOD_STORE_ENDPOINT: Endpoint URL for the object storage service (e.g., S3). Use file:///some/absolute/path to set up a local storage directory. Required.

  • MOSAICOD_STORE_BUCKET: Name of the bucket in the object storage service where data will be stored. When using the local filesystem endpoint, the system creates a new directory named after the bucket within the endpoint path. May only contain ASCII letters, digits, . and -, and cannot be . or ... Required.

  • MOSAICOD_STORE_REGION: Region where the bucket is located (e.g. eu-south-1). Region is a general concept shared by many cloud storage services. For example, an S3 store uses it to sign requests, so on AWS it must match the region of the bucket. It is ignored when using the local filesystem endpoint. When empty, the object store client default (us-east-1) is used. Must not contain whitespace, control characters or /. Default is an empty string.

  • MOSAICOD_STORE_ACCESS_KEY: Access key for the object storage service. Optional with S3-compatible endpoints: when omitted (along with the secret key), the daemon uses the credentials of the EC2 instance role. If static keys are used, both MOSAICOD_STORE_ACCESS_KEY and MOSAICOD_STORE_SECRET_KEY must be set. Must not contain whitespace, control characters or ,. Default is an empty string.

  • MOSAICOD_STORE_SECRET_KEY: Secret key for the object storage service. Optional with S3-compatible endpoints: when omitted (along with the access key), the daemon uses the credentials of the EC2 instance role. Must not start or end with whitespace. Default is an empty string. May also be provided via MOSAICOD_STORE_SECRET_KEY_FILE, set to the path of a file containing the secret key, instead of setting it directly; setting both MOSAICOD_STORE_SECRET_KEY and MOSAICOD_STORE_SECRET_KEY_FILE is an error. Trailing newlines in the file are ignored.

  • MOSAICOD_STORE_CONNECTION_TIMEOUT: Timeout, in seconds, for the startup store connectivity check. At startup, the daemon validates store connectivity and credentials; if the check does not complete within this period, startup aborts. Must be greater than 0. Defaults to 5.

Cleanup​

  • MOSAICOD_CLEANUP_TIME_INTERVAL: Minimum interval, in seconds, that must pass between a cleanup run and the next one. When set to 0 a single cleanup is performed and then the process terminates; any value greater than 0 runs the cleanup routine in a loop. Defaults to 0. Overridden by the --time-interval CLI argument of the cleanup command if set.

  • MOSAICOD_CLEANUP_RETENTION_DURATION: Maximum period, in seconds, an obsolete file is kept in the store before being permanently deleted. Defaults to 86400. Overridden by the --retention-duration CLI argument of the cleanup command if set.

Store Optimizer​

  • MOSAICOD_STORE_OPTIMIZER_MEMORY_POOL_SIZE: Defines the amount of memory (in bytes) used by the store optimizer routine. Set this value to a number greater than 0 to enforce a hard limit on the memory it allocates. Use this setting if mosaicod store-optimizer encounters OOM (Out Of Memory) errors or you plan to run it in a memory constrained environment. Defaults to 0 (no limit).

  • MOSAICOD_STORE_OPTIMIZER_TIME_INTERVAL: Minimum interval, in seconds, that must pass between a store optimization run and the next one. When set to 0 a single run is performed and then the process terminates; any value greater than 0 runs the routine in a loop. Defaults to 0. Overridden by the --time-interval CLI argument of the store-optimizer command if set.

  • MOSAICOD_STORE_OPTIMIZER_MAX_CHUNK_SIZE: Maximum size (in bytes) for an output chunk after optimization. This is a soft limit, actual files on store may exceed this value slightly. Must be greater than 0. Defaults to 256 MiB. Overridden by the --max-chunk-size CLI argument of the store-optimizer command if set.