Francisco Silva
05/07/2026, 8:34 AMRocky
05/07/2026, 8:35 AMSELECT queries. This reduces the load on your StarRocks cluster and provides sub-millisecond responses for cached data.
4. Zero-Downtime Maintenance
* ProxySQL: You can dynamically add, remove, or change the weight of FE nodes in the ProxySQL configuration without restarting the proxy or disconnecting applications. If an FE goes down, ProxySQL detects the failure at the protocol level (not just TCP) and routes traffic elsewhere instantly.
* TCP LB: While TCP LBs have health checks, they may take longer to detect a node that is technically "online" (TCP port open) but internally stalled or in a "non-ready" state for SQL.
Summary Comparison
Feature | ProxySQL (L7) | Normal TCP LB (L4)
Awareness | Understands SQL syntax & FE Roles | Only sees IP/Port
R/W Split | Automatic (via Query Rules) | Not possible (or requires multiple VIPs)
Conn Pool | Advanced (Multiplexing) | Basic or None
Security | SQL Injection Filtering | Basic Firewalling
Performance | Can cache queries | Just forwards packets
In short: Use a TCP Load Balancer (like an AWS NLB) if you want the simplest setup for high availability. Use ProxySQL if you want to scale your read performance, protect your Leader FE, and optimize connection management.
References
• administration/management/resource_management/Load_balance.md
• administration/management/FE_configuration.md
• faq/Deploy_faq.md
• faq/operation_maintenance_faq.md
• deployment/deploy_manually.mdFrancisco Silva
05/07/2026, 8:53 AMinsert into mysql_servers(hostgroup_id, hostname, port) values(1, '172.xx.xx.139', 9030);
9. Insert the observer nodes
insert into mysql_servers(hostgroup_id, hostname, port) values(2, '172.xx.xx.139', 9030);
insert into mysql_servers(hostgroup_id, hostname, port) values(2, '172.xx.xx.140', 9030);
these are the instructions for the proxysql - how does proxysql distinguish the node types?Rocky
05/07/2026, 8:54 AM172.xx.xx.139 is the leader; it simply knows that any traffic the rules send to Hostgroup 1 should go to that specific IP.
2. Query Rules (The "Brain")
Once you have defined the hostgroups, you use the mysql_query_rules table to tell ProxySQL how to route traffic:
* Write Traffic: You create a rule that routes any statement starting with INSERT, UPDATE, CREATE, etc., to Hostgroup 1 (the Leader).
* Read Traffic: You create a rule that routes SELECT statements to Hostgroup 2 (the Observers/Followers).
3. Handling Leader Elections (The "Dynamic" Way)
Since StarRocks elects a new Leader if the current one fails, a static ProxySQL configuration would eventually point to the wrong node. In production, this is usually handled in one of two ways:
* Custom Scheduler Scripts: ProxySQL has a built-in scheduler that can run external scripts (e.g., every 5-10 seconds). You can use a Python or Bash script that:
1. Logs into a StarRocks FE.
2. Runs SHOW FRONTENDS;.
3. Parses the output to find which IP has IsLeader = true.
4. Updates the ProxySQL mysql_servers table dynamically to move that IP into Hostgroup 1.
* Read-Only Flag: Some users configure ProxySQL to check the read_only variable (though this is more common in traditional MySQL). In StarRocks, because non-leader nodes can still accept writes and forward them internally, relying on a "read-only" flag is less common than using a script that checks the Role column in SHOW FRONTENDS.
Summary
ProxySQL distinguishes the nodes based on the Hostgroup ID you assign them. It is then up to your Query Rules to ensure writes hit the Leader's hostgroup and reads hit the Observers' hostgroup. To handle the dynamic nature of StarRocks leader election, a scheduler script is the recommended way to keep those hostgroups up to date.
References
• administration/management/resource_management/Load_balance.md
• faq/operation_maintenance_faq.md
• administration/stargo.md
• deployment/plan_cluster.md
• deployment/deploy_manually.mdFrancisco Silva
05/07/2026, 8:57 AMRocky
05/07/2026, 8:57 AMINSERT, ALTER, or CREATE TABLE) to a Follower or Observer FE, that node cannot process it directly. It must physically forward the request to the Leader FE, wait for the Leader to process it, and then pass the response back to you.
* The Problem: This creates a "double hop." You are consuming CPU and Network bandwidth on two FE nodes for a single transaction.
* The ProxySQL Advantage: By routing writes directly to the Leader hostgroup, you bypass this middleman, reducing latency and reducing the load on your non-leader nodes.
2. Protecting the Leader's Stability
The Leader FE is the "brain" of your cluster. It is responsible for:
* Metadata Management: Writing and synchronizing the edit log via BDB JE.
* Transaction Coordination: Managing the lifecycle of every data load.
* Heartbeats: Keeping track of every BE node's health.
* Query Planning: For the queries it receives.
If you blast the Leader with massive SELECT queries (which can be memory and CPU intensive), you risk starving these critical background tasks. If the Leader becomes too slow to respond to heartbeats or sync metadata, it can trigger a Leader Re-election, causing a brief cluster-wide "freeze."
3. Scaling Read Concurrency (The Role of Observers)
If your application grows and you have thousands of concurrent users running reports:
* Without Split: You keep adding Follower FEs. However, adding too many Followers can actually slow down writes because the Raft protocol requires the Leader to wait for a majority of Followers to acknowledge metadata changes.
* With Split: You add Observer nodes. Observers do not participate in voting, so they don't slow down the Leader. By using ProxySQL to route all SELECT traffic to these Observers, you can scale your read capacity to 10+ nodes without any impact on write performance or cluster stability.
4. Deterministic Performance
When you use a basic TCP Load Balancer, your write performance is inconsistent. Sometimes your INSERT hits the Leader (fast), and sometimes it hits a Follower (slower due to forwarding). By splitting the traffic at the proxy level, you ensure that every write follows the most efficient path every time.
Summary: The "Smart" vs. "Lazy" Way
Approach | How it works | Impact
Lazy (TCP LB) | FE nodes forward writes to Leader internally. | Higher latency, Leader risk, "Double hop" overhead.
Smart (ProxySQL) | Proxy knows who the Leader is and sends writes directly. | Lowest latency, isolated Leader, infinite read scalability.
In short, StarRocks provides the internal forwarding as a fail-safe/convenience, but ProxySQL provides it as a performance optimization and stability strategy.
References
• faq/operation_maintenance_faq.md
• faq/Deploy_faq.md
• introduction/Architecture.md
• deployment/plan_cluster.md
• administration/management/resource_management/Load_balance.mdFrancisco Silva
05/07/2026, 9:03 AMRocky
05/07/2026, 9:03 AMmysql_query_rules).
2. FE Roles: Leader, Follower, and Observer
This page explains that only the Leader can write metadata. Followers and Observers are designed to synchronize logs and serve reads. It specifically notes that Observers are used to "increase query concurrency."
* Source: StarRocks Architecture - FE Roles
_ _Key Section:* The table comparing Leader, Follower, and Observer roles.
3. Internal Query Forwarding
While StarRocks can forward requests internally, the documentation mentions that certain commands and metadata writes must reach the leader. The forward_to_leader variable documentation highlights that while "users can connect to any FE," specific detailed information and operations are leader-centric.
* Source: System Variables - forward_to_leader
_ _Key Section:* Describes which commands are affected by leader-forwarding and why the leader node is unique.
4. High Availability & Scaling
The cluster planning guide explains why you should use Observers for high-concurrency read environments rather than just adding more Followers.
* Source: Plan StarRocks Cluster - FE Node Count
_ _Key Section:* Explains that Observers do not participate in elections (Raft quorum), so they scale reads without adding overhead to the Leader’s metadata synchronization.
5. Troubleshooting & Timeouts
The FAQ explains why a "smart" proxy is better for managing connection limits and idle timeouts, which a standard TCP LB often struggles with.
* Source: Operation and Maintenance FAQ - Connection Limits
_ _Key Section:* Recommends checking ProxySQL and adjusting wait_timeout to manage FE resources effectively.
Summary of Links
Topic | Documentation Link
How to configure ProxySQL | [Load Balance Guide](https://docs.starrocks.io/docs/administration/management/resource_management/Load_balance)
Why use Observers for reads | [Architecture - FE](https://docs.starrocks.io/docs/introduction/Architecture/#fe)
Leader vs. Follower duties | [Cluster Planning](https://docs.starrocks.io/docs/deployment/plan_cluster/#fe-node-count)
Internal Forwarding details | [System Variables](https://docs.starrocks.io/docs/sql-reference/System_variable/#forward_to_leader)
References
• administration/management/resource_management/Load_balance.md
• best_practices/overview.md
• best_practices/audit_log_resource_group.md
• knowledge/usage/best-practice.md
• best_practices/table_clustering.md
• faq/Deploy_faq.mdRocky
05/07/2026, 9:03 AMFrancisco Silva
05/07/2026, 10:24 AMRocky
05/07/2026, 10:24 AMSELECT traffic without affecting the stability of the metadata (Raft) group.
Recommended Production Pattern
Component | Count | Why?
Follower FEs | 3 | Provides High Availability (HA) while keeping metadata replication fast.
Leader | (1 of the 3) | Automatically elected from the 3 Followers.
Observer FEs | 0 to N | Add these only if your read volume exceeds what the 3 Followers can handle.
Summary for ProxySQL
In your ProxySQL setup:
* Hostgroup 1 (Leader): You would dynamically point this to whichever of the 3 Followers is currently the Leader.
* Hostgroup 2 (Reads): You would put the other 2 Followers AND all Observers here. This ensures that the heavy lifting of queries is spread across all nodes that aren't currently busy managing the cluster.
Source References:
* Plan StarRocks Cluster - FE Node Count: "In production, we recommend you deploy at least THREE Follower FE nodes... If your application generates highly concurrent query requests, you can add Observer FE nodes."
* StarRocks Architecture - FE Roles: Explains the Raft consensus mechanism and why Observers are used for scaling.
References
• deployment/plan_cluster.md
• faq/operation_maintenance_faq.md
• deployment/deploy_manually.md
• administration/Meta_recovery.mdFrancisco Silva
05/07/2026, 10:25 AMRocky
05/07/2026, 10:26 AMSELECT queries.
Sources:
* Plan StarRocks cluster - FE node count
* StarRocks Architecture - FE
References
• deployment/plan_cluster.md
• faq/Deploy_faq.md
• faq/operation_maintenance_faq.md
• deployment/deploy_manually.mdFrancisco Silva
05/07/2026, 10:32 AMRocky
05/07/2026, 10:32 AMenable_query_queue_v2 to prevent the cluster from being overwhelmed. If too many queries arrive at once, StarRocks will queue them instead of letting them all run and crash the system due to Out-Of-Memory (OOM) errors.
* Pipeline DOP (pipeline_dop): For high concurrency, you often lower the pipeline_dop (Degree of Parallelism). Instead of one query using all 32 cores on a BE to finish in 10ms, you might set it to use 4 cores so that 8 queries can run at the same time.
* Resource Groups: You can create specific resource groups for "High Concurrency Apps" and set a concurrency_limit to ensure that one "noisy neighbor" application doesn't starve the rest of the cluster.
3. Caching (The "Secret Weapon" for Concurrency)
If your high concurrency involves many similar or identical queries (e.g., a dashboard being refreshed by 1,000 users), StarRocks provides:
* Result Cache: Stores the final result of a query. If the exact same SQL is sent again and the data hasn't changed, StarRocks returns the result instantly without hitting the BEs.
* Query Cache: Caches intermediate results at the multi-node level.
Summary Checklist for High Concurrency:
Component | Action
Frontend | Use 3 Followers + N Observers behind ProxySQL.
Concurrency Control | Enable Query Queues and set Resource Group limits.
Query Tuning | Lower pipeline_dop (e.g., set to 8 or 4) to increase throughput.
Optimization | Enable Result Cache (set global enable_query_result_cache = true).
Sources:
* Query Queues & Concurrency Management
* Resource Group Best Practices
* FE Configuration - Query Engine
References
• deployment/plan_cluster.md
• faq/operation_maintenance_faq.md
• administration/management/resource_management/query_queues.md
• faq/Sql_faq.md
• best_practices/audit_log_resource_group.md
• administration/management/FE_configuration.md
• administration/management/resource_management/Query_management.md
• faq/Others.mdRocky
05/07/2026, 10:32 AMFrancisco Silva
05/07/2026, 10:32 AMRocky
05/07/2026, 10:33 AMSHOW PROC '/frontends', and updates the hostgroups if the Leader has moved.
2. The BE Architecture (Data Reliability)
With 3 BE nodes, you can maintain the default 3-replica setting.
* Fault Tolerance: If one BE node fails, your data remains 100% available because the other two replicas are still online. StarRocks will also automatically start re-replicating data to return to a healthy state.
* Performance: For high concurrency, ensure your BEs have enough CPU. The 3-node BE setup is the minimum for production HA, but it’s the easiest part of the cluster to scale horizontally later.
3. ProxySQL Tuning for StarRocks
To get the most out of this setup for high concurrency:
* Connection Pooling: Use ProxySQL to maintain a pool of long-lived connections to the FEs. This prevents the "TCP handshake storm" when thousands of clients connect at once.
* Query Routing: Use ProxySQL rules to send SELECT statements to Hostgroup 2 and everything else (loads, DDL) to Hostgroup 1.
* Fast Failover: Set mysql-monitor_cnt_log_failures and related timeouts in ProxySQL to be aggressive so that if an FE node hangs, ProxySQL routes around it immediately.
One Small Caveat
In your 3-FE setup, all 3 are technically "Followers" in terms of their role in the Raft consensus (one just happens to be the elected Leader). If you later find that your query volume is making the cluster sluggish, don't add a 4th or 5th Follower. Instead, add Observers. Observers will join the cluster and help with queries without adding any burden to the Raft voting process.
Summary of your setup:
* FEs: 3 (HA protected, quorum of 2).
* BEs: 3 (Data protected, 3 replicas).
* ProxySQL: Entry point for load balancing and failover.
Does this align with your hardware availability, or are you looking for the specific ProxySQL health-check script logic?
References
• deployment/plan_cluster.md
• faq/Deploy_faq.md
• administration/management/resource_management/Load_balance.md
• faq/operation_maintenance_faq.md
• deployment/deploy_manually.md
References
• faq/Deploy_faq.md
• deployment/plan_cluster.md
• faq/Others.md
• faq/operation_maintenance_faq.mdFrancisco Silva
05/07/2026, 10:33 AMSHOW PROC '/frontends', and updates the hostgroups if the Leader has moved.
is that the defined setup? there should be an easier way to achieve that
@RockyRocky
05/07/2026, 10:34 AMforward_to_leader
The easiest way is to let StarRocks handle the routing internally.
* The Concept: You treat all 3 FEs (1 Leader + 2 Followers) as identical in ProxySQL. Put them all in a single hostgroup and load balance them equally.
* The Trick: Enable the system variable forward_to_leader = true.
* How it works: When a client sends a write request (like an INSERT or DDL) to a Follower node, that node will automatically forward the request to the Leader on your behalf.
* Pros: No complex ProxySQL scripts; extreme simplicity.
* Cons: Very slight network hop latency (milliseconds) for write requests, but for 99% of workloads, this is unnoticeable.
2. The Infrastructure Way: HTTP Health Checks
If you prefer to keep the Leader and Followers separate in your load balancer (to ensure writes always hit the Leader directly), you can use a Standard Load Balancer (like AWS NLB, HAProxy, or Nginx) with an HTTP health check.
Every FE runs an HTTP server (default port 8030). You can use the /api/bootstrap or /metrics endpoints, or even simpler:
* Port 9030 (MySQL) check: Simply checks if the FE is alive.
* The "Leader Only" trick: You can set up your Load Balancer to check the output of a specific internal status.
3. The JDBC Way (If you use Java/Python)
If your application uses the MySQL JDBC driver, you don't even need ProxySQL for basic HA. You can use a "Loadbalance" connection string:
sql
jdbc:mysql:<loadbalance://fe1:9030,fe2:9030,fe3:9030/mydb>
The driver itself will handle the failover and load balancing between the nodes you provide.
Why people still use the ProxySQL Script?
The reason the "Pro Tip" exists is for automatic role recovery. If the Leader dies and a new Follower is promoted, the script updates ProxySQL so that your "Write" traffic moves to the new Leader instantly without a single manual change.
My Recommendation for you:
Start with Option 1 (forward_to_leader = true). It is the "defined" way to handle multi-FE setups without building a complex management layer.
1. Put all 3 FEs in one ProxySQL hostgroup.
2. Run SET GLOBAL forward_to_leader = true; in StarRocks.
3. Focus your energy on your queries and data!
References
• administration/management/resource_management/Load_balance.md
• sql-reference/System_variable.md
• faq/operation_maintenance_faq.md
• deployment/plan_cluster.md
References
• deployment/deploy_manually.md
• faq/operation_maintenance_faq.md
• administration/management/FE_configuration.md
• administration/http_interface.mdFrancisco Silva
05/07/2026, 3:10 PMRocky
05/07/2026, 3:11 PMNode-A defeats the purpose of High Availability (HA).
2. Why the contradiction in setup?
The "Static" part of the guide is for Bootstrap/Initial Connectivity:
* You start Node 1 as the first Leader.
* You start Nodes 2 and 3 using --helper Node1.
* From that point forward, they are all peers. If Node 1 reboots, Node 2 will become Leader. When Node 1 comes back, it joins as a Follower. This is normal and healthy.
3. How to handle this with ProxySQL?
This is where the two strategies come in:
* Strategy A: The "Smart" Proxy (The Script Way)
* Setup: ProxySQL identifies which of the 3 Followers is currently the Leader.
* Benefit: Direct writes. No internal "forwarding" hop.
* Recommendation: Use this only if you have extreme write-concurrency requirements where every millisecond of latency counts.
* Strategy B: The "Simple" Proxy (Recommended for 90% of users)
* Setup: Put all 3 FEs into a single ProxySQL pool. Set forward_to_leader = true in StarRocks.
* Benefit: Zero maintenance. If the Leader moves from FE-1 to FE-2, ProxySQL doesn't care—it just sends the request to any FE, and StarRocks handles the internal routing.
* Recommendation: Start here. It is the official operational standard for maintaining HA without complex scripting.
Summary Checklist
1. Don't force the Leader. Let Raft do its job.
2. Configuration: Define 3 nodes as FOLLOWER roles.
3. Connectivity: Use ProxySQL to point to all 3.
4. Forwarding: Enable SET GLOBAL forward_to_leader = true; to ensure metadata commands (like SHOW BACKENDS) work regardless of which FE you hit.
Does that clear up the "Static vs Dynamic" conflict for you?
References
• deployment/deploy_manually.md
• faq/operation_maintenance_faq.md
• sql-reference/System_variable.md
• administration/Meta_recovery.md
• administration/management/FE_configuration.md
References
• deployment/deploy_manually.md
• administration/Meta_recovery.md
• sql-reference/System_variable.mdFrancisco Silva
05/07/2026, 3:45 PMRocky
05/07/2026, 3:46 PM--helper flag.
2. Maintenance: Running ALTER SYSTEM ADD/DROP commands, which must be executed against the Leader.
Here is the best-practice approach for dynamic determination within an Ansible playbook:
1. The SQL Method (Recommended)
This is the most universal method. You can query any alive FE node to find out who the current Leader is.
Ansible Logic:
Use the community.mysql.mysql_query module (or a shell command with mysql -e) to parse the output of SHOW FRONTENDS.
yaml
- name: Get current StarRocks FE Leader
community.mysql.mysql_query:
login_db: information_schema
query: "SELECT IP FROM information_schema.fe_metrics WHERE LABELS LIKE '%is_leader=\"true\"%'" # Only for v3.5+
# OR the universal way:
# query: "SHOW FRONTENDS"
register: fe_status
delegate_to: "{{ groups['fe_nodes'][0] }}" # Run this on the first FE in your inventory
- name: Set Leader Fact
set_fact:
current_leader_ip: "{{ fe_status.query_result[0] | selectattr('Role', 'equalto', 'LEADER') | map(attribute='IP') | first }}"
2. The HTTP Metrics Method (Best for "No-DB" Checks)
Starting from StarRocks v3.5, FE metrics include an is_leader label. This is excellent for Ansible because you can use uri or curl without needing a MySQL client installed on the Ansible controller.
Command:
bash
curl -s http://<any_fe_ip>:8030/metrics | grep 'is_leader="true"'
Ansible Task:
yaml
- name: Determine Leader via Metrics API
uri:
url: "http://{{ item }}:8030/metrics"
return_content: yes
loop: "{{ groups['fe_nodes'] }}"
register: metrics_results
until: "'is_leader=\"true\"' in item.content"
retries: 3
delay: 2
- name: Identify the Leader IP
set_fact:
fe_leader_ip: "{{ item.item }}"
when: "'is_leader=\"true\"' in item.content"
loop: "{{ metrics_results.results }}"
3. The "Bootstrap" Recommendation (Initial vs. Successive)
For the very first deployment (Initial Bootstrap), your logic should be:
* Initial Run: Designate fe_nodes[0] as the Leader. Start it without --helper.
* Subsequent FEs: Start them with --helper {{ fe_nodes[0] }}:9010.
Ansible Playbook Pattern:
yaml
- name: Start FE Node
shell: >
./bin/start_fe.sh --daemon
{% if inventory_hostname != groups['fe_nodes'][0] %}
--helper {{ hostvars[groups['fe_nodes'][0]]['ansible_host'] }}:9010
{% endif %}
when: not fe_meta_directory_exists # Only use --helper if it's the first time starting
Rocky's Operational Pro-Tip for Ansible:
Don't get caught in a "chicken and egg" loop.
* For the First Start: Hardcode the first node in your inventory as the initial helper.
* For Cluster Updates: Use the SQL Method to query the actual current leader. In a Raft cluster, the leader can change; your playbook should always "ask" the cluster who the leader is before trying to add a new BE or FE node.
Summary:
* New Cluster: Use the first node in your [fe_nodes] inventory group.
* Scaling/Health Checks: Use SHOW FRONTENDS or the /metrics API (v3.5+) to dynamically find the Role: LEADER.
References
• sql-reference/information_schema/fe_metrics.md
• sql-reference/sql-statements/cluster-management/nodes_processes/SHOW_FRONTENDS.md
• deployment/deploy_manually.md
• administration/management/monitoring/metrics.md
• administration/http_interface.md
ReferencesFrancisco Silva
05/07/2026, 3:48 PMRocky
05/07/2026, 3:48 PMALTER SYSTEM ADD.
Here is the best way to dynamically determine which nodes are already registered:
1. The Recommended SQL Queries
You should use the SHOW commands because they are the authoritative source of truth for the cluster metadata.
* To check Frontends: SHOW FRONTENDS;
* To check Backends: SHOW BACKENDS;
* To check Compute Nodes: SHOW COMPUTE NODES;
Operational Tip: As noted in the StarRocks FAQ, always use SHOW BACKENDS instead of SHOW PROC '/backends' for automation, as SHOW BACKENDS is guaranteed to be routed to the Leader and contains the most up-to-date registration info.
──────────
2. Implementation in Ansible
You can use the community.mysql.mysql_query module to capture the list of registered IPs and then use a conditional when statement to skip the registration step if the node already exists.
Example: Dynamically Adding a Backend (BE)
yaml
- name: Get list of registered Backend IPs
community.mysql.mysql_query:
login_user: root
login_host: "{{ fe_leader_ip }}"
login_port: 9030
query: "SHOW BACKENDS"
register: registered_backends
- name: Register BE node if not already in cluster
community.mysql.mysql_query:
login_user: root
login_host: "{{ fe_leader_ip }}"
query: "ALTER SYSTEM ADD BACKEND '{{ inventory_hostname }}:9050'"
when: inventory_hostname not in (registered_backends.query_result[0] | map(attribute='IP') | list)
──────────
3. "The No-SQL Way" (Using HTTP API)
If you don't want to rely on the MySQL client within Ansible, you can parse the FE's internal /proc information via the HTTP interface (port 8030).
Command:
curl -u root:password http://<FE_IP>:8030/api/bootstrap
This returns a JSON blob containing the cluster's current membership, which is very easy for Ansible to parse using the uri module and json_query.
──────────
4. Summary Table for Automation
Objective | Command | Key Field for Check
Check FE exists | SHOW FRONTENDS | IP
Find FE Leader | SHOW FRONTENDS | Role == 'LEADER'
Check BE exists | SHOW BACKENDS | IP
Check BE Health | SHOW BACKENDS | Alive == 'true'
Rocky's Best Practice:
1. Always query the Leader: When checking registration, point your Ansible task to the current Leader FE.
2. Use IPs, not Hostnames: While StarRocks supports hostnames, using IPs in your registration logic is more robust for network-level troubleshooting in Ansible.
3. Handle the "Dead but Registered" state: Sometimes a node is registered but Alive is false. Your playbook should distinguish between "Needs Registration" (node is missing from SHOW BACKENDS) and "Needs Service Start" (node exists but Alive is false).
References
• sql-reference/sql-statements/cluster-management/nodes_processes/SHOW_FRONTENDS.md
• sql-reference/sql-statements/cluster-management/nodes_processes/SHOW_BACKENDS.md
• faq/operation_maintenance_faq.md
• deployment/deploy_manually.md
• administration/management/BE_blacklist.md
References
• sql-reference/information_schema/information_schema.md
• sql-reference/sql-statements/cluster-management/nodes_processes/SHOW_FRONTENDS.mdRocky
05/07/2026, 3:48 PMFrancisco Silva
05/07/2026, 3:54 PMFrancisco Silva
05/07/2026, 3:54 PMRocky
05/07/2026, 3:54 PM/api/bootstrap endpoint is an internal legacy endpoint primarily used for basic health/version reporting and doesn't contain the full cluster membership list.
For your Ansible automation, there are two much better HTTP-based ways to get the registered nodes in a clean JSON format:
1. The Modern Way: HTTP SQL API (Recommended for v3.2+)
If you are on StarRocks 3.2 or later, you should use the HTTP SQL API. This allows you to run any SHOW command and receive a structured JSON response that is very easy for Ansible to parse.
Endpoint: POST /api/v1/catalogs/default_catalog/sql
Ansible Task Example:
yaml
- name: Get registered backends via HTTP SQL API
uri:
url: "http://{{ fe_host }}:8030/api/v1/catalogs/default_catalog/sql"
method: POST
user: root
password: "{{ mysql_root_password }}"
force_basic_auth: yes
body_format: json
body:
query: "SHOW BACKENDS;"
return_content: yes
register: be_list_response
- name: Extract registered IP list
set_fact:
registered_ips: "{{ be_list_response.json.data | map(attribute=1) | list }}"
# Note: attribute=1 corresponds to the 'IP' column in the SHOW BACKENDS output
2. The Legacy Way: /api/show_proc
If you are on an older version or prefer a more direct path, you can use the /api/show_proc endpoint. This maps directly to the SHOW PROC command tree.
* Frontends: GET http://<FE_IP>:8030/api/show_proc?path=/frontends
* Backends: GET http://<FE_IP>:8030/api/show_proc?path=/backends
Output Format:
This returns a JSON object containing a columns array and a rows array.
json
{
"msg": "success",
"code": 0,
"data": {
"columns": ["BackendId", "IP", ...],
"rows": [
["10001", "192.168.1.10", ...],
["10002", "192.168.1.11", ...]
]
}
}
Why was your /api/bootstrap empty?
The output you saw ("replayedJournalId":0, etc.) usually happens when:
1. The FE is not the Leader: Followers often report zeroed-out values for certain metadata metrics because they aren't the primary source of truth.
2. The node hasn't joined the cluster: If you hit an FE that was started but hasn't successfully joined a BDBJE group yet, it won't have any cluster information to report.
Rocky’s Automation Tip:
In your Ansible playbook, always target the current Leader (using the metrics grep method I mentioned earlier) when checking registration. If you query a Follower that is out of sync, you might get stale data and try to register the node a second time, which will result in an error.
Summary for Ansible:
Use the HTTP SQL API with SHOW BACKENDS if possible—it’s the most robust way to get exactly the same data as the MySQL client but in a native JSON format for your playbook.
References
• administration/http_interface.md
• sql-reference/sql-statements/cluster-management/nodes_processes/SHOW_PROC.md
• administration/management/monitoring/metrics.md
• deployment/deploy_manually.md
• sql-reference/sql-statements/cluster-management/nodes_processes/SHOW_BACKENDS.md
References
• sql-reference/sql-statements/cluster-management/nodes_processes/SHOW_PROC.md
• administration/http_interface.mdRocky
05/07/2026, 3:54 PMRocky
05/07/2026, 3:54 PM/api/bootstrap endpoint is an internal-use API often seen in logs, but it is not part of the officially documented public HTTP interface.
For automation like Ansible, the "official" and most robust way to get node information via HTTP (starting from StarRocks v3.2) is the HTTP SQL API.
The Documented Way: HTTP SQL API (v3.2+)
StarRocks provides a dedicated endpoint to run SQL commands via HTTP. This is much cleaner for Ansible because it returns structured JSON.
Endpoint: POST /api/v1/sql
Ansible Task to get Backends:
yaml
- name: Get registered backends via HTTP SQL API
uri:
url: "http://{{ fe_host }}:8030/api/v1/sql"
method: POST
user: root
password: "{{ mysql_root_password }}"
force_basic_auth: yes
body_format: json
body:
sql: "SHOW BACKENDS"
return_content: yes
register: be_list_response
- name: Extract Backend IPs
set_fact:
registered_be_ips: "{{ be_list_response.json.data | map(attribute=1) | list }}"
# Note: In the JSON response, 'data' is a list of lists.
# Index 1 usually corresponds to the 'IP' column in SHOW BACKENDS.
The "Legacy" Documented Way: /api/show_proc
If you are on a version older than 3.2, you can use the documented show_proc endpoint, which mimics the SHOW PROC SQL command.
Endpoint: GET /api/show_proc?path=/backends
* Frontends: GET /api/show_proc?path=/frontends
* Backends: GET /api/show_proc?path=/backends
Why these are better for Ansible:
1. No MySQL Client: You don't need mysql-client or the community.mysql collection installed on your Ansible runner or target nodes.
2. Native JSON: The uri module handles the JSON parsing automatically, making it easy to use when: inventory_hostname not in registered_be_ips logic.
Summary of Documentation Links:
* *HTTP SQL API*: The modern way to run SHOW, SELECT, etc.
* *HTTP Interface*: Lists /api/show_proc and /metrics.
Operational Note: If you use the HTTP SQL API, make sure your Ansible fe_host is pointing to an FE that is currently up. If you point it to a Follower, it will still work as long as forward_to_leader is true (which is the default).
References
• administration/http_interface.md
• sql-reference/sql-statements/cluster-management/nodes_processes/SHOW_COMPUTE_NODES.mdFrancisco Silva
05/07/2026, 3:55 PMRocky
05/07/2026, 3:55 PM"StarRocks v3.2.0 introduces the HTTP SQL API for users to perform various types of queries using HTTP. Currently, this API supports SELECT, SHOW, EXPLAIN, and KILL statements."This is considered the "modern" way because, unlike the older
/api/show_proc or /api/bootstrap endpoints, it:
* Returns structured JSON (Newline Delimited JSON).
* Allows you to run standard SQL (like SHOW BACKENDS) which is more powerful than fixed-path API calls.
* Is a first-class, versioned API (/api/v1/sql).
2. The Operational Authoritative Source (FAQ)
While not labeled "new," the *Operation and Maintenance FAQ* explains why using SQL commands (which the new HTTP SQL API enables) is superior to the old "proc" paths:
Question: What is the difference betweenandSHOW PROC '/backends'?SHOW BACKENDS
Answer:Why this matters for your Ansible automation: Before v3.2, if you wanted to avoid a MySQL client in Ansible, you had to useretrieve metadata from the current FE and may lag. WhileSHOW PROC '/backends'retrieve metadata from the Leader FE and is authoritative.SHOW BACKENDS
GET /api/show_proc?path=/backends. However, that endpoint could return stale data if the FE you hit was lagging.
By using the HTTP SQL API (v3.2+) to run SHOW BACKENDS, StarRocks ensures the request is authoritative (routed to/validated by the Leader), making your automation much more reliable.
Summary of the transition:
* Old/Internal way: /api/show_proc?path=... (Inconsistent, text-heavy output).
* New/Standard way: /api/v1/sql (Standard SQL, structured JSON, introduced in v3.2).
References
• sql-reference/http_sql_api.md
• sql-reference/sql-statements/cluster-management/nodes_processes/SHOW_PROC.md
• faq/operation_maintenance_faq.mdFrancisco Silva
05/07/2026, 3:56 PMRocky
05/07/2026, 3:56 PM*"*StarRocks v3.2.0 introduces the HTTP SQL API* for users to perform various types of queries using HTTP. Currently, this API supports SELECT, SHOW, EXPLAIN, and KILL statements."*This is considered the "modern" way because: 1. Authoritative: Unlike older
GET /api/show_proc endpoints (which can return stale data if hitting a non-leader node), the SQL API follows standard SQL routing and is guaranteed to reflect the cluster state accurately.
2. Structured JSON: It returns Newline Delimited JSON, which is significantly easier to parse in automation scripts compared to the plain text tables returned by older internal APIs.
3. Standardized: It is part of the v1 versioned API, whereas older endpoints like /api/bootstrap or /api/show_proc are internal legacy endpoints.
Correct Ansible Usage (Fixed Syntax)
Based on the documentation, you must specify at least the catalog (usually default_catalog) in the URL path. Here is the corrected logic for your automation:
yaml
- name: Get registered backends via HTTP SQL API
uri:
url: "http://{{ fe_host }}:8030/api/v1/catalogs/default_catalog/sql"
method: POST
user: root
password: "{{ mysql_root_password }}"
force_basic_auth: yes
body_format: json
body:
# Note: The API expects the field name "query"
query: "SHOW BACKENDS"
return_content: yes
register: be_list_response
- name: Extract Backend IPs
set_fact:
registered_be_ips: "{{ be_list_response.content.split('\n') | map('from_json') | selectattr('data', 'defined') | map(attribute='data') | list }}"
Summary of Differences
Feature | Older show_proc API | New HTTP SQL API (v3.2+)
URL | /api/show_proc?path=/backends | /api/v1/catalogs/default_catalog/sql
Format | Text/HTML-like | Newline Delimited JSON
Consistency | May lag on followers | Authoritative/Consistent
Flexibility | Fixed paths only | Any SHOW or SELECT command
References
• sql-reference/http_sql_api.md
• administration/http_interface.md
• faq/operation_maintenance_faq.md
References
• sql-reference/http_sql_api.md
• administration/http_interface/query_detail.md
• administration/http_interface.mdFrancisco Silva
05/07/2026, 3:56 PMRocky
05/07/2026, 3:57 PM/api/show_proc, /api/bootstrap, or /api/query) that StarRocks used before version 3.2.
The HTTP SQL API (/api/v1/sql), introduced in v3.2, is the modern, public-facing replacement. Here are the primary advantages of using the SQL API:
1. Structured JSON (vs. Plain Text/HTML)
* Normal API: Endpoints like show_proc often return plain text tables or unstructured data that is difficult for scripts (like Ansible or Python) to parse reliably.
* SQL API: Returns Newline Delimited JSON (NDJSON). Every row is a valid JSON object. This makes it trivial to parse using jq, Python’s json module, or Ansible’s from_json filter.
2. Streaming Performance (Low Memory)
* Normal API: Older endpoints often buffer the entire result in FE memory before sending it to you.
* SQL API: Uses HTTP chunked transfer encoding to stream results row-by-row. The client can start processing data immediately without waiting for the whole set, significantly reducing memory overhead for both the FE and your application.
3. Full SQL Power
* Normal API: You are limited to specific "paths" (e.g., ?path=/backends). If there isn't a pre-defined path for the info you want, the API can't help you.
* SQL API: You can run any SELECT, SHOW, EXPLAIN, or KILL command. You can join tables, filter results with WHERE, or sort them with ORDER BY directly in the HTTP request.
4. Authoritativeness & Consistency
* Normal API: Legacy metadata endpoints sometimes retrieve data from the local memory of the FE you connected to. If that FE is a Follower and is lagging, you might get stale information.
* SQL API: Statements like SHOW BACKENDS or SHOW FRONTENDS follow the standard SQL execution path, ensuring the request is authoritative (validated against the Leader FE) and consistent with the cluster state.
5. Session Variable Support
* Normal API: Legacy GET requests are "stateless" and don't allow you to tune the execution environment.
* SQL API: You can pass a sessionVariables object in the JSON body. This allows you to set things like query_timeout, parallel_fragment_exec_instance_num, or exec_mem_limit specifically for that one HTTP request.
6. Metadata Inclusion
* The SQL API response includes a meta object that explicitly defines the column names and data types (e.g., int, varchar, decimal). Legacy APIs often just return strings, leaving the client to guess the data type.
Summary Comparison Table
Feature | Legacy/Normal API | HTTP SQL API (v3.2+)
Response Format | Text, HTML, or simple JSON | NDJSON (Newline Delimited JSON)
Logic | Path-based (e.g., /api/show_proc) | Standard SQL (e.g., SHOW...)
Flexibility | Rigid / Fixed outputs | High (Full SQL query support)
Parsing | Difficult (Regex/Text splitting) | Easy (Native JSON parsing)
Efficiency | Buffers total result | Streams row-by-row
Session Control | None | Supported via sessionVariables
Which one should you use?
If you are on StarRocks v3.2 or newer, you should always prefer the HTTP SQL API for automation and monitoring. The legacy endpoints are largely kept for backward compatibility and internal UI usage.
References
• sql-reference/http_sql_api.md
• administration/http_interface.md
• faq/operation_maintenance_faq.md
References
• sql-reference/http_sql_api.md
• administration/http_interface.mdFrancisco Silva
05/07/2026, 4:04 PMRocky
05/07/2026, 4:04 PM/api/show_proc, /api/bootstrap, etc.) are not officially "Deprecated" in the sense that they have been marked for removal in a specific upcoming version. They are still functional and present in the documentation.
However, the HTTP SQL API (/api/v1/sql) is documented as the standard, modern interface for users starting from v3.2.0.
Here is the nuance of why it is called the "New Way" versus the "Normal" way:
1. "Internal" vs. "Public" Interface
Many of the endpoints listed in the HTTP Interface (like /api/show_proc) are actually internal administrative endpoints. They were originally designed for the StarRocks internal web UI or for FE-to-FE communication.
* The Old Way: You are essentially "peeking" into internal StarRocks processes. These return raw text or unformatted data that can change without notice between versions.
* The New Way (HTTP SQL API): This is a versioned API (/v1/). By putting it under /v1/, StarRocks is committing to a stable, public interface for developers and automation tools.
2. The v3.2.0 "What's New" Statement
The documentation for the HTTP SQL API introduces it specifically to solve the limitations of the older methods:
"StarRocks v3.2.0 introduces the HTTP SQL API for users to perform various types of queries using HTTP."The "advantage" isn't just that it's new—it's that it replaces the need to find specific, obscure internal API paths for every task. Instead of learning 20 different endpoints, you just use one endpoint and send standard SQL. 3. Consistency vs. Stale Data This is the most critical technical reason the SQL API is preferred over the "Normal" metadata APIs: * Normal API (
/api/show_proc): If you send a GET request to a Follower FE, it might return data from that FE's local memory. If the FE is lagging, the data is stale.
* SQL API (/api/v1/sql): When you run a command like SHOW BACKENDS via this API, it is treated like a real SQL query. It is routed to the Leader FE (or validated against it), ensuring the result is authoritative and accurate.
Summary
* Is the Normal API deprecated? No. It still works and is used by the internal system.
* Is the SQL API the "New Way"? Yes. It is the officially recommended path for user-facing automation, monitoring, and application integration because it is versioned, authoritative, and returns structured JSON.
If you are writing new Ansible playbooks or scripts, the SQL API is the correct choice to ensure your automation doesn't break during future StarRocks upgrades.
References
• administration/http_interface/query_detail.md
• administration/http_interface.md
• sql-reference/sql-statements/cluster-management/nodes_processes/SHOW_PROC.mdFrancisco Silva
05/07/2026, 4:05 PM/api/v1/sql) is documented as the standard, modern interface for users starting from v3.2.0." - where is this stated exactly?Rocky
05/07/2026, 4:06 PM"StarRocks v3.2.0 introduces the HTTP SQL API for users to perform various types of queries using HTTP."2. Versioned API vs. Internal Endpoints The SQL API uses the path prefix
/api/v1/. In software architecture, moving from unversioned paths (like /api/show_proc or /api/bootstrap) to a versioned /v1/ path is the industry definition of moving to a standardized, public-facing API.
3. The "Enhanced Usability" Highlight
In the StarRocks 3.2 Release Notes, the HTTP SQL API is explicitly listed under the "Highlights" and "Enhanced Usability" sections.
The documentation positions it as the superior choice because:
* Structured Output: It is the only general-purpose API that returns Newline Delimited JSON (NDJSON). Older APIs return raw text that requires fragile regex/string splitting to parse.
* Streaming: It uses HTTP chunked transfer encoding, which the docs note "eliminates the need for data caching and the need to wait for the entire data, reducing memory consumption for the client."
* SQL Completeness: Unlike legacy "path-based" APIs (which are hard-coded to return specific info), this API allows you to run any SELECT or SHOW statement.
Summary of where to find this:
* Introduction date/version: HTTP SQL API Page - First Paragraph
* Status as a Major 3.2 Highlight: v3.2.0 Release Notes
* Comparison of benefits (JSON/Streaming): Response Message Section of the SQL API Doc
So while the docs use terms like "Introduces," "Usability," and "v1," I used "standard/modern" to summarize the transition from the older, internal GET-style endpoints to this versioned, JSON-first POST-style interface.
References
• sql-reference/http_sql_api.md
• administration/http_interface/query_detail.md
• administration/http_interface.mdFrancisco Silva
05/12/2026, 11:58 AMRocky
05/12/2026, 11:58 AMSIMPLE_MAJORITY.
* `master_sync_policy`: Controls how the Leader flushes logs to disk.
* `bdbje_replica_ack_timeout_second`: The timeout for the Leader to wait for ACKs from followers.
* Metadata Recovery: This section provides technical details on how to handle scenarios where the BDB JE consensus group fails or metadata becomes desynchronized.
Summary Table: Metadata Roles & Consensus
Role | Participates in Election? | Can Write Metadata? | Consistency Mechanism
Leader | Yes | Yes | Propagates logs to majority
Follower | Yes | No (Forwards to Leader) | Replays logs from Leader
Observer | No | No (Forwards to Leader) | Replays logs from Leader
*Note: While some older documentation may occasionally use the term "Raft" colloquially, the underlying technical implementation in StarRocks for metadata is the Paxos-based replication provided by BDB JE.*
References
• introduction/Architecture.md
• administration/Meta_recovery.md
• administration/management/FE_configuration.mdFrancisco Silva
05/12/2026, 12:00 PMRocky
05/12/2026, 12:00 PMreplica_ack_policy parameter is the official statement on how writes are committed to the cluster:
replica_ack_policy
* Default:SIMPLE_MAJORITY
* Description: The policy based on which a log entry is considered valid. The default valueThis is the technical definition of a consensus-based write. It ensures that metadata is not "committed" unless a quorum of nodes has acknowledged the write. 2. Leader Election and Quorum The StarRocks Architecture page describes the "Consensus" group (though it calls it an election group) and the requirement for a majority for the cluster to function:specifies that a log entry is considered valid if a majority of follower FEs return ACK messages.SIMPLE_MAJORITY
"The Leader FE is elected from the Follower FEs... If more than half of the Follower FEs fail, the FE cluster will no longer have a Leader and the entire StarRocks cluster will become unavailable for metadata-modifying operations."3. The Underlying Protocol (BDB JE) The documentation for Metadata Recovery and various FAQs identify BDB JE (Berkeley DB Java Edition) as the engine. BDB JE uses a replication protocol that implements the Paxos consensus algorithm to ensure consistency across the Leader and Followers. While you may see community posts or external articles refer to it as "Raft-like," the official StarRocks docs technically describe the BDB JE Replication Group and the Simple Majority ACK Policy. Summary of Documentation Sources: * For the "Majority ACK" requirement: See FE Configuration - `replica_ack_policy`. * For the "Election/Quorum" requirement: See Architecture - FE section. * For the "Sync/Consistency" policy: See FE Configuration - `master_sync_policy`. References • introduction/Architecture.md • administration/management/FE_configuration.md • administration/Meta_recovery.md • faq/operation_maintenance_faq.md -faq) _maintenance_faq) References • faq/operation_maintenance_faq.md • administration/Meta_recovery.md • administration/management/FE_configuration.md
Francisco Silva
05/12/2026, 12:01 PMRocky
05/12/2026, 12:02 PMreplica_ack_policy.
* Keyword: SIMPLE_MAJORITY
* Quote: *"The default value SIMPLE_MAJORITY specifies that a log entry is considered valid if a majority of follower FEs return ACK messages."*
* Context: This confirms that metadata is not committed to the cluster unless a majority of nodes agree (the definition of a consensus write).
2. Leader Election and Quorum
The StarRocks Architecture page (under the FE section) explains the "quorum" requirement for the cluster to even allow metadata writes:
* Keywords: Leader, Follower, fail
* Quote: "If more than half of the Follower FEs fail, the FE cluster will no longer have a Leader and the entire StarRocks cluster will become unavailable for metadata-modifying operations."
* Context: This establishes that metadata writes are tied to a "majority-alive" requirement.
3. The Implementation (BDB JE)
The documentation for Metadata Recovery mentions the underlying technology:
* Keyword: BDBJE (Berkeley DB Java Edition)
* Context: StarRocks uses the replication feature of BDB JE. While the docs don't always use the word "consensus" in every paragraph, BDB JE's replication is based on the Paxos algorithm. The recovery docs mention scenarios where "Follower nodes cannot perform Leader election due to bugs of BDBJE," which is the mechanism that maintains the "consensus" of the metadata.
Why "Consensus" might be hard to find as a keyword:
In StarRocks docs, "Consensus" is often discussed in the context of Data Replication (for StarRocks v3.x shared-data or primary key tables) rather than just metadata. For metadata specifically, the docs focus on the Leader/Follower roles and the Edit Log (Journal) synchronization.
If you are looking for a deep dive into the "Metadata Consensus" theory, it is typically referred to in the community and codebase as the Journaling or Edit Log system.
References
• administration/management/FE_configuration.md
• introduction/Architecture.md
• administration/Meta_recovery.md
• administration/management/resource_management/Replica.md
References
• administration/management/FE_configuration.md
• administration/Meta_recovery.md