Add English version Doris website (#1729)
This commit is contained in:
14
docs/documentation/cn/index.rst
Normal file
14
docs/documentation/cn/index.rst
Normal file
@ -0,0 +1,14 @@
|
||||
=============
|
||||
中文
|
||||
=============
|
||||
|
||||
.. toctree::
|
||||
|
||||
administrator-guide/index
|
||||
community/index
|
||||
extending-doris/index
|
||||
getting-started/index
|
||||
installing/index
|
||||
internal/index
|
||||
sql-reference/index
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
=============
|
||||
操作手册
|
||||
=============
|
||||
========================
|
||||
Administrator Guide
|
||||
========================
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
=============
|
||||
数据导入
|
||||
Load Data
|
||||
=============
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
load-manual.md
|
||||
broker-load-manual.md
|
||||
stream-load-manual.md
|
||||
routine-load-manual.md
|
||||
insert-into-manual.md
|
||||
load-manual_EN.md
|
||||
broker-load-manual_EN.md
|
||||
stream-load-manual_EN.md
|
||||
routine-load-manual_EN.md
|
||||
insert-into-manual_EN.md
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
=============
|
||||
运维操作
|
||||
=============
|
||||
==========================
|
||||
Maintainence Operation
|
||||
==========================
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
@ -2,11 +2,11 @@
|
||||
|
||||
This document focuses on how to manage Doris metadata in a real production environment. It includes the proposed deployment of FE nodes, some commonly used operational methods, and common error resolution methods.
|
||||
|
||||
For the time being, read the [Doris metadata design document](../../internal/metadata-design.md) to understand how Doris metadata works.
|
||||
For the time being, read the [Doris metadata design document](../../internal/metadata-design_EN.md) to understand how Doris metadata works.
|
||||
|
||||
## Important tips
|
||||
|
||||
* Current metadata design is not backward compatible. That is, if the new version has a new metadata structure change (you can see whether there is a new VERSION in the `FeMetaVersion. java'file in the FE code), it is usually impossible to roll back to the old version after upgrading to the new version. Therefore, before upgrading FE, be sure to test metadata compatibility according to the operations in the [Upgrade Document](../../installing/upgrade. md).
|
||||
* Current metadata design is not backward compatible. That is, if the new version has a new metadata structure change (you can see whether there is a new VERSION in the `FeMetaVersion. java'file in the FE code), it is usually impossible to roll back to the old version after upgrading to the new version. Therefore, before upgrading FE, be sure to test metadata compatibility according to the operations in the [Upgrade Document](../../installing/upgrade_EN.md).
|
||||
|
||||
## Metadata catalog structure
|
||||
|
||||
@ -235,7 +235,7 @@ FE currently has the following ports
|
||||
|
||||
## Best Practices
|
||||
|
||||
The deployment recommendation of FE is described in the Installation and [Deployment Document](../../installing/install-deploy.md). Here are some supplements.
|
||||
The deployment recommendation of FE is described in the Installation and [Deployment Document](../../installing/install-deploy_EN.md). Here are some supplements.
|
||||
|
||||
* **If you don't know the operation logic of FE metadata very well, or you don't have enough experience in the operation and maintenance of FE metadata, we strongly recommend that only one FOLLOWER-type FE be deployed as MASTER in practice, and the other FEs are OBSERVER, which can reduce many complex operation and maintenance problems.** Don't worry too much about the failure of MASTER single point to write metadata. First, if you configure it properly, FE as a java process is very difficult to hang up. Secondly, if the MASTER disk is damaged (the probability is very low), we can also use the metadata on OBSERVER to recover manually through `fault recovery`.
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
===========
|
||||
Apache 社区
|
||||
===========
|
||||
===================
|
||||
Apache Commnity
|
||||
===================
|
||||
|
||||
.. toctree::
|
||||
:glob:
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
===========
|
||||
扩展功能
|
||||
===========
|
||||
====================
|
||||
Extending Ability
|
||||
====================
|
||||
|
||||
.. toctree::
|
||||
:glob:
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
=============
|
||||
开始使用
|
||||
=============
|
||||
====================
|
||||
Getting started
|
||||
====================
|
||||
|
||||
.. toctree::
|
||||
|
||||
basic-usage.md
|
||||
advance-usage.md
|
||||
best-practice.md
|
||||
data-partition.md
|
||||
data-model-rollup.md
|
||||
hit-the-rollup.md
|
||||
basic-usage_EN.md
|
||||
advance-usage_EN.md
|
||||
best-practice_EN.md
|
||||
data-partition_EN.md
|
||||
data-model-rollup_EN.md
|
||||
hit-the-rollup_EN.md
|
||||
|
||||
15
docs/documentation/en/index.rst
Normal file
15
docs/documentation/en/index.rst
Normal file
@ -0,0 +1,15 @@
|
||||
=============
|
||||
Engilsh
|
||||
=============
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
||||
administrator-guide/index
|
||||
community/index
|
||||
extending-doris/index
|
||||
getting-started/index
|
||||
installing/index
|
||||
internal/index
|
||||
sql-reference/index
|
||||
|
||||
@ -1,77 +0,0 @@
|
||||
# 编译
|
||||
|
||||
本文档主要介绍如何通过源码编译 Doris。
|
||||
|
||||
## 使用 Docker 开发镜像编译(推荐)
|
||||
|
||||
### 使用现成的镜像
|
||||
|
||||
1. 下载 Docker 镜像
|
||||
|
||||
`$ docker pull apachedoris/doris-dev:build-env`
|
||||
|
||||
检查镜像下载完成:
|
||||
|
||||
```
|
||||
$ docker images
|
||||
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||
apachedoris/doris-dev build-env f8bc5d4024e0 21 hours ago 3.28GB
|
||||
```
|
||||
|
||||
注: 针对不同的 Doris 版本,需要下载对应的镜像版本
|
||||
|
||||
| image version | commit id | release version |
|
||||
|---|---|---|
|
||||
| apachedoris/doris-dev:build-env | before [ff0dd0d](https://github.com/apache/incubator-doris/commit/ff0dd0d2daa588f18b6db56f947e813a56d8ec81) | 0.8.x, 0.9.x |
|
||||
| apachedoris/doris-dev:build-env-1.1 | [ff0dd0d](https://github.com/apache/incubator-doris/commit/ff0dd0d2daa588f18b6db56f947e813a56d8ec81) or later | 0.10.x or later |
|
||||
|
||||
2. 运行镜像
|
||||
|
||||
`$ docker run -it apachedoris/doris-dev:build-env`
|
||||
|
||||
如果你希望编译本地 Doris 源码,则可以挂载路径:
|
||||
|
||||
```
|
||||
$ docker run -it -v /your/local/incubator-doris-DORIS-x.x.x-release/:/root/incubator-doris-DORIS-x.x.x-release/ apachedoris/doris-dev:build-env
|
||||
```
|
||||
|
||||
3. 下载源码
|
||||
|
||||
启动镜像后,你应该已经处于容器内。可以通过以下命令下载 Doris 源码(已挂载本地源码目录则不用):
|
||||
|
||||
```
|
||||
$ wget https://dist.apache.org/repos/dist/dev/incubator/doris/xxx.tar.gz
|
||||
or
|
||||
$ git clone https://github.com/apache/incubator-doris.git
|
||||
```
|
||||
|
||||
4. 编译 Doris
|
||||
|
||||
```
|
||||
$ sh build.sh
|
||||
```
|
||||
|
||||
编译完成后,产出文件在 `output/` 目录中。
|
||||
|
||||
### 自行编译开发环境镜像
|
||||
|
||||
你也可以自己创建一个 Doris 开发环境镜像,具体可参阅 `docker/README.md` 文件。
|
||||
|
||||
|
||||
## 直接编译(CentOS/Ubuntu)
|
||||
|
||||
你可以在自己的 linux 环境中直接尝试编译 Doris。
|
||||
|
||||
1. 系统依赖
|
||||
|
||||
`GCC 5.3.1+, Oracle JDK 1.8+, Python 2.7+, Apache Maven 3.5+, CMake 3.4.3+`
|
||||
|
||||
安装完成后,自行设置环境变量 `PATH`, `JAVA_HOME` 等。
|
||||
|
||||
2. 编译 Doris
|
||||
|
||||
```
|
||||
$ sh build.sh
|
||||
```
|
||||
|
||||
编译完成后,产出文件在 `output/` 目录中。
|
||||
@ -1,9 +1,9 @@
|
||||
===========
|
||||
编译与部署
|
||||
===========
|
||||
===============================
|
||||
Compilation and deployment
|
||||
===============================
|
||||
|
||||
.. toctree::
|
||||
|
||||
compilation.md
|
||||
install-deploy.md
|
||||
upgrade.md
|
||||
compilation_EN.md
|
||||
install-deploy_EN.md
|
||||
upgrade_EN.md
|
||||
|
||||
@ -1,380 +0,0 @@
|
||||
# 安装与部署
|
||||
|
||||
该文档主要介绍了部署 Doris 所需软硬件环境、建议的部署方式、集群扩容缩容,以及集群搭建到运行过程中的常见问题。
|
||||
在阅读本文档前,请先根据编译文档编译 Doris。
|
||||
|
||||
## 软硬件需求
|
||||
|
||||
### 概述
|
||||
|
||||
Doris 作为一款开源的 MPP 架构 OLAP 数据库,能够运行在绝大多数主流的商用服务器上。为了能够充分运用 MPP 架构的并发优势,以及 Doris 的高可用特性,我们建议 Doris 的部署遵循以下需求:
|
||||
|
||||
#### Linux 操作系统版本需求
|
||||
|
||||
| Linux 系统 | 版本 |
|
||||
|---|---|
|
||||
| CentOS | 7.1 及以上 |
|
||||
| Ubuntu | 16.04 及以上 |
|
||||
|
||||
#### 软件需求
|
||||
|
||||
| 软件 | 版本 |
|
||||
|---|---|
|
||||
| Java | 1.8 及以上 |
|
||||
| GCC | 4.8.2 及以上 |
|
||||
|
||||
#### 开发测试环境
|
||||
|
||||
| 模块 | CPU | 内存 | 磁盘 | 网络 | 实例数量 |
|
||||
|---|---|---|---|---|---|
|
||||
| Frontend | 8核+ | 8GB+ | SSD 或 SATA,10GB+ * | 千兆网卡 | 1 |
|
||||
| Backend | 8核+ | 16GB+ | SSD 或 SATA,50GB+ * | 千兆网卡 | 1-3 * |
|
||||
|
||||
#### 生产环境
|
||||
|
||||
| 模块 | CPU | 内存 | 磁盘 | 网络 | 实例数量(最低要求) |
|
||||
|---|---|---|---|---|---|
|
||||
| Frontend | 16核+ | 64GB+ | SSD 或 RAID 卡,100GB+ * | 万兆网卡 | 1-5 * |
|
||||
| Backend | 16核+ | 64GB+ | SSD 或 SATA,100G+ * | 万兆网卡 | 10-100 * |
|
||||
|
||||
> 注1:
|
||||
> 1. FE 的磁盘空间主要用于存储元数据,包括日志和 image。通常从几百 MB 到几个 GB 不等。
|
||||
> 2. BE 的磁盘空间主要用于存放用户数据,总磁盘空间按用户总数据量 * 3(3副本)计算,然后再预留额外 40% 的空间用作后台 compaction 以及一些中间数据的存放。
|
||||
> 3. 一台机器上可以部署多个 BE 实例,但是**只能部署一个 FE**。如果需要 3 副本数据,那么至少需要 3 台机器各部署一个 BE 实例(而不是1台机器部署3个BE实例)。**多个FE所在服务器的时钟必须保持一致(允许最多5秒的时钟偏差)**
|
||||
> 4. 测试环境也可以仅适用一个 BE 进行测试。实际生产环境,BE 实例数量直接决定了整体查询延迟。
|
||||
> 5. 所有部署节点关闭 Swap。
|
||||
|
||||
> 注2:FE 节点的数量
|
||||
> 1. FE 角色分为 Follower 和 Observer,(Leader 为 Follower 组中选举出来的一种角色,以下统称 Follower,具体含义见 [元数据设计文档](../internal/metadata-design))。
|
||||
> 2. FE 节点数据至少为1(1 个 Follower)。当部署 1 个 Follower 和 1 个 Observer 时,可以实现读高可用。当部署 3 个 Follower 时,可以实现读写高可用(HA)。
|
||||
> 3. Follower 的数量**必须**为奇数,Observer 数量随意。
|
||||
> 4. 根据以往经验,当集群可用性要求很高是(比如提供在线业务),可以部署 3 个 Follower 和 1-3 个 Observer。如果是离线业务,建议部署 1 个 Follower 和 1-3 个 Observer。
|
||||
|
||||
* **通常我们建议 10 ~ 100 台左右的机器,来充分发挥 Doris 的性能(其中 3 台部署 FE(HA),剩余的部署 BE)**
|
||||
* **当然,Doris的性能与节点数量及配置正相关。在最少4台机器(一台 FE,三台 BE,其中一台 BE 混部一个 Observer FE 提供元数据备份),以及较低配置的情况下,依然可以平稳的运行 Doris。**
|
||||
* **如果 FE 和 BE 混部,需注意资源竞争问题,并保证元数据目录和数据目录分属不同磁盘。**
|
||||
|
||||
#### Broker 部署
|
||||
|
||||
Broker 是用于访问外部数据源(如 hdfs)的进程。通常,在每台机器上部署一个 broker 实例即可。
|
||||
|
||||
#### 网络需求
|
||||
|
||||
Doris 各个实例直接通过网络进行通讯。以下表格展示了所有需要的端口
|
||||
|
||||
| 实例名称 | 端口名称 | 默认端口 | 通讯方向 | 说明 |
|
||||
|---|---|---|---| ---|
|
||||
| BE | be_port | 9060 | FE --> BE | BE 上 thrift server 的端口,用于接收来自 FE 的请求 |
|
||||
| BE | be\_rpc_port | 9070 | BE <--> BE | BE 之间 rpc 使用的端口 |
|
||||
| BE | webserver_port | 8040 | BE <--> BE | BE 上的 http server 的端口 |
|
||||
| BE | heartbeat\_service_port | 9050 | FE --> BE | BE 上心跳服务端口(thrift),用户接收来自 FE 的心跳 |
|
||||
| BE | brpc\_port* | 8060 | FE<-->BE, BE <--> BE | BE 上的 brpc 端口,用于 BE 之间通讯 |
|
||||
| FE | http_port * | 8030 | FE <--> FE,用户 |FE 上的 http server 端口 |
|
||||
| FE | rpc_port | 9020 | BE --> FE, FE <--> FE | FE 上的 thrift server 端口 |
|
||||
| FE | query_port | 9030 | 用户 | FE 上的 mysql server 端口 |
|
||||
| FE | edit\_log_port | 9010 | FE <--> FE | FE 上的 bdbje 之间通信用的端口 |
|
||||
| Broker | broker\_ipc_port | 8000 | FE --> Broker, BE --> Broker | Broker 上的 thrift server,用于接收请求 |
|
||||
|
||||
> 注:
|
||||
> 1. 当部署多个 FE 实例时,要保证 FE 的 http\_port 配置相同。
|
||||
> 2. 部署前请确保各个端口在应有方向上的访问权限。
|
||||
> 3. brpc\_port 在 0.8.2 版本后替代了 be\_rpc_port
|
||||
|
||||
#### IP 绑定
|
||||
|
||||
因为有多网卡的存在,或因为安装过 docker 等环境导致的虚拟网卡的存在,同一个主机可能存在多个不同的 ip。当前 Doris 并不能自动识别可用 IP。所以当遇到部署主机上有多个 IP 时,必须通过 priority\_networks 配置项来强制指定正确的 IP。
|
||||
|
||||
priority\_networks 是 FE 和 BE 都有的一个配置,配置项需写在 fe.conf 和 be.conf 中。该配置项用于在 FE 或 BE 启动时,告诉进程应该绑定哪个IP。示例如下:
|
||||
|
||||
`priority_networks=10.1.3.0/24`
|
||||
|
||||
这是一种 [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) 的表示方法。FE 或 BE 会根据这个配置项来寻找匹配的IP,作为自己的 localIP。
|
||||
|
||||
**注意**:当配置完 priority\_networks 并启动 FE 或 BE 后,只是保证了 FE 或 BE 自身的 IP 进行了正确的绑定。而在使用 ADD BACKEND 或 ADD FRONTEND 语句中,也需要指定和 priority\_networks 配置匹配的 IP,否则集群无法建立。举例:
|
||||
|
||||
BE 的配置为:`priority_networks=10.1.3.0/24`
|
||||
|
||||
但是在 ADD BACKEND 时使用的是:`ALTER SYSTEM ADD BACKEND "192.168.0.1:9050";`
|
||||
|
||||
则 FE 和 BE 将无法正常通信。
|
||||
|
||||
这时,必须 DROP 掉这个添加错误的 BE,重新使用正确的 IP 执行 ADD BACKEND。
|
||||
|
||||
FE 同理。
|
||||
|
||||
BROKER 当前没有,也不需要 priority\_networks 这个选项。Broker 的服务默认绑定在 0.0.0.0 上。只需在 ADD BROKER 时,执行正确可访问的 BROKER IP 即可。
|
||||
|
||||
## 集群部署
|
||||
|
||||
### 手动部署
|
||||
|
||||
#### FE 部署
|
||||
|
||||
* 拷贝 FE 部署文件到指定节点
|
||||
|
||||
将源码编译生成的 output 下的 fe 文件夹拷贝到 FE 的节点指定部署路径下。
|
||||
|
||||
* 配置 FE
|
||||
|
||||
1. 配置文件为 conf/fe.conf。其中注意:`meta_dir`:元数据存放位置。默认在 fe/palo-meta/ 下。需**手动创建**该目录。
|
||||
2. fe.conf 中 JAVA_OPTS 默认 java 最大堆内存为 2GB,建议生产环境调整至 8G 以上。
|
||||
|
||||
* 启动FE
|
||||
|
||||
`sh bin/start_fe.sh --daemon`
|
||||
|
||||
FE进程启动进入后台执行。日志默认存放在 fe/log/ 目录下。如启动失败,可以通过查看 fe/log/fe.log 或者 fe/log/fe.out 查看错误信息。
|
||||
|
||||
* 如需部署多 FE,请参见 "FE 扩容和缩容" 章节
|
||||
|
||||
#### BE 部署
|
||||
|
||||
* 拷贝 BE 部署文件到所有要部署 BE 的节点
|
||||
|
||||
将源码编译生成的 output 下的 be 文件夹拷贝到 BE 的节点的指定部署路径下。
|
||||
|
||||
* 修改所有 BE 的配置
|
||||
|
||||
修改 be/conf/be.conf。主要是配置 `storage_root_path`:数据存放目录,使用 `;` 分隔(最后一个目录后不要加 `;`),其它可以采用默认值。
|
||||
|
||||
* 在 FE 中添加所有 BE 节点
|
||||
|
||||
BE 节点需要先在 FE 中添加,才可加入集群。可以使用 mysql-client 连接到 FE:
|
||||
|
||||
`./mysql-client -h host -P port -uroot`
|
||||
|
||||
其中 host 为 FE 所在节点 ip;port 为 fe/conf/fe.conf 中的 query_port;默认使用 root 账户,无密码登录。
|
||||
|
||||
登录后,执行以下命令来添加每一个 BE:
|
||||
|
||||
`ALTER SYSTEM ADD BACKEND "host:port";`
|
||||
|
||||
如果使用多租户功能,则执行以下命令添加 BE:
|
||||
|
||||
`ALTER SYSTEM ADD FREE BACKEND "host:port";`
|
||||
|
||||
其中 host 为 BE 所在节点 ip;port 为 be/conf/be.conf 中的 heartbeat_service_port。
|
||||
|
||||
如果不添加 FREE 关键字,BE 默认进入自动生成的 cluster,添加了 FREE 关键字后新的 BE 不属于任何 cluster,这样创建新 cluster 的时候就可以从这些空闲的be中选取,详细见[多租户设计文档](../administrator-guide/operation/multi-tenant.md)
|
||||
|
||||
* 启动 BE
|
||||
|
||||
`sh bin/start_be.sh --daemon`
|
||||
|
||||
BE 进程将启动并进入后台执行。日志默认存放在 be/log/ 目录下。如启动失败,可以通过查看 be/log/be.log 或者 be/log/be.out 查看错误信息。
|
||||
|
||||
* 查看BE状态
|
||||
|
||||
使用 mysql-client 连接到 FE,并执行 `SHOW PROC '/backends';` 查看 BE 运行情况。如一切正常,`isAlive` 列应为 `true`。
|
||||
|
||||
#### (可选)FS_Broker 部署
|
||||
|
||||
Broker 以插件的形式,独立于 Doris 部署。如果需要从第三方存储系统导入数据,需要部署相应的 Broker,默认提供了读取 HDFS 和百度云 BOS 的 fs_broker。fs_broker 是无状态的,建议每一个 FE 和 BE 节点都部署一个 Broker。
|
||||
|
||||
* 拷贝源码 fs_broker 的 output 目录下的相应 Broker 目录到需要部署的所有节点上。建议和 BE 或者 FE 目录保持同级。
|
||||
|
||||
* 修改相应 Broker 配置
|
||||
|
||||
在相应 broker/conf/ 目录下对应的配置文件中,可以修改相应配置。
|
||||
|
||||
* 启动 Broker
|
||||
|
||||
`sh bin/start_broker.sh --daemon` 启动 Broker。
|
||||
|
||||
* 添加 Broker
|
||||
|
||||
要让 Doris 的 FE 和 BE 知道 Broker 在哪些节点上,通过 sql 命令添加 Broker 节点列表。
|
||||
|
||||
使用 mysql-client 连接启动的 FE,执行以下命令:
|
||||
|
||||
`ALTER SYSTEM ADD BROKER broker_name "host1:port1","host2:port2",...;`
|
||||
|
||||
其中 host 为 Broker 所在节点 ip;port 为 Broker 配置文件中的 broker\_ipc\_port。
|
||||
|
||||
* 查看 Broker 状态
|
||||
|
||||
使用 mysql-client 连接任一已启动的 FE,执行以下命令查看 Broker 状态:`SHOW PROC "/brokers";`
|
||||
|
||||
**注:在生产环境中,所有实例都应使用守护进程启动,以保证进程退出后,会被自动拉起,如 [Supervisor](http://supervisord.org/)。如需使用守护进程启动,在 0.9.0 及之前版本中,需要修改各个 start_xx.sh 脚本,去掉最后的 & 符号**。从 0.10.0 版本开始,直接调用 `sh start_xx.sh` 启动即可。也可参考 [这里](https://www.cnblogs.com/lenmom/p/9973401.html)
|
||||
|
||||
## 扩容缩容
|
||||
|
||||
Doris 可以很方便的扩容和缩容 FE、BE、Broker 实例。
|
||||
|
||||
### FE 扩容和缩容
|
||||
|
||||
可以通过将 FE 扩容至 3 个一上节点来实现 FE 的高可用。
|
||||
|
||||
用户可以通过 mysql 客户端登陆 Master FE。通过:
|
||||
|
||||
`SHOW PROC '/frontends';`
|
||||
|
||||
来查看当前 FE 的节点情况。
|
||||
|
||||
也可以通过前端页面连接:```http://fe_hostname:fe_http_port/frontend``` 或者 ```http://fe_hostname:fe_http_port/system?path=//frontends``` 来查看 FE 节点的情况。
|
||||
|
||||
以上方式,都需要 Doris 的 root 用户权限。
|
||||
|
||||
FE 节点的扩容和缩容过程,不影响当前系统运行。
|
||||
|
||||
#### 增加 FE 节点
|
||||
|
||||
FE 分为 Leader,Follower 和 Observer 三种角色。 默认一个集群,只能有一个 Leader,可以有多个 Follower 和 Observer。其中 Leader 和 Follower 组成一个 Paxos 选择组,如果 Leader 宕机,则剩下的 Follower 会自动选出新的 Leader,保证写入高可用。Observer 同步 Leader 的数据,但是不参加选举。如果只部署一个 FE,则 FE 默认就是 Leader。
|
||||
|
||||
第一个启动的 FE 自动成为 Leader。在此基础上,可以添加若干 Follower 和 Observer。
|
||||
|
||||
添加 Follower 或 Observer。使用 mysql-client 连接到已启动的 FE,并执行:
|
||||
|
||||
`ALTER SYSTEM ADD FOLLOWER "host:port";`
|
||||
|
||||
或
|
||||
|
||||
`ALTER SYSTEM ADD OBSERVER "host:port";`
|
||||
|
||||
其中 host 为 Follower 或 Observer 所在节点 ip,port 为其配置文件 fe.conf 中的 edit\_log\_port。
|
||||
|
||||
配置及启动 Follower 或 Observer。Follower 和 Observer 的配置同 Leader 的配置。第一次启动时,需执行以下命令:
|
||||
|
||||
`./bin/start_fe.sh --helper host:port --daemon`
|
||||
|
||||
查看 Follower 或 Observer 运行状态。使用 mysql-client 连接到任一已启动的 FE,并执行:SHOW PROC '/frontends'; 可以查看当前已加入集群的 FE 及其对应角色。
|
||||
|
||||
> FE 扩容注意事项:
|
||||
> 1. Follower FE(包括 Leader)的数量必须为奇数,建议最多部署 3 个组成高可用(HA)模式即可。
|
||||
> 2. 当 FE 处于高可用部署时(1个 Leader,2个 Follower),我们建议通过增加 Observer FE 来扩展 FE 的读服务能力。当然也可以继续增加 Follower FE,但几乎是不必要的。
|
||||
> 3. 通常一个 FE 节点可以应对 10-20 台 BE 节点。建议总的 FE 节点数量在 10 个以下。而通常 3 个即可满足绝大部分需求。
|
||||
|
||||
#### 删除 FE 节点
|
||||
|
||||
使用以下命令删除对应的 FE 节点:
|
||||
|
||||
```ALTER SYSTEM DROP FOLLOWER[OBSERVER] "fe_host:edit_log_port";```
|
||||
|
||||
> FE 缩容注意事项:
|
||||
> 1. 删除 Follower FE 时,确保最终剩余的 Follower(包括 Leader)节点为奇数。
|
||||
|
||||
### BE 扩容和缩容
|
||||
|
||||
用户可以通过 mysql-client 登陆 Leader FE。通过:
|
||||
|
||||
```SHOW PROC '/backends';```
|
||||
|
||||
来查看当前 BE 的节点情况。
|
||||
|
||||
也可以通过前端页面连接:```http://fe_hostname:fe_http_port/backend``` 或者 ```http://fe_hostname:fe_http_port/system?path=//backends``` 来查看 BE 节点的情况。
|
||||
|
||||
以上方式,都需要 Doris 的 root 用户权限。
|
||||
|
||||
BE 节点的扩容和缩容过程,不影响当前系统运行以及正在执行的任务,并且不会影响当前系统的性能。数据均衡会自动进行。根据集群现有数据量的大小,集群会在几个小时到1天不等的时间内,恢复到负载均衡的状态。集群负载情况,可以参见 [Tablet 负载均衡文档](../administrator-guide/operation/tablet-repair-and-balance.md)。
|
||||
|
||||
#### 增加 BE 节点
|
||||
|
||||
BE 节点的增加方式同 **BE 部署** 一节中的方式,通过 `ALTER SYSTEM ADD BACKEND` 命令增加 BE 节点。
|
||||
|
||||
> BE 扩容注意事项:
|
||||
> 1. BE 扩容后,Doris 会自动根据负载情况,进行数据均衡,期间不影响使用。
|
||||
|
||||
#### 删除 BE 节点
|
||||
|
||||
删除 BE 节点有两种方式:DROP 和 DECOMMISSION
|
||||
|
||||
DROP 语句如下:
|
||||
|
||||
```ALTER SYSTEM DROP BACKEND "be_host:be_heartbeat_service_port";```
|
||||
|
||||
**注意:DROP BACKEND 会直接删除该 BE,并且其上的数据将不能再恢复!!!所以我们强烈不推荐使用 DROP BACKEND 这种方式删除 BE 节点。当你使用这个语句时,会有对应的防误操作提示。**
|
||||
|
||||
DECOMMISSION 语句如下:
|
||||
|
||||
```ALTER SYSTEM DECOMMISSION BACKEND "be_host:be_heartbeat_service_port";```
|
||||
|
||||
> DECOMMISSION 命令说明:
|
||||
> 1. 该命令用于安全删除 BE 节点。命令下发后,Doris 会尝试将该 BE 上的数据向其他 BE 节点迁移,当所有数据都迁移完成后,Doris 会自动删除该节点。
|
||||
> 2. 该命令是一个异步操作。执行后,可以通过 ```SHOW PROC '/backends';``` 看到该 BE 节点的 isDecommission 状态为 true。表示该节点正在进行下线。
|
||||
> 3. 该命令**不一定执行成功**。比如剩余 BE 存储空间不足以容纳下线 BE 上的数据,或者剩余机器数量不满足最小副本数时,该命令都无法完成,并且 BE 会一直处于 isDecommission 为 true 的状态。
|
||||
> 4. DECOMMISSION 的进度,可以通过 ```SHOW PROC '/backends';``` 中的 TabletNum 查看,如果正在进行,TabletNum 将不断减少。
|
||||
> 5. 该操作可以通过:
|
||||
> ```CANCEL ALTER SYSTEM DECOMMISSION BACKEND "be_host:be_heartbeat_service_port";```
|
||||
> 命令取消。取消后,该 BE 上的数据将维持当前剩余的数据量。后续 Doris 重新进行负载均衡
|
||||
|
||||
**对于多租户部署环境下,BE 节点的扩容和缩容,请参阅 [多租户设计文档](../administrator-guide/operation/multi-tenant.md)。**
|
||||
|
||||
### Broker 扩容缩容
|
||||
|
||||
Broker 实例的数量没有硬性要求。通常每台物理机部署一个即可。Broker 的添加和删除可以通过以下命令完成:
|
||||
|
||||
```ALTER SYSTEM ADD BROKER broker_name "broker_host:broker_ipc_port";```
|
||||
```ALTER SYSTEM DROP BROKER broker_name "broker_host:broker_ipc_port";```
|
||||
```ALTER SYSTEM DROP ALL BROKER broker_name;```
|
||||
|
||||
Broker 是无状态的进程,可以随意启停。当然,停止后,正在其上运行的作业会失败,重试即可。
|
||||
|
||||
## 常见问题
|
||||
|
||||
### 进程相关
|
||||
|
||||
1. 如何确定 FE 进程启动成功
|
||||
|
||||
FE 进程启动后,会首先加载元数据,根据 FE 角色的不同,在日志中会看到 ```transfer from UNKNOWN to MASTER/FOLLOWER/OBSERVER```。最终会看到 ```thrift server started``` 日志,并且可以通过 mysql 客户端连接到 FE,则表示 FE 启动成功。
|
||||
|
||||
也可以通过如下连接查看是否启动成功:
|
||||
`http://fe_host:fe_http_port/api/bootstrap`
|
||||
|
||||
如果返回:
|
||||
`{"status":"OK","msg":"Success"}`
|
||||
|
||||
则表示启动成功,其余情况,则可能存在问题。
|
||||
|
||||
> 注:如果在 fe.log 中查看不到启动失败的信息,也许在 fe.out 中可以看到。
|
||||
|
||||
2. 如何确定 BE 进程启动成功
|
||||
|
||||
BE 进程启动后,如果之前有数据,则可能有数分钟不等的数据索引加载时间。
|
||||
|
||||
如果是 BE 的第一次启动,或者该 BE 尚未加入任何集群,则 BE 日志会定期滚动 ```waiting to receive first heartbeat from frontend``` 字样。表示 BE 还未通过 FE 的心跳收到 Master 的地址,正在被动等待。这种错误日志,在 FE 中 ADD BACKEND 并发送心跳后,就会消失。如果在接到心跳后,又重复出现 ``````master client, get client from cache failed.host: , port: 0, code: 7`````` 字样,说明 FE 成功连接了 BE,但 BE 无法主动连接 FE。可能需要检查 BE 到 FE 的 rpc_port 的连通性。
|
||||
|
||||
如果 BE 已经被加入集群,日志中应该每隔 5 秒滚动来自 FE 的心跳日志:```get heartbeat, host: xx.xx.xx.xx, port: 9020, cluster id: xxxxxx```,表示心跳正常。
|
||||
|
||||
其次,日志中应该每隔 10 秒滚动 ```finish report task success. return code: 0``` 的字样,表示 BE 向 FE 的通信正常。
|
||||
|
||||
同时,如果有数据查询,应该能看到不停滚动的日志,并且有 ```execute time is xxx``` 日志,表示 BE 启动成功,并且查询正常。
|
||||
|
||||
也可以通过如下连接查看是否启动成功:
|
||||
`http://be_host:be_http_port/api/health`
|
||||
|
||||
如果返回:
|
||||
`{"status": "OK","msg": "To Be Added"}`
|
||||
|
||||
则表示启动成功,其余情况,则可能存在问题。
|
||||
|
||||
> 注:如果在 be.INFO 中查看不到启动失败的信息,也许在 be.out 中可以看到。
|
||||
|
||||
3. 搭建系统后,如何确定 FE、BE 连通性正常
|
||||
|
||||
首先确认 FE 和 BE 进程都已经单独正常启动,并确认已经通过 `ADD BACKEND` 或者 `ADD FOLLOWER/OBSERVER` 语句添加了所有节点。
|
||||
|
||||
如果心跳正常,BE 的日志中会显示 ```get heartbeat, host: xx.xx.xx.xx, port: 9020, cluster id: xxxxxx```。如果心跳失败,在 FE 的日志中会出现 ```backend[10001] got Exception: org.apache.thrift.transport.TTransportException``` 类似的字样,或者其他 thrift 通信异常日志,表示 FE 向 10001 这个 BE 的心跳失败。这里需要检查 FE 向 BE host 的心跳端口的连通性。
|
||||
|
||||
如果 BE 向 FE 的通信正常,则 BE 日志中会显示 ```finish report task success. return code: 0``` 的字样。否则会出现 ```master client, get client from cache failed``` 的字样。这种情况下,需要检查 BE 向 FE 的 rpc_port 的连通性。
|
||||
|
||||
4. Doris 各节点认证机制
|
||||
|
||||
除了 Master FE 以外,其余角色节点(Follower FE,Observer FE,Backend),都需要通过 `ALTER SYSTEM ADD` 语句先注册到集群,然后才能加入集群。
|
||||
|
||||
Master FE 在第一次启动时,会在 palo-meta/image/VERSION 文件中生成一个 cluster_id。
|
||||
|
||||
FE 在第一次加入集群时,会首先从 Master FE 获取这个文件。之后每次 FE 之间的重新连接(FE 重启),都会校验自身 cluster id 是否与已存在的其它 FE 的 cluster id 相同。如果不同,则该 FE 会自动退出。
|
||||
|
||||
BE 在第一次接收到 Master FE 的心跳时,会从心跳中获取到 cluster id,并记录到数据目录的 `cluster_id` 文件中。之后的每次心跳都会比对 FE 发来的 cluster id。如果 cluster id 不相等,则 BE 会拒绝响应 FE 的心跳。
|
||||
|
||||
心跳中同时会包含 Master FE 的 ip。当 FE 切主时,新的 Master FE 会携带自身的 ip 发送心跳给 BE,BE 会更新自身保存的 Master FE 的 ip。
|
||||
|
||||
> **priority\_network**
|
||||
>
|
||||
> priority\_network 是 FE 和 BE 都有一个配置,其主要目的是在多网卡的情况下,协助 FE 或 BE 识别自身 ip 地址。priority\_network 采用 CIDR 表示法:[RFC 4632](https://tools.ietf.org/html/rfc4632)
|
||||
>
|
||||
> 当确认 FE 和 BE 连通性正常后,如果仍然出现建表 Timeout 的情况,并且 FE 的日志中有 `backend does not found. host: xxx.xxx.xxx.xxx` 字样的错误信息。则表示 Doris 自动识别的 IP 地址有问题,需要手动设置 priority\_network 参数。
|
||||
>
|
||||
> 出现这个问题的主要原因是:当用户通过 `ADD BACKEND` 语句添加 BE 后,FE 会识别该语句中指定的是 hostname 还是 IP。如果是 hostname,则 FE 会自动将其转换为 IP 地址并存储到元数据中。当 BE 在汇报任务完成信息时,会携带自己的 IP 地址。而如果 FE 发现 BE 汇报的 IP 地址和元数据中不一致时,就会出现如上错误。
|
||||
>
|
||||
> 这个错误的解决方法:1)分别在 FE 和 BE 设置 **priority\_network** 参数。通常 FE 和 BE 都处于一个网段,所以该参数设置为相同即可。2)在 `ADD BACKEND` 语句中直接填写 BE 正确的 IP 地址而不是 hostname,以避免 FE 获取到错误的 IP 地址。
|
||||
@ -1,37 +0,0 @@
|
||||
# 集群升级
|
||||
|
||||
Doris 可以通过滚动升级的方式,平滑进行升级。建议按照以下步骤进行安全升级。
|
||||
|
||||
> 注:
|
||||
> 1. 以下方式均建立在高可用部署的情况下。即数据 3 副本,FE 高可用情况下。
|
||||
|
||||
## 测试 BE 升级正确性
|
||||
|
||||
1. 任意选择一个 BE 节点,部署最新的 palo_be 二进制文件。
|
||||
2. 重启 BE 节点,通过 BE 日志 be.INFO,查看是否启动成功。
|
||||
3. 如果启动失败,可以先排查原因。如果错误不可恢复,可以直接通过 DROP BACKEND 删除该 BE、清理数据后,使用上一个版本的 palo_be 重新启动 BE。然后重新 ADD BACKEND。(**该方法会导致丢失一个数据副本,请务必确保3副本完整的情况下,执行这个操作!!!**)
|
||||
|
||||
## 测试 FE 元数据兼容性
|
||||
|
||||
0. **重要!!元数据兼容性异常很可能导致数据无法恢复!!**
|
||||
1. 单独使用新版本部署一个测试用的 FE 进程(比如自己本地的开发机)。
|
||||
2. 修改测试用的 FE 的配置文件 fe.conf,将所有端口设置为**与线上不同**。
|
||||
3. 在 fe.conf 添加配置:cluster_id=123456
|
||||
4. 在 fe.conf 添加配置:metadata\_failure_recovery=true
|
||||
5. 拷贝线上环境 Master FE 的元数据目录 palo-meta 到测试环境
|
||||
6. 将拷贝到测试环境中的 palo-meta/image/VERSION 文件中的 cluster_id 修改为 123456(即与第3步中相同)
|
||||
7. 在测试环境中,运行 sh bin/start_fe.sh 启动 FE
|
||||
8. 通过 FE 日志 fe.log 观察是否启动成功。
|
||||
9. 如果启动成功,运行 sh bin/stop_fe.sh 停止测试环境的 FE 进程。
|
||||
10. **以上 2-6 步的目的是防止测试环境的FE启动后,错误连接到线上环境中。**
|
||||
|
||||
## 升级准备
|
||||
|
||||
1. 在完成数据正确性验证后,将 BE 和 FE 新版本的二进制文件分发到各自目录下。
|
||||
2. 通常小版本升级,BE 只需升级 palo_be;而 FE 只需升级 palo-fe.jar。如果是大版本升级,则可能需要升级其他文件(包括但不限于 bin/ lib/ 等等)如果你不清楚是否需要替换其他文件,建议全部替换。
|
||||
|
||||
## 滚动升级
|
||||
|
||||
1. 确认新版本的文件部署完成后。逐台重启 FE 和 BE 实例即可。
|
||||
2. 建议逐台重启 BE 后,再逐台重启 FE。因为通常 Doris 保证 FE 到 BE 的向后兼容性,即老版本的 FE 可以访问新版本的 BE。但可能不支持老版本的 BE 访问新版本的 FE。
|
||||
3. 建议确认前一个实例启动成功后,在重启下一个实例。实例启动成功的标识,请参阅安装部署文档。
|
||||
@ -1,6 +1,6 @@
|
||||
===========
|
||||
设计文档
|
||||
===========
|
||||
====================
|
||||
Design Documents
|
||||
====================
|
||||
|
||||
.. toctree::
|
||||
:glob:
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
===========
|
||||
SQL 手册
|
||||
===========
|
||||
=============
|
||||
SQL Manual
|
||||
=============
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
'35; AVG
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
#AVG
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
`AVG([DISTINCT] expr)`
|
||||
|
||||
@ -9,7 +9,7 @@ Used to return the average value of the selected field
|
||||
|
||||
Optional field DISTINCT parameters can be used to return the weighted average
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> SELECT datetime, AVG(cost_time) FROM log_statis group by datetime;
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
# COUNT
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
`COUNT([DISTINCT] expr)`
|
||||
|
||||
|
||||
Number of rows used to return the required rows
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
MySQL > select count(*) from log_statis group by datetime;
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
# COUNT_DISTINCT
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
`COUNT_DISTINCT(expr)`
|
||||
|
||||
|
||||
The number of rows used to return the required number, or the number of non-NULL rows
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
MySQL > select count_distinct(query_id) from log_statis group by datetime;
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
THE EUROPEAN UNION
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# HLL_UNION_AGG
|
||||
## description
|
||||
### Syntax
|
||||
|
||||
'HLL UNION'u AGG (hll)'
|
||||
`HLL_UNION_AGG(hll)`
|
||||
|
||||
|
||||
HLL is an engineering implementation based on HyperLog algorithm, which is used to save the intermediate results of HyperLog calculation process.
|
||||
@ -13,7 +13,7 @@ Based on this, we get an estimate with an error of about 1%. The HLL column is g
|
||||
|
||||
When importing, hll_hash function is used to specify which column in data is used to generate HLL column. It is often used to replace count distinct, and to calculate UV quickly in business by combining rollup.
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
```
|
||||
MySQL > select HLL_UNION_AGG(uv_set) from test_uv;;
|
||||
+-------------------------+
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
=============
|
||||
聚合函数
|
||||
=============
|
||||
========================
|
||||
Aggregate Functions
|
||||
========================
|
||||
|
||||
.. toctree::
|
||||
:glob:
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
# MAX
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
## description
|
||||
### Syntax
|
||||
|
||||
'MAX (expr)
|
||||
`MAX(expr)`
|
||||
|
||||
|
||||
Returns the maximum value of an expr expression
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
```
|
||||
MySQL > select max(scan_rows) from log_statis group by datetime;
|
||||
+------------------+
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
# MIN
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
`MIN(expr)`
|
||||
|
||||
|
||||
Returns the minimum value of an expr expression
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
```
|
||||
MySQL > select min(scan_rows) from log_statis group by datetime;
|
||||
+------------------+
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
'35; NDV
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# NDV
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'NDV (expr)'
|
||||
`NDV (expr)`
|
||||
|
||||
|
||||
Returns an approximate aggregation function similar to the result of COUNT (DISTINCT col).
|
||||
|
||||
It combines COUNT and DISTINCT faster and uses fixed-size memory, so less memory can be used for columns with high cardinality.
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
```
|
||||
MySQL > select ndv(query_id) from log_statis group by datetime;
|
||||
+-----------------+
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# PERCENTILE_APPROX
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
`PERCENTILE_APPROX(expr, DOUBLE p)`
|
||||
|
||||
@ -9,7 +9,7 @@ Return the approximation of the point p, where the value of P is between 0 and 1
|
||||
|
||||
This function uses fixed size memory, so less memory can be used for columns with high cardinality, and can be used to calculate statistics such as tp99.
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
```
|
||||
MySQL > select `table`, percentile_approx(cost_time,0.99) from log_statis group by `table`;
|
||||
+---------------------+---------------------------+
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
# STDDEV,STDDEV_POP
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
"`stddev (expl)'
|
||||
`stddev (expl)`
|
||||
|
||||
|
||||
Returns the standard deviation of the expr expression
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
```
|
||||
MySQL > select stddev(scan_rows) from log_statis group by datetime;
|
||||
+---------------------+
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
"35; STDDEV SAMP
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# STDDEV_SAMP
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'STDDEV SAMP (expr)'
|
||||
|
||||
|
||||
Returns the sample standard deviation of the expr expression
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
```
|
||||
MySQL > select stddev_samp(scan_rows) from log_statis group by datetime;
|
||||
+--------------------------+
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
# SUM
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
` Sum (Expr)'
|
||||
|
||||
|
||||
Used to return the sum of all values of the selected field
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
```
|
||||
MySQL > select sum(scan_rows) from log_statis group by datetime;
|
||||
+------------------+
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
"35; VARIANCE SAMP, VARIANCE SAMP
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# VARIANCE_SAMP,VARIANCE_SAMP
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'VAR SAMP (expr)'
|
||||
|
||||
|
||||
Returns the sample variance of the expr expression
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
```
|
||||
MySQL > select var_samp(scan_rows) from log_statis group by datetime;
|
||||
+-----------------------+
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
# VARIANCE,VAR_POP,VARIANCE_POP
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
`VARIANCE(expr)`
|
||||
|
||||
|
||||
Returns the variance of the expr expression
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
```
|
||||
MySQL > select variance(scan_rows) from log_statis group by datetime;
|
||||
+-----------------------+
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
'35; CAST
|
||||
Description
|
||||
# CAST
|
||||
##Description
|
||||
|
||||
|
||||
```
|
||||
cast (input as type)
|
||||
```
|
||||
|
||||
'35;'35;' 35; BIGINT type
|
||||
### BIGINT type
|
||||
|
||||
'35;'35;' 35; Syntax (BIGINT)
|
||||
### Syntax (BIGINT)
|
||||
|
||||
``` cast (input as BIGINT) ```
|
||||
|
||||
@ -18,7 +18,7 @@ Converts input to the specified type
|
||||
|
||||
Converting the current column input to BIGINT type
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
1. Turn constant, or a column in a table
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Date 35; Date Add
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# date_add
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
`INT DATE_ADD(DATETIME date,INTERVAL expr type)`
|
||||
|
||||
@ -13,7 +13,7 @@ The expr parameter is the interval you want to add.
|
||||
|
||||
Sweet, sweet, sweet
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql > select date to add ('2010 -11 -30 23:59:59', INTERVAL 2 DAY);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
3500; date sub
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# date_sub
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
`INT DATE_SUB(DATETIME date,INTERVAL expr type)`
|
||||
|
||||
@ -13,7 +13,7 @@ The expr parameter is the interval you want to add.
|
||||
|
||||
Sweet, sweet, sweet
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql > select date sub ('2010 -11 -30 23:59:59', INTERVAL 2 DAY);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# datediff
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'DATETIME DATEDIFF (DATETIME expr1,DATETIME expr2)'
|
||||
|
||||
@ -11,7 +11,7 @@ Expr1 and expr2 parameters are valid date or date/time expressions.
|
||||
|
||||
Note: Only the date part of the value participates in the calculation.
|
||||
|
||||
'35;'35; example
|
||||
### example
|
||||
|
||||
```
|
||||
MySQL > select DateDiff (CAST ('2007 -12 -31 23:59:59 'AS DATETIME), CAST (2007 -12 -30' AS DATETIME));
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# day
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
`INT DAY(DATETIME date)`
|
||||
|
||||
@ -9,7 +9,7 @@ Get the day information in the date, and return values range from 1 to 31.
|
||||
|
||||
The parameter is Date or Datetime type
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select day('1987-01-31');
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# dayname
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'VARCHAR DAYNAME (DATE)'
|
||||
|
||||
@ -9,7 +9,7 @@ Date name corresponding to return date
|
||||
|
||||
The parameter is Date or Datetime type
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql > select dayname ('2007 -02 -03 00:00');
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Dayofmonth
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# Dayofmonth
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'INT DAYOFMONTH (DATETIME date)'
|
||||
|
||||
@ -9,7 +9,7 @@ Get the day information in the date, and return values range from 1 to 31.
|
||||
|
||||
The parameter is Date or Datetime type
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select dayofmonth('1987-01-31');
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# dayofweek
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
INT DayOfWeek (DATETIME date)
|
||||
|
||||
@ -9,7 +9,7 @@ The DAYOFWEEK function returns the index value of the working day of the date, t
|
||||
|
||||
The parameter is Date or Datetime type
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select dayofweek('2019-06-25');
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
3500; Dayofyear
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# Dayofyear
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'INT DAYOFYEAR (DATETIME date)'
|
||||
|
||||
@ -9,7 +9,7 @@ The date of acquisition is the date of the corresponding year.
|
||||
|
||||
The parameter is Date or Datetime type
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql > select dayofyear ('2007 -02 -03 00:00');
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
# from_days
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
`DATE FROM_DAYS(INT N)`
|
||||
|
||||
|
||||
Calculate which day by the number of days from 0000-01-01
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql > select from u days (730669);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
=============
|
||||
日期函数
|
||||
=============
|
||||
=========================
|
||||
Date Time Functions
|
||||
=========================
|
||||
|
||||
.. toctree::
|
||||
:glob:
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
month
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# month
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
INT MONTH (DATETIME date)
|
||||
|
||||
@ -9,7 +9,7 @@ Returns month information in the time type, ranging from 1,12
|
||||
|
||||
The parameter is Date or Datetime type
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select month('1987-01-01');
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
\ 35; Monthname
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# Monthname
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'VARCHAR MONTHNAME (DATE)'
|
||||
|
||||
@ -9,7 +9,7 @@ Month name corresponding to return date
|
||||
|
||||
The parameter is Date or Datetime type
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql > select monthname ('2008 -02 -03 00:00');
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
# now
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'DATETIME NOW ()'
|
||||
|
||||
|
||||
Get the current time and return it in Datetime type
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select now();
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
3500; Str_to_date
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# Str_to_date
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'DATETIME STR TWO DATES (VARCHAR STR, VARCHAR format)'
|
||||
|
||||
@ -9,7 +9,7 @@ Convert STR to DATE type by format specified, if the conversion result does not
|
||||
|
||||
The format format supported is consistent with date_format
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql > select str to u date ('2014 -12 -21 12:34:56','%Y -%m -%d%H:%i:%s');
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Time diff
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# timediff
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'TIME TIMEDIFF (DATETIME expr1, DATETIME expr2)'
|
||||
|
||||
@ -11,7 +11,7 @@ The TIMEDIFF function returns the result of expr1 - expr2 expressed as a time va
|
||||
|
||||
The results are limited to TIME values ranging from - 838:59:59 to 838:59:59.
|
||||
|
||||
'35;'35; example
|
||||
### example
|
||||
|
||||
```
|
||||
mysql> SELECT TIMEDIFF(now(),utc_timestamp());
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
'35; to u days
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# to_days
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'INT TO DAYS'
|
||||
|
||||
@ -9,7 +9,7 @@ Days of returning date distance 0000-01-01
|
||||
|
||||
The parameter is Date or Datetime type
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select to_days('2007-10-07');
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# utc_timestamp
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
`DATETIME UTC_TIMESTAMP()`
|
||||
|
||||
@ -11,7 +11,7 @@ A Value of "YYYYMMDDHMMSS" Format
|
||||
|
||||
Depending on whether the function is used in a string or numeric context
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select utc_timestamp(),utc_timestamp() + 1;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
'35; weekofyear
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# weekofyear
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'INT WEEKOFYEAR (DATETIME DATE)'
|
||||
|
||||
@ -10,7 +10,7 @@ Get the Weeks of the Year
|
||||
|
||||
The parameter is Date or Datetime type
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql > select weekofyear ('2008 -02 -20 00:00:00');
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# year
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
`INT YEAR(DATETIME date)`
|
||||
|
||||
@ -9,7 +9,7 @@ Returns the year part of the date type, ranging from 1000 to 9999
|
||||
|
||||
The parameter is Date or Datetime type
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select year('1987-01-01');
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
===========
|
||||
SQL 函数
|
||||
===========
|
||||
==================
|
||||
SQL Functions
|
||||
==================
|
||||
|
||||
.. toctree::
|
||||
:glob:
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
=============
|
||||
地理位置函数
|
||||
=============
|
||||
=======================
|
||||
Sptial Functions
|
||||
=======================
|
||||
|
||||
.. toctree::
|
||||
:glob:
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
'35; 'ST AsText','ST AsWKT'
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# `ST_AsText`,`ST_AsWKT`
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'VARCHAR ST'u AsText (GEOMETRY geo)'
|
||||
|
||||
|
||||
Converting a geometric figure into a WKT (Well Known Text) representation
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> SELECT ST_AsText(ST_Point(24.7, 56.7));
|
||||
@ -18,4 +18,4 @@ mysql> SELECT ST_AsText(ST_Point(24.7, 56.7));
|
||||
+---------------------------------+
|
||||
```
|
||||
##keyword
|
||||
ST. ASTEXT, ST. ASWKT, ST, ASTEXT, ASWKT
|
||||
ST_ASTEXT,ST_ASWKT,ST,ASTEXT,ASWKT
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# `ST_Circle`
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
`GEOMETRY ST_Circle(DOUBLE center_lng, DOUBLE center_lat, DOUBLE radius)`
|
||||
|
||||
@ -8,7 +8,7 @@ Description
|
||||
Convert a WKT (Well Known Text) into a circle on the earth's sphere. Where `center_lng'denotes the longitude of the center of a circle,
|
||||
` Center_lat` denotes the latitude of the center of a circle, radius` denotes the radius of a circle in meters.
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> SELECT ST_AsText(ST_Circle(111, 64, 10000));
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
\ 35; `St U contains'
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# `ST_Contains'
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
`BOOL ST_Contains(GEOMETRY shape1, GEOMETRY shape2)`
|
||||
|
||||
|
||||
Judging whether geometric shape 1 can contain geometric shape 2 completely
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
MYSQL > Select ST ^ U contains (ST ^ U Polygon ("Polygon ((0, 10, 10, 10, 10, 10, 0, 10, 0, 0, 0))), ST ^ UPOint (5, 5));
|
||||
@ -25,4 +25,4 @@ MYSQL > Select St ^ U contains (ST ^ U Polygon ("Polygon ((0, 10, 10, 10, 10, 10
|
||||
+------------------------------------------------------------------------------------------+
|
||||
```
|
||||
##keyword
|
||||
St. John, St. John
|
||||
ST_CONTAINS,ST,CONTAINS
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
Distance sphere
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# `ST_Distance_Sphere`
|
||||
## description
|
||||
### Syntax
|
||||
|
||||
`DOUBLE ST_Distance_Sphere(DOUBLE x_lng, DOUBLE x_lat, DOUBLE y_lng, DOUBLE x_lat)`
|
||||
|
||||
|
||||
Calculate the spherical distance between two points of the earth in meters. The incoming parameters are the longitude of point X, the latitude of point X, the longitude of point Y and the latitude of point Y.
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select st_distance_sphere(116.35620117, 39.939093, 116.4274406433, 39.9020987219);
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
'35; ` ST GeometryFromText','ST GeomFromText '
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# `ST_GeometryFromText`,`ST GeomFromText`
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'GEOMETRY ST'u GeometryFromText (VARCHAR wkt)'
|
||||
|
||||
|
||||
Converting a WKT (Well Known Text) into a corresponding memory geometry
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> SELECT ST_AsText(ST_GeometryFromText("LINESTRING (1 1, 2 2)"));
|
||||
@ -18,4 +18,4 @@ mysql> SELECT ST_AsText(ST_GeometryFromText("LINESTRING (1 1, 2 2)"));
|
||||
+---------------------------------------------------------+
|
||||
```
|
||||
##keyword
|
||||
ST. GEOMETRYFROMTEXT,ST. GEOMFROMTEXT,ST,GEOMETRYFROMTEXT,GEOMFROMTEXT
|
||||
ST_GEOMETRYFROMTEXT,ST_GEOMFROMTEXT,ST,GEOMETRYFROMTEXT,GEOMFROMTEXT
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
'35; ` ST LineFromText','ST LineStringFromText '
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# `ST_LineFromText`,`ST_LineStringFromText`
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'GEOMETRY ST LineFromText (VARCHAR wkt)'
|
||||
|
||||
|
||||
Converting a WKT (Well Known Text) into a Line-style memory representation
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> SELECT ST_AsText(ST_LineFromText("LINESTRING (1 1, 2 2)"));
|
||||
@ -18,4 +18,4 @@ mysql> SELECT ST_AsText(ST_LineFromText("LINESTRING (1 1, 2 2)"));
|
||||
+---------------------------------------------------------+
|
||||
```
|
||||
##keyword
|
||||
ST. LINEFROMTEXT, ST. LINESTRINGFROMTEXT,ST,LINEFROMTEXT,LINESTRINGFROMTEXT
|
||||
ST_LINEFROMTEXT, ST_LINESTRINGFROMTEXT,ST,LINEFROMTEXT,LINESTRINGFROMTEXT
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
\ 35; St upoint'
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# St_Point'
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
`POINT ST_Point(DOUBLE x, DOUBLE y)`
|
||||
|
||||
@ -8,7 +8,7 @@ Description
|
||||
Given the X coordinate value, the Y coordinate value returns the corresponding Point.
|
||||
The current value is meaningful only for spherical sets, and X/Y corresponds to longitude/latitude.
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> SELECT ST_AsText(ST_Point(24.7, 56.7));
|
||||
@ -19,4 +19,4 @@ mysql> SELECT ST_AsText(ST_Point(24.7, 56.7));
|
||||
+---------------------------------+
|
||||
```
|
||||
##keyword
|
||||
ST -u POINT,ST,POINT
|
||||
ST_POINT,ST,POINT
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
'35; ` ST Polygon','ST PolyFromText','ST PolygonFromText '
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# `ST_Polygon`,`ST_PolyFromText`,`ST_PolygonFromText`
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'GEOMETRY ST'u Polygon (VARCHAR wkt)'
|
||||
|
||||
@ -8,6 +8,7 @@ Description
|
||||
Converting a WKT (Well Known Text) into a corresponding polygon memory form
|
||||
|
||||
|
||||
### example
|
||||
|
||||
```
|
||||
mysql> SELECT ST_AsText(ST_Polygon("POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))"));
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
35; 'ST -u X'
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# `ST_X`
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
`DOUBLE ST_X(POINT point)`
|
||||
|
||||
|
||||
When point is a valid POINT type, the corresponding X coordinate value is returned.
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> SELECT ST_X(ST_Point(24.7, 56.7));
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
35; 'ST -u Y'
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# `ST_Y`
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
`DOUBLE ST_Y(POINT point)`
|
||||
|
||||
|
||||
When point is a valid POINT type, the corresponding Y coordinate value is returned.
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> SELECT ST_Y(ST_Point(24.7, 56.7));
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
It35; ASCII
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# ASCII
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'INT AXES (WARCHAR STR)'
|
||||
|
||||
|
||||
Returns the ASCII code corresponding to the first character of the string
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql > select ascii ('1');
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
'35; concat
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# concat
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'VARCHAR concat (VARCHAR,...)'
|
||||
|
||||
|
||||
Connect multiple strings and return NULL if any of the parameters is NULL
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select concat("a", "b");
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Concat w
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# Concat_ws
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'VARCHAR concat ws (VARCHAR sep., VARCHAR str,...)'
|
||||
|
||||
@ -9,7 +9,7 @@ Using the first parameter SEP as a connector, the second parameter and all subse
|
||||
If the separator is NULL, return NULL.
|
||||
` The concat_ws` function does not skip empty strings, but NULL values.
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select concat_ws("or", "d", "is");
|
||||
@ -34,4 +34,4 @@ Concat ws ("or", "d", NULL,"is").
|
||||
+---------------------------------+
|
||||
```
|
||||
##keyword
|
||||
CONCAT WS,CONCAT,WS
|
||||
CONCAT_WS,CONCAT,WS
|
||||
|
||||
@ -1,13 +1,15 @@
|
||||
IV35; Find@U set
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# find_in_set
|
||||
## description
|
||||
### Syntax
|
||||
|
||||
`INT find_in_set(VARCHAR str, VARCHAR strlist)`
|
||||
|
||||
"NOT found in set (VARCHAR str., VARCHAR strlist)"
|
||||
|
||||
|
||||
Return to the location where the str first appears in strlist (counting from 1). Strlist is a comma-separated string. If not, return 0. Any parameter is NULL, returning NULL.
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql > select find in u set ("b", "a,b,c");
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
Get two copies
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# get_json_double
|
||||
## description
|
||||
### Syntax
|
||||
|
||||
"DOUBLE get" is a double (VARCHAR is on the street, VARCHAR is on the path)
|
||||
`DOUBLE get_json_double(VARCHAR json_str, VARCHAR json_path)
|
||||
|
||||
|
||||
Parse and get the floating-point content of the specified path in the JSON string.
|
||||
@ -11,7 +11,7 @@ Use [] to denote array subscripts, starting at 0.
|
||||
The content of path cannot contain ",[and].
|
||||
If the json_string format is incorrect, or the json_path format is incorrect, or matches cannot be found, NULL is returned.
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
1. Get the value of key as "k1"
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# get_json_int
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'I don't get you int (VARCHAR is on, VARCHAR is on the path)
|
||||
|
||||
@ -11,7 +11,7 @@ Use [] to denote array subscripts, starting at 0.
|
||||
The content of path cannot contain ",[and].
|
||||
If the json_string format is incorrect, or the json_path format is incorrect, or matches cannot be found, NULL is returned.
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
1. Get the value of key as "k1"
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
''35; get me a string
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# get_json_string
|
||||
## description
|
||||
### Syntax
|
||||
|
||||
'VARCHAR get'u string (VARCHAR json str, VARCHAR json path)
|
||||
|
||||
@ -11,7 +11,7 @@ Use [] to denote array subscripts, starting at 0.
|
||||
The content of path cannot contain ",[and].
|
||||
If the json_string format is incorrect, or the json_path format is incorrect, or matches cannot be found, NULL is returned.
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
1. Get the value of key as "k1"
|
||||
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
Groups \\\35
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# group_concat
|
||||
## description
|
||||
### Syntax
|
||||
|
||||
'VARCHAR group 'concat (VARCHAR str [, VARCHAR sep])
|
||||
`VARCHAR group_concat(VARCHAR str[, VARCHAR sep])`
|
||||
|
||||
|
||||
This function is an aggregation function similar to sum (), and group_concat links multiple rows of results in the result set to a string. The second parameter, sep, is a connection symbol between strings, which can be omitted. This function usually needs to be used with group by statements.
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select value from test;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
=============
|
||||
字符串函数
|
||||
=============
|
||||
=======================
|
||||
String Functions
|
||||
=======================
|
||||
|
||||
.. toctree::
|
||||
:glob:
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
~35instr
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# instr
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'INT INSR (WARCHAR STR, WARCHAR substrate)'
|
||||
|
||||
|
||||
Returns the location where substr first appeared in str (counting from 1). If substr does not appear in str, return 0.
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select instr("abc", "b");
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
'35; lcase
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# lcase
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'INT lcase (VARCHAR str)'
|
||||
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
# left
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'VARCHAR left (VARCHAR str)'
|
||||
|
||||
|
||||
It returns the left part of a string of specified length
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select left("Hello doris",5);
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
# length
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'INT length (VARCHAR str)'
|
||||
|
||||
|
||||
Returns the length of the string and the number of characters returned for multi-byte characters. For example, five two-byte width words return a length of 10.
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select length("abc");
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
'35; locate
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# locate
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'INT LOCATION (WARCHAR substrate, WARCHAR str [, INT pos]]'
|
||||
|
||||
|
||||
Returns where substr appears in str (counting from 1). If the third parameter POS is specified, the position where substr appears is found from the string where STR starts with POS subscript. If not found, return 0
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> SELECT LOCATE('bar', 'foobarbar');
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
# lower
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'INT lower (WARCHAR str)'
|
||||
|
||||
|
||||
Convert all strings in parameters to lowercase
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> SELECT lower("AbC123");
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
{35; lpad
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# lpad
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'VARCHAR lpad (VARCHAR str., INT len, VARCHAR pad)'
|
||||
|
||||
|
||||
Returns a string of length len in str, starting with the initials. If len is longer than str, pad characters are added to STR until the length of the string reaches len. If len is less than str's length, the function is equivalent to truncating STR strings and returning only strings of len's length.
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql > SELECT lpad ("hi", 5, "xy");
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
'35; ltrim
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# ltrim
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'VARCHAR ltrim (VARCHAR str)'
|
||||
|
||||
|
||||
Remove the space that appears continuously from the beginning of the parameter str
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql > SELECT ltrim (ab d');
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
# money_format
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
VARCHAR money format (Number)
|
||||
|
||||
|
||||
The number is output in currency format, the integer part is separated by commas every three bits, and the decimal part is reserved for two bits.
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select money_format(17014116);
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
# regexp_extract
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'VARCHAR regexp 'extract (VARCHAR str, VARCHAR pattern, int pos)
|
||||
|
||||
|
||||
The string STR is matched regularly and the POS matching part which conforms to pattern is extracted. Patterns need to match exactly some part of the STR to return to the matching part of the pattern. If there is no match, return an empty string.
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> SELECT regexp_extract('AbCdE', '([[:lower:]]+)C([[:lower:]]+)', 1);
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
Replace regexp
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# regexp_replace
|
||||
## description
|
||||
### Syntax
|
||||
|
||||
VARCHAR regexp replace (VARCHAR str, VARCHAR pattern, VARCHAR repl)
|
||||
`VARCHAR regexp_replace(VARCHAR str, VARCHAR pattern, VARCHAR repl)
|
||||
|
||||
|
||||
Regular matching of STR strings, replacing the part hitting pattern with repl
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> SELECT regexp_replace('a b c', " ", "-");
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
# repeat
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'VARCHAR repeat (VARCHAR str, INT count)
|
||||
|
||||
|
||||
Repeat the str of the string count times, return empty string when count is less than 1, return NULL when str, count is any NULL
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> SELECT repeat("a", 3);
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
# right
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'WARCHAR RIGHT (WARCHAR STR)'
|
||||
'VARCHAR RIGHT (VARCHAR STR)'
|
||||
|
||||
|
||||
It returns the right part of a string of specified length
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select right("Hello doris",5);
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
# split_part
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'VARCHAR split party (VARCHAR content, VARCHAR delimiter, INT field)'
|
||||
|
||||
|
||||
Returns the specified partition (counting from the beginning) by splitting the string according to the partitioner.
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select split_part("hello world", " ", 1);
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
# strleft
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'WARCHAR STRAIGHT (WARCHAR STR)'
|
||||
'VARCHAR STRAIGHT (VARCHAR STR)'
|
||||
|
||||
|
||||
It returns the left part of a string of specified length
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select strleft("Hello doris",5);
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
35; strright
|
||||
Description
|
||||
'35;'35;' 35; Syntax
|
||||
# strright
|
||||
## Description
|
||||
### Syntax
|
||||
|
||||
'VARCHAR strright (VARCHAR str)'
|
||||
|
||||
|
||||
It returns the right part of a string of specified length
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
```
|
||||
mysql> select strright("Hello doris",5);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
# CREATE ROLE
|
||||
Description
|
||||
## Description
|
||||
The statement user creates a role
|
||||
|
||||
Grammar:
|
||||
@ -7,7 +7,7 @@ CREATE ROLE role1;
|
||||
|
||||
This statement creates an unauthorized role that can be subsequently granted permission through the GRANT command.
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
1. Create a role
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
# CREATE USER
|
||||
Description
|
||||
##Description
|
||||
|
||||
Syntax:
|
||||
|
||||
@ -14,7 +14,7 @@ The host part can also be specified as a domain with the grammar:'user_name'@['d
|
||||
|
||||
If a role (ROLE) is specified, the permissions that the role has are automatically granted to the newly created user. If not specified, the user defaults to having no permissions. The specified ROLE must already exist.
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
1. Create a passwordless user (without specifying host, it is equivalent to Jack @'%')
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
# DROP ROLE
|
||||
Description
|
||||
## Description
|
||||
The statement user deletes a role
|
||||
|
||||
Grammar:
|
||||
@ -7,7 +7,7 @@ DROP ROLE role1;
|
||||
|
||||
Deleting a role does not affect the permissions of users who previously belonged to that role. It is only equivalent to decoupling the role from the user. The permissions that the user has obtained from the role will not change.
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
1. Delete a role
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
# DROP USER
|
||||
Description
|
||||
## Description
|
||||
|
||||
Syntax:
|
||||
|
||||
@ -7,7 +7,7 @@ DROP USER 'user_name'
|
||||
|
||||
The DROP USER command deletes a Palo user. Doris does not support deleting the specified user_identity here. When a specified user is deleted, all user_identities corresponding to that user are deleted. For example, two users, Jack @'192%'and Jack @['domain'] were created through the CREATE USER statement. After DROP USER'jack' was executed, Jack @'192%'and Jack @['domain'] would be deleted.
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
1. Delete user jack
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
Grant
|
||||
Description
|
||||
# Grant
|
||||
## Description
|
||||
|
||||
The GRANT command is used to give the specified user or role the specified permissions.
|
||||
|
||||
@ -36,7 +36,7 @@ The user_identity syntax here is the same as CREATE USER. And you must create us
|
||||
|
||||
You can also grant permissions to the specified ROLE, which is automatically created if the specified ROLE does not exist.
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
1. Grant permissions to all libraries and tables to users
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
# REVOKE
|
||||
Description
|
||||
## Description
|
||||
|
||||
The REVOKE command is used to revoke the rights specified by the specified user or role.
|
||||
Syntax
|
||||
@ -11,7 +11,7 @@ The user_identity syntax here is the same as CREATE USER. And you must create us
|
||||
|
||||
You can also revoke the permission of the specified ROLE, which must exist for execution.
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
1. Revoke the rights of user Jack database testDb
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
# SET PASSWORD
|
||||
Description
|
||||
## Description
|
||||
|
||||
Syntax:
|
||||
|
||||
@ -13,7 +13,7 @@ Note that the user_identity here must match exactly the user_identity specified
|
||||
PASSWORD () input is a plaintext password, and direct use of strings, you need to pass the encrypted password.
|
||||
If you change the password of other users, you need to have administrator privileges.
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
1. Modify the password of the current user
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
# SET PROPERTY
|
||||
Description
|
||||
## Description
|
||||
|
||||
Syntax:
|
||||
|
||||
@ -26,7 +26,7 @@ Load_cluster. {cluster_name}. hadoop_configs: configuration of hadoop, where fs.
|
||||
Load ucluster. {cluster name}. hadoop port: Hadoop HDFS name node http}
|
||||
Default_load_cluster: The default import cluster.
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
1. Modify the maximum number of user jacks to 1000
|
||||
SET PROPERTY FOR 'jack' 'max_user_connections' = '1000';
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
# SHOW GRANTS
|
||||
Description
|
||||
## Description
|
||||
|
||||
This statement is used to view user rights.
|
||||
|
||||
@ -12,7 +12,7 @@ Explain:
|
||||
3. If you do not specify user_identity, view the permissions of the current user.
|
||||
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
1. View all user rights information
|
||||
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
# SHOW ROLES
|
||||
Description
|
||||
## Description
|
||||
This statement is used to display all created role information, including the role name, the user included, and the permissions.
|
||||
|
||||
Grammar:
|
||||
SHOW ROLES;
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
1. View the created roles:
|
||||
|
||||
|
||||
@ -0,0 +1,8 @@
|
||||
======================
|
||||
Account Management
|
||||
======================
|
||||
|
||||
.. toctree::
|
||||
:glob:
|
||||
|
||||
*
|
||||
@ -1,5 +1,5 @@
|
||||
# ADMIN CANCEL REPAIR
|
||||
Description
|
||||
## Description
|
||||
|
||||
This statement is used to cancel repairing a specified table or partition with high priority
|
||||
|
||||
@ -11,7 +11,7 @@ Explain:
|
||||
|
||||
1. This statement only indicates that the system no longer repairs fragmented copies of specified tables or partitions with high priority. The system will still repair the copy by default scheduling.
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
1. Cancel High Priority Repair
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
# ADMIN REPAIR
|
||||
Description
|
||||
## Description
|
||||
|
||||
This statement is used to try to fix the specified table or partition first
|
||||
|
||||
@ -12,7 +12,7 @@ Explain:
|
||||
1. This statement only means that the system attempts to repair a fragmented copy of a specified table or partition with high priority, and it is not guaranteed to be successful. Users can view the repair status through the ADMIN SHOW REPLICA STATUS command.
|
||||
2. The default timeout is 14400 seconds (4 hours). Timeout means that the system will no longer repair fragmented copies of specified tables or partitions with high priority. The command settings need to be reused.
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
1. Attempt to fix the specified table
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
# ADMIN SET CONFIG
|
||||
Description
|
||||
## Description
|
||||
|
||||
This statement is used to set the configuration items for the cluster (currently only the configuration items for setting FE are supported).
|
||||
Settable configuration items can be viewed through AMDIN SHOW FRONTEND CONFIG; commands.
|
||||
@ -8,7 +8,7 @@ Grammar:
|
||||
|
||||
ADMIN SET FRONTEND CONFIG ("key" = "value");
|
||||
|
||||
'35;'35; example
|
||||
## example
|
||||
|
||||
1. "disable balance" true
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user