Doris on K8s
以下以doris2.0.3版本为例。
·
镜像准备
由于国内拉不到docker官方镜像,以下镜像均为香港服务器中转后把官方镜像转的阿里私仓。
K8s部署
注意 storageClassName为之前配置的nfs
imagePullSecrets 是集群配置的私仓
doris_fe.yaml
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
apiVersion: v1
kind: Service
metadata:
name: doris-follower-cluster1
labels:
app: doris-follower-cluster1
spec:
ports:
- port: 8030
name: http-port
- port: 9020
name: rpc-port
- port: 9030
name: query-port
- port: 9010
name: edit-log-port #This name should be fixed. Doris will get the port information through this name
clusterIP: None
selector:
app: doris-follower-cluster1
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: doris-follower-cluster1
labels:
app: doris-follower-cluster1
spec:
selector:
matchLabels:
app: doris-follower-cluster1
serviceName: doris-follower-cluster1
replicas: 3
template:
metadata:
name: doris-follower-cluster1
labels:
app: doris-follower-cluster1
spec:
containers:
- name: doris-follower-cluster1
#Need to change to real mirror information
image: registry.cn-shanghai.aliyuncs.com/luckydata/doris_fe:v2.0.3
imagePullPolicy: IfNotPresent
env:
#Specify the startup type as k8s to bypass some restrictions of the official image initialization script
- name: BUILD_TYPE
value: "k8s"
#Initialize the fe of three nodes
- name: FE_INIT_NUMBER
value: "3"
#ServiceName of bakend_cn node,(if do not have bakend_cn node,do not configure this environment variable)
- name: CN_SERVICE
value: "doris-cn-cluster1"
#StatefulSetName of bakend_cn node,(if do not have bakend_cn node,do not configure this environment variable)
- name: CN_STATEFULSET
value: "doris-cn-cluster1"
#ServiceName of bakend node,(if do not have bakend node,do not configure this environment variable)
- name: BE_SERVICE
value: "doris-be-cluster1"
#StatefulSetName of bakend node,(if do not have bakend node,do not configure this environment variable)
- name: BE_STATEFULSET
value: "doris-be-cluster1"
#ServiceName of follower node,(if do not have follower node,do not configure this environment variable)
- name: FE_SERVICE
value: "doris-follower-cluster1"
##StatefulSetName of follower node,(if do not have follower node,do not configure this environment variable)
- name: FE_STATEFULSET
value: "doris-follower-cluster1"
ports:
- containerPort: 8030
name: http-port
- containerPort: 9020
name: rpc-port
- containerPort: 9030
name: query-port
- containerPort: 9010
name: edit-log-port
volumeMounts:
#Mount the configuration file in the way of configmap
- name: conf
mountPath: /data/doris/fe/conf
#In order to call the api of k8s
- name: doris-fe-meta
mountPath: /data/doris/fe/doris-meta
- name: kube
mountPath: /root/.kube/config
readOnly: true
imagePullSecrets:
- name: ali
volumes:
- name: conf
configMap:
name: follower-conf
- name: kube
hostPath:
path: /root/.kube/config
volumeClaimTemplates:
- metadata:
name: doris-fe-meta
spec:
accessModes: [ "ReadWriteMany" ]
storageClassName: nfs03
resources:
requests:
storage: 50Gi
---
apiVersion: v1
kind: ConfigMap
metadata:
name: follower-conf
data:
fe.conf: |
#priority_networks = 172.16.0.0/24
#It can automatically maintain node information by getting the number of replicas of StatefulSet, similar to alter system add/drop back
enable_deploy_manager = k8s
#Automatically adjust the IP of the node according to the domain name (for example, after the pod is restarted, the domain name is still doris-be-cluster1-0-doris-be-cluster1.default.svc.cluster.local, but the IP may change from 172.16.0.9 to 172.16.0.10)
enable_fqdn_mode = true
LOG_DIR = ${DORIS_HOME}/log
sys_log_level = WARN
http_port = 8030
rpc_port = 9020
query_port = 9030
edit_log_port = 9010
#Doris needs to generate the log4j configuration file according to the fe.yml configuration information, which is written in the same directory as fe.yml by default, but the config we mount is readonly, so specify this configuration to write the log4j file to another location
custom_config_dir = /data/doris/
#when set to false, the backend will not be dropped and remaining in DECOMMISSION state
drop_backend_after_decommission = false
doris_be.yaml
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
apiVersion: v1
kind: Service
metadata:
name: doris-be-cluster1
labels:
app: doris-be-cluster1
spec:
ports:
- port: 9060
name: be-port
- port: 8040
name: webserver-port
- port: 9050
name: heartbeat-port #This name should be fixed. Doris will get the port information through this name
- port: 8060
name: brpc-port
clusterIP: None
selector:
app: doris-be-cluster1
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: doris-be-cluster1
labels:
app: doris-be-cluster1
spec:
selector:
matchLabels:
app: doris-be-cluster1
serviceName: doris-be-cluster1
replicas: 3
template:
metadata:
name: doris-be-cluster1
labels:
app: doris-be-cluster1
spec:
containers:
- name: doris-be-cluster1
#Need to change to real mirror information
image: registry.cn-shanghai.aliyuncs.com/luckydata/doris_be:v2.0.3
imagePullPolicy: IfNotPresent
env:
#Specify the startup type as k8s to bypass some restrictions of the official image initialization script
- name: BUILD_TYPE
value: "k8s"
ports:
- containerPort: 9060
name: be-port
- containerPort: 8040
name: webserver-port
- containerPort: 9050
name: heartbeat-port
- containerPort: 8060
name: brpc-port
volumeMounts:
#Mount the configuration file in the way of configmap
- name: conf
mountPath: /data/doris/be/conf
#Ifnot mounted, when enable_profile, error will be reported when querying the data from jdbc catalog
#Error message: error setting certificate verify locations: CAfile:/etc/pki/tls/certs/ca-bundle.crt CApath: none
- name: sys
mountPath: /etc/pki
readOnly: true
- name: doris-be-meta
mountPath: /data/doris/be/storage
imagePullSecrets:
- name: ali
volumes:
- name: conf
configMap:
name: be-conf
- name: sys
hostPath:
path: /etc/pki
volumeClaimTemplates:
- metadata:
name: doris-be-meta
spec:
accessModes: [ "ReadWriteMany" ]
storageClassName: nfs04
resources:
requests:
storage: 300Gi
---
apiVersion: v1
kind: ConfigMap
metadata:
name: be-conf
data:
be.conf: |
PPROF_TMPDIR="$DORIS_HOME/log/"
sys_log_level = WARN
be_port = 9060
webserver_port = 8040
heartbeat_service_port = 9050
brpc_port = 8060
命令执行
kubectl apply -f doris_fe.yaml -n <namespace>
kubectl apply -f doris_be.yaml -n <namespace>
外部连接
通过外部连接,分配外部局域网ip(类似bgp),并开发所需的8030和9030端口,后续可通过外部ip直连fe
注意点
如果服务起不来,注意查看nfs是否连通,确保自动建立的nfs存储的存储类不为空
如果数据库的root账户设置密码后,需要添加be的环境变量
更多推荐
已为社区贡献2条内容
所有评论(0)