Skip to content

Commit

Permalink
Docs/add examples (#270)
Browse files Browse the repository at this point in the history
Signed-off-by: yandongxiao <[email protected]>
  • Loading branch information
yandongxiao authored Sep 25, 2023
1 parent 125f47f commit 5378b53
Show file tree
Hide file tree
Showing 15 changed files with 595 additions and 126 deletions.
11 changes: 11 additions & 0 deletions examples/starrocks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
This document explains how to deploy a StarRocks cluster using the Operator. Users can take these examples as
references, and tailor them as necessary to fit the requirement. It primarily covers:

1. [Deploying a very simple StarRocks cluster](./deploy_a_starrocks_cluster_with_no_ha.yaml)
2. [Deploying a HA StarRocks cluster](./deploy_a_ha_starrocks_cluster.yaml)
3. [Deploying a StarRocks cluster with the CN component](./deploy_a_starrocks_cluster_with_cn.yaml)
4. [Deploying a StarRocks cluster with custom configurations](./deploy_a_starrocks_cluster_with_custom_configurations.yaml)
5. [Deploying a StarRocks cluster with persistent storage](./deploy_a_starrocks_cluster_with_persistent_storage.yaml)
6. [Deploying a StarRocks cluster running in shared_data mode](./deploy_a_starrocks_cluster_with_share_data_mode.yaml)
7. [Deploying a StarRocks cluster with the FE Proxy component](./deploy_a_starrocks_cluster_with_fe_proxy.yaml)
8. [Deploying a StarRocks cluster with all the above features](./deploy_a_starrocks_cluster_with_all_features.yaml)
9 changes: 0 additions & 9 deletions examples/starrocks/cn-config.yaml

This file was deleted.

30 changes: 30 additions & 0 deletions examples/starrocks/deploy_a_ha_starrocks_cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This manifest deploys a high-available StarRocks cluster with 3 FE pods and 3 BE pods.
# A high-available StarRocks cluster requires at least THREE FE pods in the StarRocks cluster. One of them is the
# leader, and the other two are the followers.
# the number of BEs required depends on the default `replication_num` which is `3` by default.
# StarRocks cluster.
# The requests and limits of FE and BE are set based on https://docs.starrocks.io/en-us/latest/deployment/plan_cluster

apiVersion: starrocks.com/v1
kind: StarRocksCluster
metadata:
name: a-ha-starrocks # change the name if needed.
spec:
starRocksFeSpec:
image: starrocks/fe-ubuntu:latest
replicas: 3 # at least 3 FE pods
limits:
cpu: 8
memory: 16Gi
requests:
cpu: 8
memory: 16Gi
starRocksBeSpec:
image: starrocks/be-ubuntu:latest
replicas: 3 # at least 3 BE pods
limits:
cpu: 16
memory: 64Gi
requests:
cpu: 16
memory: 64Gi
174 changes: 174 additions & 0 deletions examples/starrocks/deploy_a_starrocks_cluster_with_all_features.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
# This manifest deploys a StarRocks cluster with all supported features.
# If you want to understand the meaning of the fields in the following custom resource, please
# refer to the explanations in other examples.

apiVersion: starrocks.com/v1
kind: StarRocksCluster
metadata:
name: a-starrocks-with-all-features # change the name if needed.
spec:
starRocksFeSpec:
image: starrocks/fe-ubuntu:latest
replicas: 3
limits:
cpu: 8
memory: 16Gi
requests:
cpu: 8
memory: 16Gi
configMapInfo:
configMapName: starrockscluster-sample-fe-cm
resolveKey: fe.conf
storageVolumes:
- name: fe-storage-meta
storageClassName: "" # you can remove this line if you want to use the default storage class
storageSize: 10Gi # the size of storage volume for metadata
mountPath: /opt/starrocks/fe/meta # the path of metadata
- name: fe-storage-log
storageClassName: "" # you can remove this line if you want to use the default storage class
storageSize: 1Gi # the size of storage volume for log
mountPath: /opt/starrocks/fe/log # the path of log
starRocksBeSpec:
image: starrocks/be-ubuntu:latest
replicas: 3
limits:
cpu: 16
memory: 64Gi
requests:
cpu: 16
memory: 64Gi
configMapInfo:
configMapName: starrockscluster-sample-be-cm
resolveKey: be.conf
storageVolumes:
- name: be-storage-data
storageClassName: "" # you can remove this line if you want to use the default storage class
storageSize: 10Gi # the size of storage volume for data
mountPath: /opt/starrocks/be/storage # the path of data
- name: be-storage-log
storageClassName: "" # you can remove this line if you want to use the default storage class
storageSize: 1Gi # the size of storage volume for log
mountPath: /opt/starrocks/be/log # the path of log
starRocksFeProxySpec:
replicas: 1
limits:
cpu: 1
memory: 2Gi
requests:
cpu: 1
memory: 2Gi
service:
type: NodePort # export fe proxy service
ports:
- containerPort: 8080
name: http-port
nodePort: 30180 # The range of valid ports is 30000-32767
port: 8080
resolver: "kube-dns.kube-system.svc.cluster.local" # this is the default dns server.
starRocksCnSpec:
image: starrocks/cn-ubuntu:latest
# replicas: 1 # comment out this line if autoScalingPolicy is enabled.
limits:
cpu: 16
memory: 64Gi
requests:
cpu: 16
memory: 64Gi
configMapInfo:
configMapName: starrockscluster-sample-cn-cm
resolveKey: cn.conf
storageVolumes:
- name: cn-storage-data
storageClassName: "" # you can remove this line if you want to use the default storage class
storageSize: 10Gi # the size of storage volume for data
mountPath: /opt/starrocks/cn/storage # the path of data
- name: cn-storage-log
storageClassName: "" # you can remove this line if you want to use the default storage class
storageSize: 1Gi # the size of storage volume for log
mountPath: /opt/starrocks/cn/log # the path of log
autoScalingPolicy: # comment out this section if replicas is set.
maxReplicas: 10
minReplicas: 1
# operator creates an HPA resource based on the following field.
# see https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/ for more information.
hpaPolicy:
metrics:
- type: Resource
resource:
name: memory
target:
averageUtilization: 60
type: Utilization
- type: Resource
resource:
name: cpu
target:
averageUtilization: 60
type: Utilization
behavior:
scaleUp:
policies:
- type: Pods
value: 1
periodSeconds: 10
scaleDown:
selectPolicy: Disabled

---

# fe config
apiVersion: v1
kind: ConfigMap
metadata:
name: starrockscluster-sample-fe-cm
labels:
cluster: starrockscluster-sample
data:
fe.conf: |
LOG_DIR = ${STARROCKS_HOME}/log
DATE = "$(date +%Y%m%d-%H%M%S)"
JAVA_OPTS="-Dlog4j2.formatMsgNoLookups=true -Xmx8192m -XX:+UseMembar -XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=7 -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSClassUnloadingEnabled -XX:-CMSParallelRemarkEnabled -XX:CMSInitiatingOccupancyFraction=80 -XX:SoftRefLRUPolicyMSPerMB=0 -Xloggc:${LOG_DIR}/fe.gc.log.$DATE"
JAVA_OPTS_FOR_JDK_9="-Dlog4j2.formatMsgNoLookups=true -Xmx8192m -XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=7 -XX:+CMSClassUnloadingEnabled -XX:-CMSParallelRemarkEnabled -XX:CMSInitiatingOccupancyFraction=80 -XX:SoftRefLRUPolicyMSPerMB=0 -Xlog:gc*:${LOG_DIR}/fe.gc.log.$DATE:time"
JAVA_OPTS_FOR_JDK_11="-Dlog4j2.formatMsgNoLookups=true -Xmx8192m -XX:+UseG1GC -Xlog:gc*:${LOG_DIR}/fe.gc.log.$DATE:time"
http_port = 8030
rpc_port = 9020
query_port = 9030
edit_log_port = 9010
mysql_service_nio_enabled = true
sys_log_level = INFO
---

# be config
apiVersion: v1
kind: ConfigMap
metadata:
name: starrockscluster-sample-be-cm
labels:
cluster: starrockscluster-sample
data:
be.conf: |
be_port = 9060
webserver_port = 8040
heartbeat_service_port = 9050
brpc_port = 8060
sys_log_level = INFO
default_rowset_type = beta
---

# cn config
apiVersion: v1
kind: ConfigMap
metadata:
name: starrockscluster-sample-cn-cm
labels:
cluster: starrockscluster-sample
data:
cn.conf: |
sys_log_level = INFO
# ports for admin, web, heartbeat service
thrift_port = 9060
webserver_port = 8040
heartbeat_service_port = 9050
brpc_port = 8060
64 changes: 64 additions & 0 deletions examples/starrocks/deploy_a_starrocks_cluster_with_cn.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# This manifest deploys a StarRocks cluster with 3 FEs, 3 BEs, and CN with autoscaling enabled.
# CN nodes are optional components of StarRocks.
# You can increase the number of CN nodes to elastically scale compute resources without
# changing the data distribution in your StarRocks cluster.

apiVersion: starrocks.com/v1
kind: StarRocksCluster
metadata:
name: a-starrocks-with-cn # change the name if needed.
spec:
starRocksFeSpec:
image: starrocks/fe-ubuntu:latest
replicas: 3
limits:
cpu: 8
memory: 16Gi
requests:
cpu: 8
memory: 16Gi
starRocksBeSpec:
image: starrocks/be-ubuntu:latest
replicas: 3
limits:
cpu: 16
memory: 64Gi
requests:
cpu: 16
memory: 64Gi
starRocksCnSpec:
image: starrocks/cn-ubuntu:latest
# replicas: 1 # comment out this line if autoScalingPolicy is enabled.
limits:
cpu: 16
memory: 64Gi
requests:
cpu: 16
memory: 64Gi
autoScalingPolicy: # comment out this section if replicas is set.
maxReplicas: 10
minReplicas: 1
# operator creates an HPA resource based on the following field.
# see https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/ for more information.
hpaPolicy:
metrics:
- type: Resource
resource:
name: memory
target:
averageUtilization: 60
type: Utilization
- type: Resource
resource:
name: cpu
target:
averageUtilization: 60
type: Utilization
behavior:
scaleUp:
policies:
- type: Pods
value: 1
periodSeconds: 10
scaleDown:
selectPolicy: Disabled
Loading

0 comments on commit 5378b53

Please sign in to comment.