OS Manuals

/usr/bin/safekeeper

Serverless Postgres. We separated storage and compute to offer autoscaling, branching, and bottomless storage.

From neon 9129-r9 (os), captured 2026-11-05 by running safekeeper --help (exit 0). permalink

A fleet of safekeepers is responsible for reliably storing WAL received from
compute, passing it through consensus (mitigating potential computes brain
split), and serving the hardened part further downstream to pageserver(s).


Usage: safekeeper [OPTIONS]

Options:
  -D, --datadir <DATADIR>
          Path to the safekeeper data directory

          [default: ./]

      --id <ID>
          Safekeeper node id

      --init
          Initialize safekeeper with given id and exit

  -l, --listen-pg <LISTEN_PG>
          Listen endpoint for receiving/sending WAL in the form host:port

          [default: 127.0.0.1:5454]

      --listen-pg-tenant-only <LISTEN_PG_TENANT_ONLY>
          Listen endpoint for receiving/sending WAL in the form host:port allowing
          only tenant scoped auth tokens. Pointless if auth is disabled.

      --listen-http <LISTEN_HTTP>
          Listen http endpoint for management and metrics in the form host:port

          [default: 127.0.0.1:7676]

      --listen-https <LISTEN_HTTPS>
          Listen https endpoint for management and metrics in the form host:port

      --advertise-pg <ADVERTISE_PG>
          Advertised endpoint for receiving/sending WAL in the form host:port. If not specified, listen_pg is used to advertise instead

      --availability-zone <AVAILABILITY_ZONE>
          Availability zone of the safekeeper

  -n, --no-sync
          Do not wait for changes to be written safely to disk. Unsafe

      --dump-control-file <DUMP_CONTROL_FILE>
          Dump control file at path specified by this argument and exit

      --broker-endpoint <BROKER_ENDPOINT>
          Broker endpoint for storage nodes coordination in the form
          http[s]://host:port. In case of https schema TLS is connection is
          established; plaintext otherwise.

          [default: http://127.0.0.1:50051]

      --broker-keepalive-interval <BROKER_KEEPALIVE_INTERVAL>
          Broker keepalive interval

          [default: "5000 ms"]

      --heartbeat-timeout <HEARTBEAT_TIMEOUT>
          Peer safekeeper is considered dead after not receiving heartbeats from
          it during this period passed as a human readable duration.

          [default: 5000ms]

      --peer-recovery <PEER_RECOVERY>
          Enable/disable peer recovery

          [default: false]
          [possible values: true, false]

      --remote-storage <REMOTE_STORAGE>
          Remote storage configuration for WAL backup (offloading to s3) as TOML
          inline table, e.g.
            {max_concurrent_syncs = 17, max_sync_errors = 13, bucket_name = "<BUCKETNAME>", bucket_region = "<REGION>", concurrency_limit = 119}
          Safekeeper offloads WAL to
            [prefix_in_bucket/]<tenant_id>/<timeline_id>/<segment_file>, mirroring
          structure on the file system.

      --max-offloader-lag <MAX_OFFLOADER_LAG>
          Safekeeper won't be elected for WAL offloading if it is lagging for more than this value in bytes

          [default: 134217728]

      --max-reelect-offloader-lag-bytes <MAX_REELECT_OFFLOADER_LAG_BYTES>
          Safekeeper will re-elect a new offloader if the current backup lagging for more than this value in bytes

          [default: 0]

      --max-timeline-disk-usage-bytes <MAX_TIMELINE_DISK_USAGE_BYTES>
          Safekeeper will stop accepting new WALs if the timeline disk usage exceeds this value in bytes. Setting this value to 0 disables the limit

          [default: 0]

      --wal-backup-parallel-jobs <WAL_BACKUP_PARALLEL_JOBS>
          Number of max parallel WAL segments to be offloaded to remote storage

          [default: 5]

      --disable-wal-backup
          Disable WAL backup to s3. When disabled, safekeeper removes WAL ignoring WAL backup horizon

      --pg-auth-public-key-path <PG_AUTH_PUBLIC_KEY_PATH>
          If given, enables auth on incoming connections to WAL service endpoint
          (--listen-pg). Value specifies path to a .pem public key used for
          validations of JWT tokens. Empty string is allowed and means disabling
          auth.

      --pg-tenant-only-auth-public-key-path <PG_TENANT_ONLY_AUTH_PUBLIC_KEY_PATH>
          If given, enables auth on incoming connections to tenant only WAL
          service endpoint (--listen-pg-tenant-only). Value specifies path to a
          .pem public key used for validations of JWT tokens. Empty string is
          allowed and means disabling auth.

      --http-auth-public-key-path <HTTP_AUTH_PUBLIC_KEY_PATH>
          If given, enables auth on incoming connections to http management
          service endpoint (--listen-http). Value specifies path to a .pem public
          key used for validations of JWT tokens. Empty string is allowed and
          means disabling auth.

      --log-format <LOG_FORMAT>
          Format for logging, either 'plain' or 'json'

          [default: plain]

      --current-thread-runtime
          Run everything in single threaded current thread runtime, might be useful for debugging

      --walsenders-keep-horizon
          Keep horizon for walsenders, i.e. don't remove WAL segments that are still needed for existing replication connection

      --partial-backup-timeout <PARTIAL_BACKUP_TIMEOUT>
          Controls how long backup will wait until uploading the partial segment.

          [default: 15m]

      --disable-periodic-broker-push
          Disable task to push messages to broker every second. Supposed to be used in tests

      --enable-offload
          Enable automatic switching to offloaded state

      --delete-offloaded-wal
          Delete local WAL files after offloading. When disabled, they will be left on disk

      --control-file-save-interval <CONTROL_FILE_SAVE_INTERVAL>
          Pending updates to control file will be automatically saved after this interval

          [default: 300s]

      --partial-backup-concurrency <PARTIAL_BACKUP_CONCURRENCY>
          Number of allowed concurrent uploads of partial segments to remote storage

          [default: 5]

      --eviction-min-resident <EVICTION_MIN_RESIDENT>
          How long a timeline must be resident before it is eligible for eviction. Usually, timeline eviction has to wait for `partial_backup_timeout` before being eligible for eviction, but if a timeline is un-evicted and then _not_ written to, it would immediately flap to evicting again, if it weren't for `eviction_min_resident` preventing that.

          Also defines interval for eviction retries.

          [default: 15m]

      --wal-reader-fanout
          Enable fanning out WAL to different shards from the same reader

      --max-delta-for-fanout <MAX_DELTA_FOR_FANOUT>
          Only fan out the WAL reader if the absoulte delta between the new requested position and the current position of the reader is smaller than this value

      --ssl-key-file <SSL_KEY_FILE>
          Path to a file with certificate's private key for https API

          [default: server.key]

      --ssl-cert-file <SSL_CERT_FILE>
          Path to a file with a X509 certificate for https API

          [default: server.crt]

      --ssl-cert-reload-period <SSL_CERT_RELOAD_PERIOD>
          Period to reload certificate and private key from files

          [default: 60s]

      --ssl-ca-file <SSL_CA_FILE>
          Trusted root CA certificates to use in https APIs

      --use-https-safekeeper-api
          Flag to use https for requests to peer's safekeeper API

      --auth-token-path <AUTH_TOKEN_PATH>
          Path to the JWT auth token used to authenticate with other safekeepers

      --enable-tls-wal-service-api
          Enable TLS in WAL service API. Does not force TLS: the client negotiates TLS usage during the handshake. Uses key and certificate from ssl_key_file/ssl_cert_file

      --force-metric-collection-on-scrape
          Controls whether to collect all metrics on each scrape or to return potentially stale results

      --dev
          Run in development mode (disables security checks)

      --enable-pull-timeline-on-startup


      --global-disk-check-interval <GLOBAL_DISK_CHECK_INTERVAL>
          How often to scan entire data-dir for total disk usage

          [default: 60s]

      --max-global-disk-usage-ratio <MAX_GLOBAL_DISK_USAGE_RATIO>
          The portion of the filesystem capacity that can be used by all timelines. A circuit breaker will trip and reject all WAL writes if the total usage exceeds this ratio. Set to 0 to disable the global disk usage limit

          [default: 0]

  -h, --help
          Print help (see a summary with '-h')

  -V, --version
          Print version
Options (50)
OptionDescriptionSource
-D, --datadir DATADIRPath to the safekeeper data directoryhelp
--id IDSafekeeper node idhelp
--initInitialize safekeeper with given id and exithelp
-l, --listen-pg LISTEN_PGListen endpoint for receiving/sending WAL in the form host:porthelp
--listen-pg-tenant-only LISTEN_PG_TENANT_ONLYListen endpoint for receiving/sending WAL in the form host:port allowing only tenant scoped auth tokens.help
--listen-http LISTEN_HTTPListen http endpoint for management and metrics in the form host:porthelp
--listen-https LISTEN_HTTPSListen https endpoint for management and metrics in the form host:porthelp
--advertise-pg ADVERTISE_PGAdvertised endpoint for receiving/sending WAL in the form host:port.help
--availability-zone AVAILABILITY_ZONEAvailability zone of the safekeeperhelp
-n, --no-syncDo not wait for changes to be written safely to disk.help
--dump-control-file DUMP_CONTROL_FILEDump control file at path specified by this argument and exithelp
--broker-endpoint BROKER_ENDPOINTBroker endpoint for storage nodes coordination in the form http[s]://host:port.help
--broker-keepalive-interval BROKER_KEEPALIVE_INTERVALBroker keepalive intervalhelp
--heartbeat-timeout HEARTBEAT_TIMEOUTPeer safekeeper is considered dead after not receiving heartbeats from it during this period passed as a human readable duration.help
--peer-recovery PEER_RECOVERYEnable/disable peer recoveryhelp
--remote-storage REMOTE_STORAGERemote storage configuration for WAL backup (offloading to s3) as TOML inline table, e.g. {max_concurrent_syncs = 17, max_sync_errors = 13, bucket_name = "<BUCKETNAME>", bucket_region = "<REGION>",…help
--max-offloader-lag MAX_OFFLOADER_LAGSafekeeper won't be elected for WAL offloading if it is lagging for more than this value in byteshelp
--max-reelect-offloader-lag-bytes MAX_REELECT_OFFLOADER_LAG_BYTESSafekeeper will re-elect a new offloader if the current backup lagging for more than this value in byteshelp
--max-timeline-disk-usage-bytes MAX_TIMELINE_DISK_USAGE_BYTESSafekeeper will stop accepting new WALs if the timeline disk usage exceeds this value in bytes.help
--wal-backup-parallel-jobs WAL_BACKUP_PARALLEL_JOBSNumber of max parallel WAL segments to be offloaded to remote storagehelp
--disable-wal-backupDisable WAL backup to s3.help
--pg-auth-public-key-path PG_AUTH_PUBLIC_KEY_PATHIf given, enables auth on incoming connections to WAL service endpoint (--listen-pg).help
--pg-tenant-only-auth-public-key-path PG_TENANT_ONLY_AUTH_PUBLIC_KEY_PATHIf given, enables auth on incoming connections to tenant only WAL service endpoint (--listen-pg-tenant-only).help
--http-auth-public-key-path HTTP_AUTH_PUBLIC_KEY_PATHIf given, enables auth on incoming connections to http management service endpoint (--listen-http).help
--log-format LOG_FORMATFormat for logging, either 'plain' or 'json'help
--current-thread-runtimeRun everything in single threaded current thread runtime, might be useful for debugginghelp
--walsenders-keep-horizonKeep horizon for walsenders, i.e. don't remove WAL segments that are still needed for existing replication connectionhelp
--partial-backup-timeout PARTIAL_BACKUP_TIMEOUTControls how long backup will wait until uploading the partial segment.help
--disable-periodic-broker-pushDisable task to push messages to broker every second.help
--enable-offloadEnable automatic switching to offloaded statehelp
--delete-offloaded-walDelete local WAL files after offloading.help
--control-file-save-interval CONTROL_FILE_SAVE_INTERVALPending updates to control file will be automatically saved after this intervalhelp
--partial-backup-concurrency PARTIAL_BACKUP_CONCURRENCYNumber of allowed concurrent uploads of partial segments to remote storagehelp
--eviction-min-resident EVICTION_MIN_RESIDENTHow long a timeline must be resident before it is eligible for eviction.help
--wal-reader-fanoutEnable fanning out WAL to different shards from the same readerhelp
--max-delta-for-fanout MAX_DELTA_FOR_FANOUTOnly fan out the WAL reader if the absoulte delta between the new requested position and the current position of the reader is smaller than this valuehelp
--ssl-key-file SSL_KEY_FILEPath to a file with certificate's private key for https APIhelp
--ssl-cert-file SSL_CERT_FILEPath to a file with a X509 certificate for https APIhelp
--ssl-cert-reload-period SSL_CERT_RELOAD_PERIODPeriod to reload certificate and private key from fileshelp
--ssl-ca-file SSL_CA_FILETrusted root CA certificates to use in https APIshelp
--use-https-safekeeper-apiFlag to use https for requests to peer's safekeeper APIhelp
--auth-token-path AUTH_TOKEN_PATHPath to the JWT auth token used to authenticate with other safekeepershelp
--enable-tls-wal-service-apiEnable TLS in WAL service API.help
--force-metric-collection-on-scrapeControls whether to collect all metrics on each scrape or to return potentially stale resultshelp
--devRun in development mode (disables security checks)help
--enable-pull-timeline-on-startuphelp
--global-disk-check-interval GLOBAL_DISK_CHECK_INTERVALHow often to scan entire data-dir for total disk usagehelp
--max-global-disk-usage-ratio MAX_GLOBAL_DISK_USAGE_RATIOThe portion of the filesystem capacity that can be used by all timelines.help
-h, --helpPrint help (see a summary with '-h')help
-V, --versionPrint versionhelp

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.