Hot reload
katana changes its running state from two sources without a restart. When you save the config file, katana reloads it and applies the difference. When the panel changes a node or its users, katana picks the change up at the next poll. Most changes apply within seconds, and some drop the node’s open connections.
This page is for operators who edit a live node’s config or who need to predict what a panel change does to connected users. It describes katana 6.1.0. For the config keys themselves, see Config file.
| Source | When katana notices | Where it is decided |
|---|---|---|
| The config file | Shortly after the file is saved | File changes |
| The panel | At the node’s next poll, every update_periodic seconds (default 60) |
Panel changes |
katana has no reload signal and no reload command. It does not handle SIGHUP, so the signal’s default action applies: it ends the process at once, without the final traffic reports that a SIGTERM or SIGINT shutdown sends.
File changes
Section titled “File changes”How katana notices an edit
Section titled “How katana notices an edit”At startup katana watches the directory that contains the config file, not the file itself. With a relative path such as the default -c config.toml, that is the working directory. Editors often save by writing a new file and renaming it over the old one, and a watch on the directory sees both styles of save. The watch is not recursive.
When a save arrives, katana:
- waits briefly and discards the events that arrived meanwhile, so a burst of writes from one save becomes one reload;
- reads and parses the config file again;
- compares the result with the running config and applies only what differs.
A reload that finds the parsed config unchanged applies nothing, so a save that only changes comments or whitespace is free.
If the file does not parse, katana logs the error and keeps the running config. Nothing is applied, not even the parts of the file that are valid:
ERROR katana::runtime: config reload failed, keeping current: config parse error: TOML parse error at line 14, column 1The same config reload failed, keeping current line, with a different cause, appears when the file is missing or is not UTF-8. katana applies the file as soon as a save makes it parse again. A file that still sets api.vless_flow or api.disable_custom_config, which katana 6 removed, fails the parse in the same way, as an unknown key; see Upgrading to katana 6.
What a reload applies, in order
Section titled “What a reload applies, in order”flowchart TB
E["The config file is saved"] --> P{"File parses?"}
P -- no --> K["Keep the running config"]
P -- yes --> C{"Every node it affects builds?"}
C -- no --> K
C -- yes --> L["Apply the log level"]
L --> G{"outbound or dns changed?"}
G -- yes --> S["Every node takes the new definitions and drops its connections"]
G -- no --> R["Stop removed nodes"]
S --> R
R --> U["Update changed nodes"]
U --> N["Start new nodes"]
-
Node check. Before it applies anything, katana checks every node the file adds, including a node whose identity changed, and every running node whose
[[node]]table changed. When[[outbound]]or[dns]changed, it checks every node. Each check builds what the node would run short of what its panel sends: its panel client, the outbounds,[dns], its routing table, and for a Hysteria 2 node on NewV2board or V2board its listener. Building the panel client refusespanel_type = "SSpanel", in any letter case, by name: katana 6 serves no SSPanel node. A helium node’s panel client refuses a[[node]]table that setsapi.node_type,api.enable_vlessor any[node.hysteria]key butcongestion, because helium’s panel describes the node’s protocol. The check also refuses a[node.hysteria] congestionother thancubic,bbrorrenoon any node, areal_ip_headerwithoutreal_ip_from, or the other way round, and a value in either that does not parse; and ahandoff_dirthat is not an absolute path or is too long for the node’s socket (more than 96 bytes on a node on every address, less on one address), ahandoff_groupwithouthandoff_dir, or ahandoff_groupthat/etc/groupdoes not list. If any check fails, katana rejects the whole reload and logs which node stopped it:ERROR katana::runtime: reload: node newv2board@https://panel.example.com#1/v2rayy: unknown node_type "V2rayy"; keeping current configERROR katana::runtime: reload: node helium@https://panel.example.com#1: [node.api] node_type is set, but a helium node's protocol is described by the panel; remove it (of [node.hysteria], only congestion is this host's to choose); keeping current configERROR katana::runtime: reload: node sspanel@https://panel.example.com#1: panel_type "SSpanel" is not supported: katana serves the NewV2board and Helium panels; keeping current configNothing is applied: not the log level, not the outbounds, and no removal, edit or addition. Every node keeps running as it was.
-
WireGuard warning. katana warns about any WireGuard outbound that more than one node routes to; see Several nodes in one file.
-
Log level. If
[log].levelchanged, katana swaps its log filter and logsreload: log level → <level>. Removing the key setsinfo. The new filter replaces the one taken fromRUST_LOGat startup. -
Outbounds and DNS. If any
[[outbound]]entry or[dns]changed, katana hands the new definitions to every node and logsreload: outbound pool rebuilt. Every node builds its new outbounds and resolver and drops every connection on it, whether or not its rules use what changed. -
Removed nodes. Each running node whose identity no longer appears in the file is stopped: its listener closes, every connection on it ends, and it sends one last traffic report to its panel (unless
disable_upload_trafficis on). katana waits for the report before it continues, so a slow panel delays the rest of the reload. Each panel request is bounded by the panel timeout (api.timeout, default 5 seconds). -
Changed nodes. Each node whose identity is unchanged but whose
[[node]]table differs receives its new settings, and katana logsreload: reconfigured node <name>. The node applies them itself; see What each change does. -
New nodes. Each node built in step 1 is started. It contacts its panel, fetches its users and binds its port, and keeps trying until it is up (see A node that cannot come up).
katana builds new nodes before it removes anything, and starts them after the removals. When a save changes a node’s identity, or replaces one node with another that gets the same port, the old node releases the port before the new one binds it.
Node identity
Section titled “Node identity”katana matches each [[node]] in the new file to a running node by its identity, a combination of five values:
| Value | Compared as |
|---|---|
panel_type |
Case-insensitive: NewV2board and newv2board are the same. NewV2board and V2board differ, although both use the same panel client |
api.host |
Exact text: https://panel.example.com and https://panel.example.com/ differ |
api.node_id |
Number |
api.key |
Exact text |
| The node type katana asks the panel for | NewV2board and V2board only: vless when api.node_type is a V2ray value (V2ray, Vmess or Vless) and api.enable_vless = true, otherwise api.node_type in lowercase. helium has no such value |
These values decide which panel node the entry serves. The UniProxy API of NewV2board and V2board finds a node by its ID and the node type it is asked for, so the same ID asked as vless and as vmess is two panel nodes, each with its own users and traffic. helium finds a node by its ID alone.
Changing any of the five values makes katana stop the old node as if it had been removed, and start a fresh node under the new values. The fresh node begins with nothing counted, so traffic carried for one panel node is never counted towards another, and it fetches everything from the panel again. On NewV2board with enable_vless off, for example, changing node_type from V2ray to Vmess starts a fresh node because the lowercased value changes, but V2ray to v2ray does not. Setting enable_vless on a Trojan node leaves the identity unchanged.
Everything else in a [[node]] table is a setting of the same node. The order of [[node]] tables in the file does not matter, so you can reorder them freely.
Log lines name a node by panel type, host, node ID and, on NewV2board and V2board, the node type, never by its key: reload: removing node newv2board@https://panel.example.com#1/v2ray, or reload: removing node helium@https://panel.example.com#1 on helium. This page writes that name as <name>.
A node that cannot come up
Section titled “A node that cannot come up”A node keeps trying until it is up, whether katana started it or a reload added it. Each attempt forgets the ETags of earlier attempts, fetches the node settings, fetches the user list, loads the audit rules, builds the node and binds the port. If a step fails, the node logs an error and waits:
ERROR katana::manager::node: node 1: node_info failed: …; retrying in 1s| Reason in the log line | What failed |
|---|---|
node_info failed: … |
The request for the node settings, or an answer katana cannot use or refuses, such as a port outside 1 to 65535 or a transport katana does not serve, which the line names after parse UniProxy config response: |
panel returned no node info |
The panel answered 304 Not Modified instead of the node settings |
user_list failed: … |
The request for the user list |
panel returned no user list |
The panel answered 304 Not Modified instead of the user list |
initial start failed: … |
Building the node or binding its listener, for example because the port is taken or the certificate is missing |
The first wait is 1 second. It doubles after each failure, up to 60 seconds, and it is never longer than update_periodic (at least 1 second). With the default update_periodic = 60 the waits are 1, 2, 4, 8, 16, 32, 60, 60 … seconds.
While the node waits:
- an edit to its own
[[node]]table is stored, and the next attempt starts at once with the new settings; - a change to
[[outbound]]or[dns]is stored for the next attempt, which does not start early; SIGINTorSIGTERM, or removing the node from the file, stops the retries.
What each change does
Section titled “What each change does”“Drops connections” means katana applies the new settings to the node and then closes every connection on it, including connections still in their handshake. The node keeps its listening socket when its address and port stay the same. Traffic counts survive, so bytes already relayed are still reported.
| Change in the file | When it takes effect | Open connections |
|---|---|---|
[log].level |
At once | Kept |
Any [[outbound]] added, removed or edited |
At once, after every node has checked it | Dropped on every node |
[dns] |
At once, after every node has checked it | Dropped on every node |
[[node]] added |
At once | None yet |
[[node]] removed |
At once, after a final report | Dropped on that node |
An identity value: panel_type other than its letter case, api.host, api.node_id, api.key, and on NewV2board and V2board the node type katana asks for |
At once: the node is stopped and started again | Dropped on that node |
api.enable_vless |
NewV2board and V2board with node_type V2ray or Vmess: an identity change, so the node is stopped and started again. With node_type = "Vless", or on any other node type: at once, through a new panel client. helium: see the last row |
Dropped when the node restarts, or when the new client switches a Vless node between VMess and VLESS. Kept on the other node types |
api.node_type |
NewV2board and V2board: an identity change when the node type katana asks for changes; a change of letter case only behaves like the next row. helium: see the last row | Dropped, unless only the letter case changed |
api.speed_limit, api.rule_list_path, api.timeout, enable_mtls, or the letter case of panel_type |
At once, through a new panel client. A speed_limit change reaches open connections at once. A rule_list_path change applies the new audit rules to new flows at once |
Kept, unless the node settings read again change the protocol or transport |
Any key in [node.controller.cert] |
At once | Dropped on that node |
controller.listen_ip, controller.disable_sniffing |
At once. A listen_ip edit can also rename a stream node’s handoff socket, whose name carries the address of a node on one address |
Dropped on that node |
Any key or rule in [node.route] |
At once, after the reload has checked the new rules | Dropped on that node |
Any key in [node.hysteria]: port, obfs, obfs_password, credential, udp, udp_idle_timeout, up_mbps, down_mbps, ignore_client_bandwidth, congestion, [node.hysteria.masquerade] |
At once, through a new panel client, after the reload has checked the values. Setting or clearing port switches a Hysteria 2 node between the local and the panel description. obfs and obfs_password count only while port is set; with port = 0 the panel’s obfuscation settings are used. On helium only congestion may be set |
Dropped on that node |
controller.disable_vmess_clock_check, controller.enable_device_limit, controller.ban_max_failures, controller.ban_window_secs, controller.ban_secs, controller.carrier_max_failures |
At once, through an immediate poll, for new connections. The node logs its new clock-check or device-limit line | Kept |
controller.update_periodic |
At once: the poll timer restarts, and the next poll comes one new period later | Kept |
controller.disable_upload_traffic |
At the next traffic report | Kept |
controller.real_ip_header, controller.real_ip_from |
At once, through an immediate poll, for new connections, after the reload has checked the pair. Only a WebSocket node reads them | Kept |
controller.handoff_dir, controller.handoff_group |
At once, through an immediate poll, after the reload has checked them: the node binds its handoff socket, binds it again at the new path or with the new group, or removes it, and logs its listening on line again |
Kept, handed-over ones included |
controller.send_ip, api.device_limit |
These keys have no effect. As a key in [node.api], a device_limit edit still builds a new panel client |
Kept |
panel_type = "SSpanel", or the keys api.vless_flow and api.disable_custom_config, all removed in katana 6 |
Never. panel_type = "SSpanel" refuses the reload as a whole, as in step 1, and either key fails the parse as an unknown key. See Upgrading to katana 6 |
Kept: nothing is applied |
On a helium node: setting api.node_type, api.enable_vless, or any [node.hysteria] key but congestion |
Never: the reload is refused as a whole, as in step 1. enable_vless = false, port = 0, udp = false, and an empty node_type or credential count as unset |
Kept: nothing is applied |
A node applies its edit as a whole. If anything in [node.api], enable_mtls or [node.hysteria] changed, or the letter case of panel_type, it builds a new panel client: on NewV2board and V2board the client completes a Hysteria 2 node with [node.hysteria], so it holds a copy of the block. On NewV2board the new client keeps the routes that the audit rules are derived from until it reads the node settings itself; helium sends no routes. The new client holds no ETags, so it reads the node settings and the user list in full.
When a node gets a new panel client, an edit that drops its connections, or an edit to the clock-check, device-limit, real-IP or handoff keys, and it is already up, it runs one poll cycle at once: it fetches the node settings and users, refreshes its audit rules, applies everything as described in Panel changes, and sends its traffic report. The regular poll timer is not reset. A node that is still trying to come up stores the edit and uses it at its next attempt. The other keys, such as update_periodic and disable_upload_traffic, are only stored and read where they are used.
Renaming an outbound and updating the rules that use it in the same save works: the reload checks the whole file at once.
Files katana reads
Section titled “Files katana reads”Some files named in the config are read by katana while it runs, without an edit to the config file:
| File | Read again when |
|---|---|
cert_file, key_file |
At every poll, and on every edit that applies to the node. A renewed certificate reaches new connections at the next poll, and open connections continue |
api.rule_list_path |
At every poll, while disable_get_rule is off. An edit to [node.api] reads it again at once, in the poll the new panel client runs |
[node.route] geoip, geosite |
At every poll the node checks which file is at each path. When another file is there, for example a new download renamed over the old one, the node builds its route again from it: new flows are routed with the new data, and open connections continue. A file that no rule uses is never read |
/etc/group |
While handoff_group is set: at every poll, and in every check of the node at start, on a reload and under --test |
A renewed certificate and a refreshed geodata file are the common cases. Nothing in the config file has to change for either; see Renew a certificate.
Panel changes
Section titled “Panel changes”Every update_periodic seconds each node polls its panel for the node’s settings and its user list, refreshes its audit rules, then applies the difference. The same poll also sends the traffic report.
If the panel request fails, the node logs a warning such as node 1: node_info: … and keeps the last settings or users it received. An answer katana refuses, such as a port outside 1 to 65535 or a transport it does not serve, counts as a failed request, and the warning names the reason: node 1: node_info: parse UniProxy config response: …. A failed poll never tears anything down.
How a node applies a panel answer
Section titled “How a node applies a panel answer”The node drops connections only when the change requires it:
flowchart TB
P["Poll: node settings, users, audit rules"] --> X{"Transport or protocol changed, or a local edit that drops connections?"}
X -- yes --> D["Apply, then drop every connection"]
X -- no --> C{"Anything else changed?"}
C -- yes --> A["Apply in place"]
C -- no --> N["Nothing to do"]
| Panel change | Effect | Open connections |
|---|---|---|
| A transport setting: port, network, the WebSocket path or host, the gRPC service name, TLS on or off, REALITY on or off, the REALITY server name, cover-site port, private key or shortId, Hysteria obfuscation type or password, a Hysteria 2 node’s masquerade (helium) | Applied, then every connection on the node is dropped | All end |
A protocol setting: node type, VLESS on or off, VLESS flow, cipher, server key, an sss node’s transform or udp_max_datagram, whether a Hysteria 2 node relays UDP (helium) |
Applied, then every connection on the node is dropped | All end |
| An AnyTLS node’s padding scheme | Applied to connections that start after the change | Kept, with the scheme they started with |
| Users added, removed or edited | Applied in place | Kept, except for removed users |
| A user’s device limit | Applied in place, to the user’s next connections | Kept |
The Hysteria 2 rates (up_mbps, down_mbps, ignore_client_bandwidth), and on helium the UDP idle timeout |
Applied to connections made after the change | Kept, at the rate they agreed |
| The audit rules | Applied in place | Kept |
host or server_name of a Trojan, AnyTLS or Hysteria 2 node on NewV2board or V2board |
Nothing: katana does not read them | Kept |
| Nothing | Nothing | Kept |
A change that cannot be applied is tried again at the next poll.
What a user refresh keeps
Section titled “What a user refresh keeps”When a new user list is applied:
- Unchanged users keep their connections, and their traffic counts continue.
- Removed users are retired. Their open connections end, and new connections with their credentials are refused. A credential that moved to a different user counts as removed from the old user.
- Users whose speed limit changed keep their connections, which run at the new rate from then on.
- New users can connect as soon as the list is applied.
Any change to a user’s record counts, including its password, UUID or speed limit. When two users present the same credential, the first one in the panel’s list is admitted and the other is skipped with a warning, skipping user <id>: shares its credential with user <first>. On a Hysteria 2 node the UDP socket stays bound, and the QUIC connections of the users who remain stay up.
For how the speed limits combine, see Speed limits. For what happens to the traffic of a removed user, see Traffic reporting.
Operating a live node
Section titled “Operating a live node”Check an edit before it goes live
Section titled “Check an edit before it goes live”A reload checks every node it affects as thoroughly as katana --test does, and rejects a file that does not parse or does not build. A node that cannot reach its panel or bind its port keeps retrying on its own. Check the file first, then put it in place in one step:
-
Copy the live config next to it and edit the copy:
Terminal window cp /etc/katana/config.toml /etc/katana/config.toml.newThe copy lives in the watched directory, so each save of it starts a reload of
config.toml. That reload finds nothing changed and does nothing. -
Check the copy:
Terminal window katana --test -c /etc/katana/config.toml.newA valid file prints
Configuration OKand exits with status0. Anything else printsconfiguration error: …and exits with status1. -
Move the copy over the live file:
Terminal window mv /etc/katana/config.toml.new /etc/katana/config.tomlA rename within one directory replaces the file in a single step, so katana never reads a half-written config.
-
Follow katana’s log and look for the
reload:lines. With the template unit from Deployment, for example, runjournalctl -u katana@xboard -f.
--test builds each node’s panel client, outbounds, [dns] and routing table, and the listener of each Hysteria 2 node on NewV2board or V2board, and checks each node’s real_ip_header and real_ip_from, its handoff_dir and handoff_group, looking the group up in /etc/group, and its [node.hysteria] congestion. It does not contact the panel, bind a port or a handoff socket, create the handoff directory, or read the certificate files of nodes whose TLS the panel controls, so a wrong cert_file path on such a node passes the check and shows up only in the node’s log. CLI lists the flags.
Save related edits together. Each save that touches [[outbound]], [dns], an identity value, enable_vless on a VMess or VLESS node, the certificate settings, listen_ip, disable_sniffing, [node.hysteria] or [node.route] drops connections again.
Apply a [dns] change
Section titled “Apply a [dns] change”A saved [dns] edit is checked against every node and applied at once. Every node builds a new resolver, with an empty cache, and drops every connection on it, so save such an edit at a quiet time.
Renew a certificate
Section titled “Renew a certificate”katana reads the certificate and key when the node starts and again at every poll, so a renewal needs no restart. Replace both files in one step, for example by writing new files and renaming them over the old ones, and the next poll serves the new certificate to new connections while open ones continue. Pointing cert_file and key_file at new paths also works, but that edit drops the node’s connections.
Log lines
Section titled “Log lines”In the reload: lines, <name> is <panel type>@<host>#<id>, followed by /<node type> on NewV2board and V2board.
| Line | Meaning |
|---|---|
config reload failed, keeping current: … |
The file did not parse or could not be read. Nothing was applied |
reload: node <name>: <error>; keeping current config |
A node the file adds or changes, or any node after an [[outbound]] or [dns] change, did not build. Nothing was applied |
reload: log level → <level> |
[log].level changed. katana logs this line even when the new value is rejected with invalid log level |
wireguard outbound <tag> is routed to by <n> nodes (…): … |
A warning: several nodes route to one WireGuard outbound, and each brings up its own tunnel with the same key |
reload: outbound pool rebuilt |
[[outbound]] or [dns] changed. Every node builds the new definitions and drops its connections |
reload: removing node <name> |
A node was removed, or its identity changed |
reload: added node <name> |
A new node, or a node under a new identity, was built and started. It still has to reach its panel and bind its port, and retries until it does |
reload: reconfigured node <name> |
A node received new settings. Check the table above for what they do |
node <id>: <reason>; retrying in <N>s |
An attempt to bring the node up failed. See A node that cannot come up |
node <id>: listening on <address> |
The node’s listener is up after a start, or after a panel change moved it. With listen_ip = "0.0.0.0" on a dual-stack host the address is [::]:<port> |
node <id>: listening on <address>, and for handed-over connections on <path> |
The same, for a node with a handoff socket. An edit that adds, moves or removes the socket logs the node’s listening on line again |
IPv6 sockets here take IPv6 alone (net.ipv6.bindv6only), so listen_ip 0.0.0.0 serves IPv4 only |
A warning, once: a node on 0.0.0.0 serves IPv4 clients only on this host |
node <id>: <error> |
At startup only: a node was not started because it did not build, for example unknown panel_type "<value>", panel_type "SSpanel" is not supported: katana serves the NewV2board and Helium panels, unknown node_type "<value>" or route references unknown outbound <tag>. On a reload the same error appears in the reload: node <name>: …; keeping current config line |
invalid log level "<level>": … |
The new [log].level is not a valid filter. The previous filter stays |
The lines from the reload and from the nodes it updates run concurrently, so their order in the log can vary.