# StarRocks High Availability Cluster Deployment ## Overview This project uses StarRocks Kubernetes Operator to directly deploy a high availability StarRocks cluster. ## Component Architecture - **Frontend (FE)**: 3 replicas, responsible for metadata management and query coordination - **Backend (BE)**: 3 replicas, responsible for data storage and computation - **Compute Node (CN)**: 2 replicas, providing elastic computing capabilities ## File Description ### 1. ha-starrocks-cluster.yaml Main configuration file for the high availability StarRocks cluster, including: - Replica count and image configuration for FE, BE, CN components - Pod anti-affinity configuration to ensure high availability - Service configuration and environment variables ### 2. starrocks-configmaps.yaml Configuration files for each component: - **FE Configuration**: Logs, ports, JVM parameters, etc. - **BE Configuration**: Storage, ports, log levels, etc. - **CN Configuration**: Compute node ports and log configuration ### 3. ha-starrocks-values.yaml Helm values configuration file (for reference) ### 4. values.yaml Default Helm Chart configuration (for existing clusters) ### 5. vpa.yaml Vertical Pod Autoscaler configuration ## Deployment Steps ### 1. Apply Configuration ```bash # First apply ConfigMap configuration kubectl apply -f starrocks-configmaps.yaml # Then apply StarRocks cluster configuration kubectl apply -f ha-starrocks-cluster.yaml ``` ### 2. Check Deployment Status ```bash # Check StarRocks cluster status kubectl get starrockscluster -n freeleaps-data-platform # Check Pod status kubectl get pods -n freeleaps-data-platform -l app=starrocks # Check service status kubectl get svc -n freeleaps-data-platform -l app=starrocks ``` ### 3. View Logs ```bash # View FE logs kubectl logs -n freeleaps-data-platform -l app.kubernetes.io/component=fe # View BE logs kubectl logs -n freeleaps-data-platform -l app.kubernetes.io/component=be # View CN logs kubectl logs -n freeleaps-data-platform -l app.kubernetes.io/component=cn ``` ## High Availability Features - **FE High Availability**: 3 FE nodes with automatic failover support - **BE High Availability**: 3 BE nodes with data multi-replica storage - **CN Elasticity**: Support for horizontal scaling and automatic scaling - **Pod Anti-affinity**: Ensures components are distributed across different nodes - **Automatic Failover Recovery**: Operator automatically manages cluster state ## Network Configuration - **Internal Services**: Use ClusterIP type - **Port Mapping**: - FE: 8030(HTTP), 9010(Edit Log), 9020(RPC), 9030(Query) - BE: 8040(HTTP), 9050(Heartbeat), 8060(BRPC), 9060(BE Port) - CN: 8040(HTTP), 9050(Heartbeat), 8060(BRPC), 9060(Thrift) ## Storage Configuration - **FE Metadata**: Uses existing storage configuration - **BE Data**: Uses existing storage configuration - **CN Cache**: Uses existing storage configuration - **Data Persistence**: Supports automatic PVC creation and binding ## Monitoring and Operations - **Health Checks**: Built-in readiness and liveness probes - **Log Collection**: Structured log output - **Resource Monitoring**: Supports Prometheus metrics collection - **Automatic Scaling**: VPA supports vertical resource adjustment - **Operator Management**: Automatic cluster lifecycle management ## Upgrade and Rollback ```bash # Upgrade cluster configuration kubectl apply -f ha-starrocks-cluster.yaml # Rollback to previous version kubectl rollout undo deployment/starrocks-operator -n freeleaps-data-platform # View cluster status kubectl describe starrockscluster freeleaps-starrocks -n freeleaps-data-platform ``` ## Troubleshooting ```bash # Check cluster status kubectl describe starrockscluster freeleaps-starrocks -n freeleaps-data-platform # Check Pod events kubectl get events -n freeleaps-data-platform --sort-by='.lastTimestamp' # Check Operator logs kubectl logs -n freeleaps-data-platform -l app=starrocks-operator # Check storage status kubectl get pvc -n freeleaps-data-platform kubectl get pv ``` ## Important Notes 1. **Existing Cluster**: This configuration will upgrade the existing `freeleaps-starrocks` cluster 2. **Data Safety**: Data will not be lost during the upgrade process 3. **Rolling Updates**: Operator will automatically perform rolling updates to ensure service continuity 4. **Resource Requirements**: Ensure the cluster has sufficient resources to support the increased replica count