Translate docs/zh/operations/table_engines/{file.md,url.md} (#5509)

* translate docs/zh/operations/table_engines/file.md

* optimize docs/zh/operations/table_engines/replication.md

* translate docs/zh/operations/table_engines/url.md
This commit is contained in:
never lee 2019-06-15 22:30:23 +08:00 committed by Ivan Blinkov
parent 56a8f241d9
commit de681a3bef
3 changed files with 50 additions and 51 deletions

View File

@ -1,41 +1,41 @@
# File(InputFormat) {#table_engines-file}
The data source is a file that stores data in one of the supported input formats (TabSeparated, Native, etc.).
数据源是以 Clickhouse 支持的一种输入格式TabSeparatedNative等存储数据的文件。
Usage examples:
用法示例:
- Data export from ClickHouse to file.
- Convert data from one format to another.
- Updating data in ClickHouse via editing a file on a disk.
- 从 ClickHouse 导出数据到文件。
- 将数据从一种格式转换为另一种格式。
- 通过编辑磁盘上的文件来更新 ClickHouse 中的数据。
## Usage in ClickHouse Server
## 在 ClickHouse 服务器中的使用
```
File(Format)
```
`Format` should be supported for either `INSERT` and `SELECT`. For the full list of supported formats see [Formats](../../interfaces/formats.md#formats).
选用的 `Format` 需要支持 `INSERT``SELECT` 。有关支持格式的完整列表,请参阅 [格式](../../interfaces/formats.md#formats)。
ClickHouse does not allow to specify filesystem path for`File`. It will use folder defined by [path](../server_settings/settings.md) setting in server configuration.
ClickHouse 不支持给 `File` 指定文件系统路径。它使用服务器配置中 [path](../server_settings/settings.md) 设定的文件夹。
When creating table using `File(Format)` it creates empty subdirectory in that folder. When data is written to that table, it's put into `data.Format` file in that subdirectory.
使用 `File(Format)` 创建表时,它会在该文件夹中创建空的子目录。当数据写入该表时,它会写到该子目录中的 `data.Format` 文件中。
You may manually create this subfolder and file in server filesystem and then [ATTACH](../../query_language/misc.md) it to table information with matching name, so you can query data from that file.
你也可以在服务器文件系统中手动创建这些子文件夹和文件,然后通过 [ATTACH](../../query_language/misc.md) 将其创建为具有对应名称的表,这样你就可以从该文件中查询数据了。
!!! warning
Be careful with this funcionality, because ClickHouse does not keep track of external changes to such files. The result of simultaneous writes via ClickHouse and outside of ClickHouse is undefined.
!!! 注意
注意这个功能,因为 ClickHouse 不会跟踪这些文件在外部的更改。在 ClickHouse 中和 ClickHouse 外部同时写入会造成结果是不确定的。
**Example:**
**示例:**
**1.** Set up the `file_engine_table` table:
**1.** 创建 `file_engine_table` 表:
``` sql
CREATE TABLE file_engine_table (name String, value UInt32) ENGINE=File(TabSeparated)
```
By default ClickHouse will create folder `/var/lib/clickhouse/data/default/file_engine_table`.
默认情况下Clickhouse 会创建目录 `/var/lib/clickhouse/data/default/file_engine_table`
**2.** Manually create `/var/lib/clickhouse/data/default/file_engine_table/data.TabSeparated` containing:
**2.** 手动创建 `/var/lib/clickhouse/data/default/file_engine_table/data.TabSeparated` 文件,并且包含内容:
```bash
$ cat data.TabSeparated
@ -43,7 +43,7 @@ one 1
two 2
```
**3.** Query the data:
**3.** 查询这些数据:
``` sql
SELECT * FROM file_engine_table
@ -56,22 +56,22 @@ SELECT * FROM file_engine_table
└──────┴───────┘
```
## Usage in Clickhouse-local
## 在 Clickhouse-local 中的使用
In [clickhouse-local](../utils/clickhouse-local.md) File engine accepts file path in addition to `Format`. Default input/output streams can be specified using numeric or human-readable names like `0` or `stdin`, `1` or `stdout`.
**Example:**
使用 [clickhouse-local](../utils/clickhouse-local.md) 时File 引擎除了 `Format` 之外,还可以接受文件路径参数。可以使用数字或人类可读的名称来指定标准输入/输出流,例如 `0``stdin``1` 或 `stdout`
**例如:**
```bash
$ echo -e "1,2\n3,4" | clickhouse-local -q "CREATE TABLE table (a Int64, b Int64) ENGINE = File(CSV, stdin); SELECT a, b FROM table; DROP TABLE table"
```
## Details of Implementation
## 功能实现
- Reads can be parallel, but not writes
- Not supported:
- 读操作可支持并发,但写操作不支持
- 不支持:
- `ALTER`
- `SELECT ... SAMPLE`
- Indices
- Replication
- 索引
- 副本
[Original article](https://clickhouse.yandex/docs/en/operations/table_engines/file/) <!--hide-->
[来源文章](https://clickhouse.yandex/docs/en/operations/table_engines/file/) <!--hide-->

View File

@ -192,7 +192,6 @@ sudo -u clickhouse touch /var/lib/clickhouse/flags/force_restore_data
使用其他名称创建 MergeTree 表。将具有`ReplicatedMergeTree`表数据的目录中的所有数据移动到新表的数据目录中。然后删除`ReplicatedMergeTree`表并重新启动服务器。
如果你想在不启动服务器的情况下清除 `ReplicatedMergeTree` 表:
If you want to get rid of a `ReplicatedMergeTree` table without launching the server:
- 删除元数据目录中的相应 `.sql` 文件(`/var/lib/clickhouse/metadata/`)。
- 删除 ZooKeeper 中的相应路径(`/path_to_table/replica_name`)。

View File

@ -1,33 +1,33 @@
# URL(URL, Format) {#table_engines-url}
Manages data on a remote HTTP/HTTPS server. This engine is similar
to the [File](file.md) engine.
用于管理远程 HTTP/HTTPS 服务器上的数据。该引擎类似
[File](file.md) 引擎。
## Using the engine in the ClickHouse server
## 在 ClickHouse 服务器中使用引擎
`The format` must be one that ClickHouse can use in
`SELECT` queries and, if necessary, in `INSERTs`. For the full list of supported formats, see
[Formats](../../interfaces/formats.md#formats).
`Format` 必须是 ClickHouse 可以用于
`SELECT` 查询的一种格式,若有必要,还要可用于 `INSERT` 。有关支持格式的完整列表,请查看
[Formats](../../interfaces/formats.md#formats)
`The URL` must conform to the structure of a Uniform Resource Locator. The specified URL must point to a server
that uses HTTP or HTTPS. This does not require any
additional headers for getting a response from the server.
`URL` 必须符合统一资源定位符的结构。指定的URL必须指向一个
HTTP 或 HTTPS 服务器。对于服务端响应,
不需要任何额外的 HTTP 头标记。
`INSERT` and `SELECT` queries are transformed to `POST` and `GET` requests,
respectively. For processing `POST` requests, the remote server must support
[Chunked transfer encoding](https://en.wikipedia.org/wiki/Chunked_transfer_encoding).
`INSERT` `SELECT` 查询会分别转换为 `POST``GET` 请求。
对于 `POST` 请求的处理,远程服务器必须支持
[分块传输编码](https://en.wikipedia.org/wiki/Chunked_transfer_encoding)。
**Example:**
**示例:**
**1.** Create a `url_engine_table` table on the server :
**1.** 在 Clickhouse 服务上创建一个 `url_engine_table` 表:
``` sql
CREATE TABLE url_engine_table (word String, value UInt64)
ENGINE=URL('http://127.0.0.1:12345/', CSV)
```
**2.** Create a basic HTTP server using the standard Python 3 tools and
start it:
**2.** 用标准的 Python 3 工具库创建一个基本的 HTTP 服务并
启动它:
```python3
from http.server import BaseHTTPRequestHandler, HTTPServer
@ -49,7 +49,7 @@ if __name__ == "__main__":
python3 server.py
```
**3.** Request data:
**3.** 查询请求:
``` sql
SELECT * FROM url_engine_table
@ -62,12 +62,12 @@ SELECT * FROM url_engine_table
└───────┴───────┘
```
## Details of Implementation
## 功能实现
- Reads and writes can be parallel
- Not supported:
- `ALTER` and `SELECT...SAMPLE` operations.
- Indexes.
- Replication.
- 读写操作都支持并发
- 不支持:
- `ALTER` `SELECT...SAMPLE` 操作。
- 索引。
- 副本。
[Original article](https://clickhouse.yandex/docs/en/operations/table_engines/url/) <!--hide-->
[来源文章](https://clickhouse.yandex/docs/en/operations/table_engines/url/) <!--hide-->