Guillaume Bienkowski
04/16/2026, 6:29 AMRocky
04/16/2026, 6:30 AMbe-pod-0.be-service.namespace.svc.cluster.local:9050
* New Identity: be-pod-0.be-service:9050 (or similar)
Even if it is the exact same physical Pod, the FE sees these as two distinct nodes. Because the Operator or your manual configuration likely "added" the new hostname, the FE assigned it a brand new BackendId. The FE now thinks you have two backends: one that is "Missing" (the old hostname) and one that is "New/Empty" (the new hostname).
Why the Data was Wiped
There are two main reasons why your data/ folder was cleared:
1. Missing Persistent Volumes (Most Likely):
By default, if storageVolumes are not explicitly configured in the StarRocks Operator CRD, the operator uses emptyDir for storage. Since changing the registration URL required updating the Pod's environment or configuration, the Operator performed a Rolling Update, which restarts the Pod. In Kubernetes, an emptyDir is completely wiped whenever a Pod is restarted or rescheduled.
2. Identity/Cluster ID Mismatch:
StarRocks BEs store a cluster_id and metadata in their storage path (usually in the meta subfolder). When a BE starts up and heartbeats to the FE, it receives cluster information. If the BE registers as a new node (new ID) but finds metadata on the disk belonging to an old node ID or a different cluster identity, it may treat the existing data as invalid or "stale" and re-initialize the storage directory to ensure consistency with its new identity.
How to Limit Data Loss and Prevent This
To safely change hostnames or migrate namespaces in the future, follow these best practices:
1. Always use Persistent Volumes (PVs)
Ensure your StarRocksCluster YAML has storageVolumes defined for BEs. This ensures that even if the Pod restarts or the hostname changes, the physical data persists on the disk.
yaml
starRocksBeSpec:
storageVolumes:
- name: be-data
storageClassName: your-storage-class
storageSize: 100Gi
mountPath: /opt/starrocks/be/storage
2. Use ALTER SYSTEM MODIFY BACKEND
If you must change the hostname of an existing BE, do not simply add the new one. Use the following SQL command to tell the FE that the "identity" of the existing Backend has moved to a new host. This preserves the BackendId and maps the existing tablets to the new URL:
sql
-- Syntax: ALTER SYSTEM MODIFY BACKEND HOST "old_host" TO "new_host";
ALTER SYSTEM MODIFY BACKEND HOST "be-0.be-service.old-ns.svc:9050" TO "be-0.be-service:9050";
Note: This is the safest way to "rename" a node without the FE treating it as a brand-new, empty node.
3. Enable FQDN Mode
If you are moving across namespaces, it is highly recommended to enable FQDN access. When starting your FE for the first time, you should use the --host_type FQDN flag. For existing clusters, you can transition to FQDN mode following the StarRocks FQDN documentation.
4. Increase Replica Count
Running a "lone BE" (1 replica) is extremely risky. In StarRocks, if you have replication_num = 1 and that single BE loses its data or identity, there is no way for the cluster to "self-heal" by cloning data from elsewhere. If you had 3 replicas, the FE would have seen the "new" BE as empty and automatically started cloning data from the other 2 healthy replicas.
Summary of Next StepsRocky
04/16/2026, 6:30 AMemptyDir.
* If you have a backup: You should restore from your latest snapshot.
* Clean up the duplicates: Run SHOW BACKENDS; and manually ALTER SYSTEM DROP BACKEND "old_host:port"; to remove the defunct ghost entries.
* Fix the Operator config: Ensure storageVolumes are configured so this doesn't happen on the next restart.
Do you have a record of whether storageVolumes were used in your StarRocksCluster spec?
References
• administration/management/resource_management/Replica.mdGuillaume Bienkowski
04/16/2026, 6:40 AMRocky
04/16/2026, 6:40 AMmeta/ and data/ directories) associated with the old BackendID.
3. The "Re-initialization": When the BE process starts up, it heartbeats to the FE. The FE says: "You are Backend ID 10005." The BE looks at its disk and sees: "But my disk says I am Backend ID 10002."
* To prevent data corruption or "phantom" data from appearing in the wrong place, the BE will often fail to start or, depending on the version/configuration, it may re-initialize the storage directory if it believes it is joining as a brand-new node to an existing cluster.
4. The Lone BE Trap: Because you have only one BE (replication_num = 1), there is no other copy of the data. The FE now sees two backends:
* ID 10002 (Old hostname): Dead, holds all the tablet metadata.
* ID 10005 (New hostname): Alive, holds zero tablets.
* Result: All queries fail because the FE is looking for the data on a node that doesn't exist anymore.
How to Prevent This in the Future
The StarRocks Operator manages the Pods, but the logical registration of the node identity must be handled via SQL to ensure continuity.
1. The Correct Way to Rename (The "Handover")
If you need to change the hostname/URL of your BEs, you must perform an ALTER command before or during the update so the FE knows the old identity is moving to a new address. This preserves the BackendID and the tablet mapping.
The SQL Command:
sql
-- Syntax: ALTER SYSTEM MODIFY BACKEND HOST "old_host" TO "new_host";
ALTER SYSTEM MODIFY BACKEND HOST "be-0.starrocks-be.old-ns.svc.cluster.local" TO "be-0.starrocks-be";
Note: Run this for each BE before the Operator restarts the Pods with the new configuration.
2. Use FQDN Mode
To avoid having to change hostnames when moving namespaces or clusters, you should enable FQDN access mode.
* In the Operator CRD, you can set the host_type or ensure the FE is started with the --host_type FQDN flag.
* This makes StarRocks rely on the DNS names rather than just IP addresses, but you still need to use the MODIFY BACKEND command if the actual string of that FQDN changes (e.g., removing the namespace part).
3. Redundancy is Key (The "3-Node Rule")
Running a single BE node is highly discouraged for production or any data you care about.
* If you have 3 BEs and replication_num = 3, you could have deleted the old node, added the new one, and the FE would have simply re-replicated the data from the other two survivors to the new one automatically.
* With 1 BE, you have no safety net.
Can you recover the data?
If the BE actually cleared the data/ directory on the persistent volume (which it often does when it senses a brand-new identity initialization), the data is unfortunately gone unless you have a snapshot of the volume.
Checklist for Recovery:
1. Check the PV: Exec into the pod and check /opt/starrocks/be/storage. If it is truly empty, the BE re-initialized it.
2. Clean up FE state: Run SHOW BACKENDS;. You will likely see both the old and new URLs. You should ALTER SYSTEM DROP BACKEND "old_host:port"; to remove the dead reference.
3. Restore: If you have a StarRocks backup (via Broker Load/Backup tool) or a cloud disk snapshot, now is the time to use it.Rocky
04/16/2026, 6:40 AMALTER SYSTEM MODIFY BACKEND HOST ... TO ... as your primary tool whenever the string used to identify a node changes. It's the only way to "move" a BackendID to a new address.
References
• sql-reference/information_schema/be_tablets.md
• administration/management/BE_configuration.md
• sql-reference/sql-statements/table_bucket_part_index/SHOW_TABLET.md
• table_design/table_design.md
• administration/management/FE_configuration.md
• knowledge/admin_and_operation/shared_data_compaction.md