Jelajahi Sumber

M11 NATS fix: use 2.10-correct field names + drop conflicting -sd flag

The 2.10 schema uses 'max_file_store' and 'max_mem_store', not
'max_store' / 'max_mem' (those are 2.11+). The CLI flag '-sd'
conflicts with the config file's 'store_dir' field, so the
compose command drops '-sd' and lets the config handle it.

After this:
  - nats.conf has: jetstream { store_dir, max_file_store=10G, max_mem_store=1G }
  - docker command: -js -m 8222 -c /etc/nats/nats.conf

Test: nats-server -c ... -t (test config and exit) should pass.
Luis Rosales 1 bulan lalu
induk
melakukan
82dbc5a
2 mengubah file dengan 28 tambahan dan 23 penghapusan
  1. 18 14
      deploy/nats/nats.conf
  2. 10 9
      docker-compose.yml

+ 18 - 14
deploy/nats/nats.conf

@@ -17,19 +17,23 @@ monitor_port: 8222
 # trace: true
 
 # JetStream configuration.
-# max_store:  hard cap on disk-backed storage. With 11 GiB free on
-#             parres (post-prune 2026-06-16), 10 GiB gives a safety
-#             margin while still being well above the actual stream
-#             usage (~1.1 GiB after the broker.go fix).
-# max_mem:    hard cap on memory-backed storage. Set to 1 GiB
-#             (parres has 16 GiB total RAM; ollama + prometheus +
-#             clickhouse + grafana use the rest). Streams we declare
-#             are file-backed, so this only matters for any future
-#             memory-backed streams.
-# store_dir:  where JetStream writes its files. Mounted from the
-#             natsdata docker volume.
+# max_file_store: hard cap on disk-backed storage. With 11 GiB free
+#                 on parres (post-prune 2026-06-16), 10 GiB gives a
+#                 safety margin while still being well above the
+#                 actual stream usage (~1.1 GiB after the broker.go
+#                 fix in f450196).
+# max_mem_store:  hard cap on memory-backed storage. Set to 1 GiB
+#                 (parres has 16 GiB total RAM; ollama + prometheus +
+#                 clickhouse + grafana use the rest). Streams we
+#                 declare are file-backed, so this only matters for
+#                 any future memory-backed streams.
+# store_dir:      where JetStream writes its files. Mounted from the
+#                 natsdata docker volume.
+#
+# Field names verified against nats-server 2.10 schema (the
+# `max_store` / `max_mem` names from 2.11+ are not valid in 2.10).
 jetstream {
-  store_dir: /data/jetstream
-  max_store: 10737418240   # 10 GiB
-  max_mem:   1073741824    # 1 GiB
+  store_dir:     /data/jetstream
+  max_file_store: 10737418240   # 10 GiB
+  max_mem_store:  1073741824    # 1 GiB
 }

+ 10 - 9
docker-compose.yml

@@ -41,15 +41,16 @@ services:
 
   nats:
     image: nats:2.10-alpine
-    # -js              : JetStream enabled
-    # -sd /data        : store dir (mounted from natsdata volume)
-    # -m 8222          : HTTP monitoring port
-    # -c /etc/nats/nats.conf : load the JetStream limits from a
-    #              config file. 2.10 does not expose max_store /
-    #              max_mem as CLI flags; they have to come from a
-    #              .conf. See deploy/nats/nats.conf and
-    #              M11_NATS_INVESTIGATION.md.
-    command: ["-js", "-sd", "/data", "-m", "8222", "-c", "/etc/nats/nats.conf"]
+    # -js                       : JetStream enabled
+    # -m 8222                   : HTTP monitoring port
+    # -c /etc/nats/nats.conf    : load the JetStream config from
+    #                             a file. 2.10 does not expose
+    #                             max_file_store / max_mem_store as
+    #                             CLI flags; they have to come from
+    #                             a .conf. The config also sets
+    #                             store_dir. See deploy/nats/nats.conf
+    #                             and M11_NATS_INVESTIGATION.md.
+    command: ["-js", "-m", "8222", "-c", "/etc/nats/nats.conf"]
     ports: ["4222:4222", "8222:8222"]   # 8222 is the monitoring HTTP
     volumes:
       - natsdata:/data