Skip to content

Commit

Permalink
docs: publish v0.9.3 (#1174)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicecui authored Sep 6, 2024
1 parent bdc8b69 commit 970c60a
Show file tree
Hide file tree
Showing 142 changed files with 2,168 additions and 1,184 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ If you are new to Greptime DB, documents below will help you quickly get started
Explains how to use, integrate or customize GreptimeDB; also includes common issues and solutions

- [Concepts](https://docs.greptime.com/user-guide/concepts/overview)
- [Clients](https://docs.greptime.com/user-guide/clients/overview)
- [Table management](https://docs.greptime.com/user-guide/table-management)
- [Write data](https://docs.greptime.com/user-guide/write-data/overview)
- [Query data](https://docs.greptime.com/user-guide/query-data/overview)
- [Table Management](https://docs.greptime.com/user-guide/table-management)
- [Ingest Data](https://docs.greptime.com/user-guide/ingest-data/overview)
- [Query Data](https://docs.greptime.com/user-guide/query-data/overview)
- [Manage Data](https://docs.greptime.com/user-guide/manage-data/overview)
- [Integrations](https://docs.greptime.com/user-guide/integrations/overview)
- [Protocols](https://docs.greptime.com/user-guide/protocols/overview)
- [Python Scripts](https://docs.greptime.com/user-guide/python-scripts/overview)
- [Cluster](https://docs.greptime.com/user-guide/cluster)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
- [表分片][2]
- [分布式查询][3]

[1]: /user-guide/clients/overview.md
[1]: /user-guide/protocols/overview.md
[2]: ./table-sharding.md
[3]: ./distributed-querying.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ GreptimeDB 通过原生支持 [OTLP/HTTP](https://opentelemetry.io/docs/specs/ot
* URL: `https://<host>/v1/otlp/v1/metrics`
* Headers:
* `X-Greptime-DB-Name`: `<dbname>`
* `Authorization`: `Basic` 认证,是 `<username>:<password>` 的 Base64 编码字符串。更多信息请参考 [鉴权](https://docs.greptime.cn/user-guide/clients/authentication)[HTTP API](https://docs.greptime.cn/user-guide/clients/http-api#authentication)
* `Authorization`: `Basic` 认证,是 `<username>:<password>` 的 Base64 编码字符串。更多信息请参考 [鉴权](https://docs.greptime.cn/user-guide/operations/authentication)[HTTP API](https://docs.greptime.cn/user-guide/protocols/http#authentication)

请求中使用 binary protobuf 编码 payload,因此你需要使用支持 `HTTP/protobuf` 的包。例如,在 Node.js 中,可以使用 [`exporter-trace-otlp-proto`](https://www.npmjs.com/package/@opentelemetry/exporter-trace-otlp-proto);在 Go 中,可以使用 [`go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp);在 Java 中,可以使用 [`io.opentelemetry:opentelemetry-exporter-otlp`](https://mvnrepository.com/artifact/io.opentelemetry/opentelemetry-exporter-otlp);在 Python 中,可以使用 [`opentelemetry-exporter-otlp-proto-http`](https://pypi.org/project/opentelemetry-exporter-otlp-proto-http/)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,61 +2,7 @@

## 数据模型的区别

你可能已经熟悉了 [InfluxDB 的关键概念](https://docs.influxdata.com/influxdb/v2/reference/key-concepts/)
GreptimeDB 的 [数据模型](/user-guide/concepts/data-model.md) 是值得了解的新事物。
下方解释了 GreptimeDB 和 InfluxDB 数据模型的相似和不同之处:

- 两者都是[schemaless 写入](/user-guide/ingest-data/overview.md#自动生成表结构)的解决方案,这意味着在写入数据之前无需定义表结构。
- 在 InfluxDB 中,一个点代表一条数据记录,包含一个 measurement、tag 集、field 集和时间戳。
在 GreptimeDB 中,它被表示为时间序列表中的一行数据。
表名对应于 measurement,列由三种类型组成:Tag、Field 和 Timestamp。
- GreptimeDB 使用 `TimestampNanosecond` 作为来自 [InfluxDB 行协议 API](/user-guide/ingest-data/for-iot/influxdb-line-protocol.md) 的时间戳数据类型。
- GreptimeDB 使用 `Float64` 作为来自 InfluxDB 行协议 API 的数值数据类型。

以 InfluxDB 文档中的[示例数据](https://docs.influxdata.com/influxdb/v2/reference/key-concepts/data-elements/#sample-data)为例:

|_time|_measurement|location|scientist|_field|_value|
|---|---|---|---|---|---|
|2019-08-18T00:00:00Z|census|klamath|anderson|bees|23|
|2019-08-18T00:00:00Z|census|portland|mullen|ants|30|
|2019-08-18T00:06:00Z|census|klamath|anderson|bees|28|
|2019-08-18T00:06:00Z|census|portland|mullen|ants|32|

上述数据的 InfluxDB 行协议格式为:

```shell
census,location=klamath,scientist=anderson bees=23 1566086400000000000
census,location=portland,scientist=mullen ants=30 1566086400000000000
census,location=klamath,scientist=anderson bees=28 1566086760000000000
census,location=portland,scientist=mullen ants=32 1566086760000000000
```

在 GreptimeDB 数据模型中,上述数据将被表示为 `census` 表中的以下内容:

```sql
+---------------------+----------+-----------+------+------+
| ts | location | scientist | bees | ants |
+---------------------+----------+-----------+------+------+
| 2019-08-18 00:00:00 | klamath | anderson | 23 | NULL |
| 2019-08-18 00:06:00 | klamath | anderson | 28 | NULL |
| 2019-08-18 00:00:00 | portland | mullen | NULL | 30 |
| 2019-08-18 00:06:00 | portland | mullen | NULL | 32 |
+---------------------+----------+-----------+------+------+
```

`census` 表结构如下:

```sql
+-----------+----------------------+------+------+---------+---------------+
| Column | Type | Key | Null | Default | Semantic Type |
+-----------+----------------------+------+------+---------+---------------+
| location | String | PRI | YES | | TAG |
| scientist | String | PRI | YES | | TAG |
| bees | Float64 | | YES | | FIELD |
| ts | TimestampNanosecond | PRI | NO | | TIMESTAMP |
| ants | Float64 | | YES | | FIELD |
+-----------+----------------------+------+------+---------+---------------+
```
要了解 InfluxDB 和 GreptimeDB 的数据模型之间的差异,请参考写入数据文档中的[数据模型](/user-guide/ingest-data/for-iot/influxdb-line-protocol.md#数据模型)

## 数据库连接信息

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ go get go.opentelemetry.io/[email protected] \
```

安装所需的包后,在 `app.go` 中编写代码创建一个 metric exporter 对象,将 metrics 发送到 GreptimeDB。
请参考 [GreptimeDB](/user-guide/clients/otlp.md)[GreptimeCloud](/greptimecloud/integrations/otlp.md) 中的 OTLP 集成文档获取 exporter 的相关配置。
请参考 [GreptimeDB](/user-guide/protocols/opentelemetry.md)[GreptimeCloud](/greptimecloud/integrations/otlp.md) 中的 OTLP 集成文档获取 exporter 的相关配置。

```go
auth := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", *username, *password)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ do
done
```
请参阅 [GreptimeDB](/user-guide/clients/influxdb-line.md) 或 [GreptimeCloud](/greptimecloud/integrations/influxdb.md) 中的 InfluxDB 文档以获取 InfluxDB API 中的 `host``database``username``password` 信息,
请参阅 [GreptimeDB](/user-guide/protocols/influxdb-line-protocol.md) 或 [GreptimeCloud](/greptimecloud/integrations/influxdb.md) 中的 InfluxDB 文档以获取 InfluxDB API 中的 `host``database``username``password` 信息,
恭喜你完成了 Demo 的核心部分!现在可以按照 [GitHub 库](https://github.com/GreptimeCloudStarters/quick-start-influxdb-line-protocol)中 `README.md` 文件中的说明运行完整的 Demo。
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dependencies {
```

安装完依赖后,编写代码创建一个 Metric Exporter 对象,用于将 metrics 发送到 GreptimeDB。
请参考 [GreptimeDB](/user-guide/clients/otlp.md)[GreptimeCloud](/greptimecloud/integrations/otlp.md) 中的 OTLP 集成文档获取 exporter 的相关配置。
请参考 [GreptimeDB](/user-guide/protocols/opentelemetry.md)[GreptimeCloud](/greptimecloud/integrations/otlp.md) 中的 OTLP 集成文档获取 exporter 的相关配置。

```java
String endpoint = String.format("https://%s/v1/otlp/v1/metrics", dbHost);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ do
done
```
请参阅 [GreptimeDB](/user-guide/clients/mysql.md) 或 [GreptimeCloud](/greptimecloud/integrations/mysql.md) 中的 MySQL 文档以获取命令中的 `host``database``username``password` 信息,
请参阅 [GreptimeDB](/user-guide/protocols/mysql.md) 或 [GreptimeCloud](/greptimecloud/integrations/mysql.md) 中的 MySQL 文档以获取命令中的 `host``database``username``password` 信息,
恭喜你完成了 Demo 的核心部分!现在可以按照 [GitHub 库](https://github.com/GreptimeCloudStarters/quick-start-mysql)中 `README.md` 文件中的说明运行完整的 Demo。
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ npm install @opentelemetry/[email protected] \
```

成功安装依赖后,创建一个名为 `app.ts` 的文件,并编写代码创建一个 metric exporter 对象,将 metrics 发送到 GreptimeDB。
请参考 [GreptimeDB](/user-guide/clients/otlp.md)[GreptimeCloud](/greptimecloud/integrations/otlp.md) 中的 OTLP 集成文档获取 exporter 的相关配置。
请参考 [GreptimeDB](/user-guide/protocols/opentelemetry.md)[GreptimeCloud](/greptimecloud/integrations/otlp.md) 中的 OTLP 集成文档获取 exporter 的相关配置。

```ts
const exporter = new OTLPMetricExporter({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ remote_write:
password: <password>
```
通过上面的配置文件,Prometheus 从 node exporter 中抓取指标并将其发送到 GreptimeDB。有关 `<host>`, `<dbname>`, `<username>` 和 `<password>` 的信息,请参考 [GreptimeDB](/user-guide/clients/prometheus.md) 或 [GreptimeCloud](/greptimecloud/integrations/prometheus/quick-setup.md) 中的 Prometheus 文档。
通过上面的配置文件,Prometheus 从 node exporter 中抓取指标并将其发送到 GreptimeDB。有关 `<host>`, `<dbname>`, `<username>` 和 `<password>` 的信息,请参考 [GreptimeDB](/user-guide/integrations/prometheus.md) 或 [GreptimeCloud](/greptimecloud/integrations/prometheus/quick-setup.md) 中的 Prometheus 文档。

最后启动 Docker 容器:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pip install -r requirements.txt
```

安装所需的包后,创建名为 `main.py` 的新文件并编写代码创建一个 metric exporter 对象,将 metrics 发送到 GreptimeDB。
请参考 [GreptimeDB](/user-guide/clients/otlp.md)[GreptimeCloud](/greptimecloud/integrations/otlp.md) 中的 OTLP 集成文档获取 exporter 的相关配置。
请参考 [GreptimeDB](/user-guide/protocols/opentelemetry.md)[GreptimeCloud](/greptimecloud/integrations/otlp.md) 中的 OTLP 集成文档获取 exporter 的相关配置。

```python
from opentelemetry import metrics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ Common use cases for time-series database include but are not limited to the fol

Please refer to [features that you concern](/user-guide/concepts/features-that-you-concern.md).

### How is GreptimeDB's performance compared to other solutions?

GreptimeDB has released v0.8, with functionalities set to improve progressively. For detailed TSBS test results, refer to the link [here](https://github.com/GreptimeTeam/greptimedb/blob/main/docs/benchmarks/tsbs/v0.8.0.md).

### How is the performance of GreptimeDB when used for non-time-series DB tables?

Expand All @@ -25,9 +22,9 @@ GreptimeDB supports SQL and can deal with non-time-series data, especially effic

Yes, you can find our Go SDK here: https://github.com/GreptimeTeam/greptimedb-ingester-go.

Currently, we support MySQL protocol, you can check it out on the [user guide](/user-guide/clients/mysql.md).
Currently, we support MySQL protocol, you can check it out on the [user guide](/user-guide/protocols/mysql.md).

HTTP API is also available, please see [this article](/user-guide/clients/http-api.md) for more information.
HTTP API is also available, please see [this article](/user-guide/protocols/http.md) for more information.

### Can GreptimeDB be used as a Rust alternative to Prometheus in the observable area?

Expand Down Expand Up @@ -142,10 +139,10 @@ Of course, please use the `compact_table` function:

```sql
-- Schedule a compaction for table test --
select compact_table("test");
ADMIN compact_table("test");
```

There are many [administration functions](/reference/sql/functions/overview.md#admin-functions) for database management.
There are many [administration functions](/reference/sql/admin.md#admin-functions) for database management.

### Can GreptimeDB be used to store logs?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ ETCD_REGISTRY=greptime-registry.cn-hangzhou.cr.aliyuncs.com \
docker compose -f ./cluster-with-etcd.yaml down
```

默认情况下,数据将被存储在 `/tmp/greptimedb-cluster-docker-compose`。如果你想清理数据,也可以删除数据目录:

```
rm -rf /tmp/greptimedb-cluster-docker-compose
```
默认情况下,数据将被存储在 `/tmp/greptimedb-cluster-docker-compose`。如果你想清理数据,也可删除该目录。

## 在 Kubernetes 中部署 GreptimeDB 集群

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ curl -fsSL \

```shell
docker run -p 127.0.0.1:4000-4003:4000-4003 \
-v "$(pwd)/greptimedb:/tmp/greptimedb" \
--name greptime --rm \
greptime/greptimedb:VAR::greptimedbVersion standalone start \
--http-addr 0.0.0.0:4000 \
--rpc-addr 0.0.0.0:4001 \
--mysql-addr 0.0.0.0:4002 \
--postgres-addr 0.0.0.0:4003
-v "$(pwd)/greptimedb:/tmp/greptimedb" \
--name greptime --rm \
greptime-registry.cn-hangzhou.cr.aliyuncs.com/greptime/greptimedb:VAR::greptimedbVersion standalone start \
--http-addr 0.0.0.0:4000 \
--rpc-addr 0.0.0.0:4001 \
--mysql-addr 0.0.0.0:4002 \
--postgres-addr 0.0.0.0:4003
```

:::tip 注意事项
Expand All @@ -70,17 +70,17 @@ greptime/greptimedb:VAR::greptimedbVersion standalone start \

```shell
docker run --security-opt seccomp=unconfined -p 4000-4003:4000-4003 \
-v "$(pwd)/greptimedb:/tmp/greptimedb" \
--name greptime --rm \
greptime/greptimedb:VAR::greptimedbVersion standalone start \
--http-addr 0.0.0.0:4000 \
--rpc-addr 0.0.0.0:4001 \
--mysql-addr 0.0.0.0:4002 \
--postgres-addr 0.0.0.0:4003
-v "$(pwd)/greptimedb:/tmp/greptimedb" \
--name greptime --rm \
greptime-registry.cn-hangzhou.cr.aliyuncs.com/greptime/greptimedb:VAR::greptimedbVersion standalone start \
--http-addr 0.0.0.0:4000 \
--rpc-addr 0.0.0.0:4001 \
--mysql-addr 0.0.0.0:4002 \
--postgres-addr 0.0.0.0:4003
```

2. 将 Docker 版本升级到 v23.0.0 或更高;
:::
:::

## 绑定地址

Expand Down Expand Up @@ -108,13 +108,13 @@ GreptimeDB 默认绑定地址为 `127.0.0.1`。如果你需要能够接收来自

```shell
docker run -p 0.0.0.0:4000-4003:4000-4003 \
-v "$(pwd)/greptimedb:/tmp/greptimedb" \
--name greptime --rm \
greptime/greptimedb:VAR::greptimedbVersion standalone start \
--http-addr 0.0.0.0:4000 \
--rpc-addr 0.0.0.0:4001 \
--mysql-addr 0.0.0.0:4002 \
--postgres-addr 0.0.0.0:4003
-v "$(pwd)/greptimedb:/tmp/greptimedb" \
--name greptime --rm \
greptime-registry.cn-hangzhou.cr.aliyuncs.com/greptime/greptimedb:VAR::greptimedbVersion standalone start \
--http-addr 0.0.0.0:4000 \
--rpc-addr 0.0.0.0:4001 \
--mysql-addr 0.0.0.0:4002 \
--postgres-addr 0.0.0.0:4003
```

</TabItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@

## 连接到 GreptimeDB

GreptimeDB 支持[多种协议](/user-guide/clients/overview.md)与数据库进行交互。
GreptimeDB 支持[多种协议](/user-guide/protocols/overview.md)与数据库进行交互。
在本快速入门文档中,我们使用 SQL 作为实例。

如果你的 GreptimeDB 实例运行在 `127.0.0.1` 中,
并且使用 MySQL 客户端默认端口 `4002` 或 PostgreSQL 客户端默认端口 `4003`
你可以使用以下命令连接到数据库:
你可以使用以下命令连接到数据库。

GreptimeDB 默认不开启[鉴权认证](/user-guide/operations/authentication.md)
在本章节中你可以在连接数据库时不提供用户名密码。

```shell
mysql -h 127.0.0.1 -P 4002
Expand Down Expand Up @@ -369,7 +372,7 @@ grpc_metrics,host=host2,method_name=GetUser latency=110,code=1 17207280210000000
你现在已经体验了 GreptimeDB 的核心功能。
要进一步探索和利用 GreptimeDB:

- [使用 Grafana 可视化数据](/user-guide/clients/grafana.md)
- [使用 Grafana 可视化数据](/user-guide/integrations/grafana.md)
- [探索更多 GreptimeDB 的 Demo](https://github.com/GreptimeTeam/demo-scene/)
- [阅读用户指南文档以了解更多关于 GreptimeDB 的详细信息](/user-guide/overview.md)

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ GreptimeDB 服务可以配置为 [Grafana 数据源](https://grafana.com/docs/gr
## GreptimeDB 数据源插件

在使用 GreptimeDB 数据源之前,需要手动安装 GreptimeDB 数据源插件。
有关更多信息,请参考 [使用 GreptimeDB 数据源文档](https://docs.greptime.cn/user-guide/clients/grafana#greptimedb-数据源插件)
有关更多信息,请参考 [使用 GreptimeDB 数据源文档](https://docs.greptime.cn/user-guide/integrations/grafana#greptimedb-数据源插件)

在 Grafana 中单击 Add data source 按钮,选择 GreptimeDB 作为类型。

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# InfluxDB Line Protocol

GreptimeCloud 提供了 [Influxdb line protocol](https://docs.influxdata.com/influxdb/cloud/reference/syntax/line-protocol/) 的 http 接口。该接口和认证与 [InfluxDB write protocol 1.x](https://docs.influxdata.com/influxdb/v1.8/guides/write_data/#write-data-using-the-influxdb-api) 兼容。更多信息请参考 GreptimeDB 的 [InfluxDB 客户端](https://docs.greptime.cn/user-guide/clients/influxdb-line)
GreptimeCloud 提供了 [Influxdb line protocol](https://docs.influxdata.com/influxdb/cloud/reference/syntax/line-protocol/) 的 http 接口。该接口和认证与 [InfluxDB write protocol 1.x](https://docs.influxdata.com/influxdb/v1.8/guides/write_data/#write-data-using-the-influxdb-api) 兼容。更多信息请参考 GreptimeDB 的 [InfluxDB 客户端](https://docs.greptime.cn/user-guide/protocols/influxdb-line-protocol)

- URL: `https://<host>/v1/influxdb/write?db=<dbname>`
- Username: `<username>`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ To send OpenTelemetry Metrics to GreptimeDB through OpenTelemetry SDK libraries,
* URL: `https://<host>/v1/otlp/v1/metrics`
* Headers:
* `X-Greptime-DB-Name`: `<dbname>`
* `Authorization`: `Basic` authentication, which is a Base64 encoded string of `<username>:<password>`. For more information, please refer to [Authentication](https://docs.greptime.com/user-guide/clients/authentication) and [HTTP API](https://docs.greptime.com/user-guide/clients/http-api#authentication)
* `Authorization`: `Basic` authentication, which is a Base64 encoded string of `<username>:<password>`. For more information, please refer to [Authentication](https://docs.greptime.com/user-guide/operations/authentication) and [HTTP API](https://docs.greptime.com/user-guide/protocols/http#authentication)

The request uses binary protobuf to encode the payload, so you need to use packages that support `HTTP/protobuf`. For example, in Node.js, you can use [`exporter-trace-otlp-proto`](https://www.npmjs.com/package/@opentelemetry/exporter-trace-otlp-proto); in Go, you can use [`go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp); in Java, you can use [`io.opentelemetry:opentelemetry-exporter-otlp`](https://mvnrepository.com/artifact/io.opentelemetry/opentelemetry-exporter-otlp); and in Python, you can use [`opentelemetry-exporter-otlp-proto-http`](https://pypi.org/project/opentelemetry-exporter-otlp-proto-http/).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

GreptimeCloud 支持用 PostgreSQL v3 协议访问 GreptimeDB。大多数标准客户端和驱动程序在协议级别上兼容,且连接使用TLS加密。
请注意,我们在 GreptimeDB 中不使用 Postgres 的 SQL 方言,因此可能有一些不支持的语句。
有关更多信息,请参考 GreptimeDB 的[Postgresql文档](https://docs.greptime.cn/user-guide/clients/postgresql)
有关更多信息,请参考 GreptimeDB 的[Postgresql文档](https://docs.greptime.cn/user-guide/protocols/postgresql)

要使用 Postgres 协议连接到 GreptimeCloud,请使用以下信息:

Expand Down
Loading

0 comments on commit 970c60a

Please sign in to comment.