From 5463ba6267ae9eeec8628dad16809e77795105cf Mon Sep 17 00:00:00 2001
From: zhangdong <493738387@qq.com>
Date: Sun, 26 Mar 2023 22:04:21 +0800
Subject: [PATCH] [doc](fqdn)fqdn and k8s doc (#17318)
---
.../admin-manual/cluster-management/fqdn.md | 82 +++++++++++++++++
.../install/construct-docker/k8s-deploy.md | 89 +++++++++++++++++++
docs/sidebars.json | 6 +-
.../admin-manual/cluster-management/fqdn.md | 83 +++++++++++++++++
.../install/construct-docker/k8s-deploy.md | 89 +++++++++++++++++++
5 files changed, 347 insertions(+), 2 deletions(-)
create mode 100644 docs/en/docs/admin-manual/cluster-management/fqdn.md
create mode 100644 docs/en/docs/install/construct-docker/k8s-deploy.md
create mode 100644 docs/zh-CN/docs/admin-manual/cluster-management/fqdn.md
create mode 100644 docs/zh-CN/docs/install/construct-docker/k8s-deploy.md
diff --git a/docs/en/docs/admin-manual/cluster-management/fqdn.md b/docs/en/docs/admin-manual/cluster-management/fqdn.md
new file mode 100644
index 0000000000..cbd8e19be5
--- /dev/null
+++ b/docs/en/docs/admin-manual/cluster-management/fqdn.md
@@ -0,0 +1,82 @@
+---
+{
+"title": "FQDN",
+"language": "en"
+}
+---
+
+
+
+# FQDN
+
+## Concept Introduction
+
+
+
+A fully qualified domain name (FQDN) is the full domain name of a specific computer or host on the Internet.
+
+After Doris supports FQDN, you can directly specify the domain name when adding various types of nodes. For example, the command to add a be node is `ALTER SYSTEM ADD BACKEND "be_host:heartbeat_service_port`,
+
+"Be_host" was previously the IP address of the be node. After starting the FQDN, be_ The host should specify the domain name of the be node.
+
+## Preconditions
+
+1. fe.conf file set `enable_fqdn_mode = true`
+2. The fe node can resolve the domain names of all nodes in Doris
+
+## Best Practices
+
+### Deployment of Doris for K8S
+
+After an accidental restart of a pod, the K8S cannot ensure that the pod's IP address does not change, but it can ensure that the domain name remains unchanged. Based on this feature, when Doris starts fqdn, it can ensure that the pod can still provide services normally after an accidental restart.
+For the method of deploying Doris on the K8S, please refer to [K8s Deployment Doris](../../install/construct-docker/k8s-deploy.md)
+
+### Server switching network card
+
+For example, a server with a be node has two network cards with corresponding IPs of 192.192.192.2 and 10.10.10.3. Currently, the network card corresponding to 192.192.192.2 is used, and the following steps can be followed:
+
+1. Add a line '192.192.192.2 be1' to the 'etc/hosts' file of the machine where fe is located_ fqdn`
+2. Change be.conf File ` priority_ Networks=192.192.192.2 ` and start be
+3. Connect and execute the sql command ` ALTER SYSTEM ADD BACKEND "be1_fqdn: 9050`
+
+When switching to the network card corresponding to 10.10.10.3 in the future, the following steps can be followed:
+
+1. Configure '192.192.192.2 be1' for 'etc/hosts'_ Fqdn 'is changed to' 10.10.10.3 be1_ fqdn`
+
+### Legacy Cluster Enable FQDN
+
+Prerequisite: The current program supports the 'ALTER SYSTEM MODIFY FRONT ":" HOSTNAME "" syntax,
+If not, you need to upgrade to a version that supports this syntax
+
+Next, follow the steps below:
+
+1. Perform the following operations on the follower and observer nodes one by one (finally, operate the master node):
+
+ 1. Stop the node
+ 2. Check if the node is stopped. Execute 'show frontends' on the MySQL client to view the Alive status of the FE node until it becomes false
+ 3. Set FQDN for node: `ALTER SYSTEM MODIFY FRONTEND ":" HOSTNAME ""`
+ 4. Modify the node configuration. Modify the 'conf/fe. conf' file in the FE root directory and add the configuration: 'enable'_ fqdn_ mode = true`
+ 5. Start the node.
+
+2. To enable FQDN for a BE node, you only need to execute the following commands through MYSQL, and there is no need to restart the BE.
+
+ `ALTER SYSTEM MODIFY BACKEND ":" HOSTNAME ""`
+
+
diff --git a/docs/en/docs/install/construct-docker/k8s-deploy.md b/docs/en/docs/install/construct-docker/k8s-deploy.md
new file mode 100644
index 0000000000..29ac9f1dc5
--- /dev/null
+++ b/docs/en/docs/install/construct-docker/k8s-deploy.md
@@ -0,0 +1,89 @@
+---
+{
+"title": "K8s Deployment Doris",
+"language": "en"
+}
+---
+
+
+
+# K8s Deployment Doris
+
+
+
+## Environmental Preparation
+
+- Installation k8s
+- Build or download a Doris image
+ - Building an image [Doris Docker Quickly build a development environment](./docker-dev)
+ - Download Image https://hub.docker.com/r/apache/doris/tags
+- Create or download the yml file for Doris on k8s
+ - https://github.com/apache/doris/blob/master/docker/runtime/k8s/doris_follower.yml
+ - https://github.com/apache/doris/blob/master/docker/runtime/k8s/doris_be.yml
+ - https://github.com/apache/doris/blob/master/docker/runtime/k8s/doris_cn.yml
+
+## Starting a cluster
+Start FE (role type is Follower):`kubectl create -f doris_follower.yml`
+
+Start BE:`kubectl create -f doris_be.yml`
+
+Start the BE (role type is Compute Node):`kubectl create -f doris_cn.yml`
+
+## Expansion and contraction capacity
+
+- FE
+ - Currently, scaling is not supported. It is recommended to initialize 1 or 3 nodes as needed
+- BE
+ - Command:`kubectl scale statefulset doris-be-cluster1 --replicas=4`
+- BE (role type is Compute Node)
+ - Command:`kubectl scale statefulset doris-cn-cluster1 --replicas=4`
+
+## test and verify
+
+Connect to the FE using mysql-client and perform operations such as' show backends' and 'show frontends' to view the status of each node
+
+## K8s simple operation command
+
+- Executing the yml file for the first time `kubectl create -f xxx.yml`
+- Execute after modifying the yml file `kubectl apply -f xxx.yml`
+- Delete all resources defined by yml `kubectl delete -f xxx.yml`
+- View the pod list `kubectl get pods`
+- Entering the container `kubectl exec -it xxx(podName) -- /bin/sh`
+- view log `kubectl logs xxx(podName)`
+- View IP and port information `kubectl get ep`
+- [More knowledge of k8s](https://kubernetes.io)
+
+## common problem
+
+- How is data persistent?
+
+ Users need to mount PVC on their own to persist metadata information, data information, or log information
+- How to safely shrink the BE node?
+
+ BE:User manual execution is required before current resizing[ALTER-SYSTEM-DECOMMISSION-BACKEND](../../docs/sql-manual/sql-reference/Cluster-Management-Statements/ALTER-SYSTEM-DECOMMISSION-BACKEND.md)
+
+ BE(The role type is Compute Node): Do not store data files and can directly shrink,[About Computing Nodes](../../docs/advanced/compute_node.md)
+- FE startup error "failed to init statefulSetName"
+
+ doris_ The environment variables statefulSetName and serviceName for follower. yml must appear in pairs, such as CN configured_ SERVICE, CN must be configured_ STATEFULSET
+
+
+
+
diff --git a/docs/sidebars.json b/docs/sidebars.json
index 79d4f2b415..e3ca898d28 100644
--- a/docs/sidebars.json
+++ b/docs/sidebars.json
@@ -35,7 +35,8 @@
"label": "Construct Docker",
"items": [
"install/construct-docker/construct-docker-image",
- "install/construct-docker/run-docker-cluster"
+ "install/construct-docker/run-docker-cluster",
+ "install/construct-docker/k8s-deploy"
]
}
]
@@ -1025,7 +1026,8 @@
"items": [
"admin-manual/cluster-management/upgrade",
"admin-manual/cluster-management/elastic-expansion",
- "admin-manual/cluster-management/load-balancing"
+ "admin-manual/cluster-management/load-balancing",
+ "admin-manual/cluster-management/fqdn"
]
},
{
diff --git a/docs/zh-CN/docs/admin-manual/cluster-management/fqdn.md b/docs/zh-CN/docs/admin-manual/cluster-management/fqdn.md
new file mode 100644
index 0000000000..b95c8b0291
--- /dev/null
+++ b/docs/zh-CN/docs/admin-manual/cluster-management/fqdn.md
@@ -0,0 +1,83 @@
+---
+{
+"title": "FQDN",
+"language": "zh-CN"
+}
+---
+
+
+
+# FQDN
+
+## 概念介绍
+
+
+
+完全限定域名fully qualified domain name(FQDN)是internet上特定计算机或主机的完整域名。
+
+Doris支持FQDN之后,添加各类节点时可以直接指定域名,例如添加be节点的命令为`ALTER SYSTEM ADD BACKEND "be_host:heartbeat_service_port`,
+
+"be_host"此前是be节点的ip,启动FQDN后,be_host应指定be节点的域名。
+
+## 前置条件
+
+1. fe.conf 文件 设置 `enable_fqdn_mode = true`
+2. fe节点都能解析出doris所有节点的域名
+
+## 最佳实践
+
+### k8s部署doris
+
+pod意外重启后,k8s不能保证pod的ip不发生变化,但是能保证域名不变,基于这一特性,doris开启fqdn时,能保证pod意外重启后,还能正常提供服务。
+
+k8s部署doris的方法请参考[K8s部署doris](../../install/construct-docker/k8s-deploy.md)
+
+### 服务器切换网卡
+
+例如有一个be节点的服务器有两个网卡,对应的ip分别为192.192.192.2和10.10.10.3,目前用192.192.192.2对应的网卡,可以按照下述步骤操作:
+
+1. 在fe所在机器的`etc/hosts`文件增加一行 `192.192.192.2 be1_fqdn`
+2. 更改be.conf文件`priority_networks = 192.192.192.2`并启动be
+3. 连接执行sql命令 `ALTER SYSTEM ADD BACKEND "be1_fqdn:9050`
+
+将来需要切换到10.10.10.3对应的网卡时,可以按照下述步骤操作:
+
+1. 把`etc/hosts`配置的`192.192.192.2 be1_fqdn` 改为 `10.10.10.3 be1_fqdn`
+
+### 旧集群启用FQDN
+
+前提条件:当前程序支持`ALTER SYSTEM MODIFY FRONTEND ":" HOSTNAME ""`语法,
+如果不支持,需要升级到支持该语法的版本
+
+接下来按照如下步骤操作:
+
+1. 逐一对follower、observer节点进行以下操作(最后操作master节点):
+
+ 1. 停止节点。
+ 2. 检查节点是否停止。通过 MySQL 客户端执行`show frontends`,查看该 FE 节点的 Alive 状态直至变为 false
+ 3. 为节点设置FQDN: `ALTER SYSTEM MODIFY FRONTEND ":" HOSTNAME ""`
+ 4. 修改节点配置。修改FE根目录中的`conf/fe.conf`文件,添加配置:`enable_fqdn_mode = true`
+ 5. 启动节点。
+
+2. BE节点启用FQDN只需要通过MYSQL执行以下命令,不需要对BE执行重启操作。
+
+ `ALTER SYSTEM MODIFY BACKEND ":" HOSTNAME ""`
+
+
diff --git a/docs/zh-CN/docs/install/construct-docker/k8s-deploy.md b/docs/zh-CN/docs/install/construct-docker/k8s-deploy.md
new file mode 100644
index 0000000000..f482784e40
--- /dev/null
+++ b/docs/zh-CN/docs/install/construct-docker/k8s-deploy.md
@@ -0,0 +1,89 @@
+---
+{
+"title": "K8s部署doris",
+"language": "zh-CN"
+}
+---
+
+
+
+# K8s部署doris
+
+
+
+## 环境准备
+
+- 安装 k8s
+- 构建或下载doris镜像
+ - 构建镜像 [Doris Docker 快速搭建开发环境](./docker-dev)
+ - 下载镜像 https://hub.docker.com/r/apache/doris/tags
+- 创建或下载doris on k8s的yml文件
+ - https://github.com/apache/doris/blob/master/docker/runtime/k8s/doris_follower.yml
+ - https://github.com/apache/doris/blob/master/docker/runtime/k8s/doris_be.yml
+ - https://github.com/apache/doris/blob/master/docker/runtime/k8s/doris_cn.yml
+
+## 启动集群
+启动 FE(角色类型为 Follower):`kubectl create -f doris_follower.yml`
+
+启动 BE :`kubectl create -f doris_be.yml`
+
+启动 BE(角色类型为 Compute Node):`kubectl create -f doris_cn.yml`
+
+## 扩缩容
+
+- FE
+ - 目前不支持扩缩容,建议按需初始化1个或者3个节点
+- BE
+ - 命令:`kubectl scale statefulset doris-be-cluster1 --replicas=4`
+- BE(角色类型为 Compute Node)
+ - 命令:`kubectl scale statefulset doris-cn-cluster1 --replicas=4`
+
+## 验证
+
+使用 mysql-client 连接到 FE,执行 `show backends`,`show frontends`等操作查看各节点状态
+
+## k8s简易操作命令
+
+- 首次执行yml文件 `kubectl create -f xxx.yml`
+- 修改yml文件后执行 `kubectl apply -f xxx.yml`
+- 删除yml定义的所有资源 `kubectl delete -f xxx.yml`
+- 查看pod列表 `kubectl get pods`
+- 进入容器 `kubectl exec -it xxx(podName) -- /bin/sh`
+- 查看日志 `kubectl logs xxx(podName)`
+- 查看ip和端口信息 `kubectl get ep`
+- [更多k8s知识](https://kubernetes.io)
+
+## 常见问题
+
+- 数据怎么持久化?
+
+ 用户需要自行挂载pvc,持久化元数据信息,数据信息或者日志信息等
+- 怎么安全缩容BE节点?
+
+ BE:当前缩容之前需要用户手动执行[ALTER-SYSTEM-DECOMMISSION-BACKEND](../../docs/sql-manual/sql-reference/Cluster-Management-Statements/ALTER-SYSTEM-DECOMMISSION-BACKEND.md)
+
+ BE(角色类型为 Compute Node): 不存储数据文件,可以直接进行缩容,[关于计算节点](../../docs/advanced/compute_node.md)
+- FE启动报错"failed to init statefulSetName"
+
+ doris_follower.yml的环境变量 statefulSetName和serviceName必须成对出现,比如配置了CN_SERVICE,就必须配置CN_STATEFULSET
+
+
+
+