Skip to content

Commit

Permalink
docs: add upgrade note for using InfluxDB protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
WenyXu committed May 18, 2024
1 parent 59c7d27 commit 0ff9dcf
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 15 deletions.
13 changes: 4 additions & 9 deletions docs/nightly/en/user-guide/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ For a complete upgrade, you will need to execute this tools twice with each targ
Here is a complete example for upgrading from `v0.7.x` to `v0.8.0`.
### Upgrade from 0.7.0 or 0.7.1
:::warning NOTICE
If you are using `v0.7.0` or `v0.7.1`, Please replace the old version with `v0.7.11`(Open the data directory using the GreptimeDB `v0.7.11`).
:::
### Export `CREATE TABLE`
Assuming the HTTP service port of the old database is `4000`.
Expand Down Expand Up @@ -88,7 +83,7 @@ CREATE TABLE foo (
TIME INDEX (ts),
PRIMARY KEY(host)
) ENGINE=mito
WITH(
WITH( # Delete
regions=1
);
```
Expand Down Expand Up @@ -136,7 +131,7 @@ CREATE TABLE IF NOT EXISTS "phy" (
"__tsid" BIGINT UNSIGNED NOT NULL,
"host" STRING NULL,
"job" STRING NULL,
PRIMARY KEY ("__table_id", "__tsid", "host", "job")
PRIMARY KEY ("__table_id", "__tsid", "host", "job") # Modify this line
)
ENGINE=metric
WITH(
Expand Down Expand Up @@ -185,7 +180,7 @@ CREATE TABLE IF NOT EXISTS "phy" (
"host" STRING NULL,
"job" STRING NULL,
PRIMARY KEY ("host", "job")
TIME INDEX ("ts")
TIME INDEX ("ts") # Add this line
)
ENGINE=metric
WITH(
Expand All @@ -200,7 +195,7 @@ Related [issue](https://github.com/GreptimeTeam/greptimedb/pull/3794)
Before:
```sql
CREATE TABLE IF NOT EXISTS "phy" (
"ts" TIMESTAMP(6) NOT NULL,
"ts" TIMESTAMP(6) NOT NULL, # Modify this line
"val" DOUBLE NULL,
"host" STRING NULL,
"job" STRING NULL,
Expand Down
42 changes: 36 additions & 6 deletions docs/nightly/zh/user-guide/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ OPTIONS:
对于完整的升级,您需要使用每个目标选项两次执行此工具。
## 示例
## 从 0.7.x 升级
这一节将演示如何从 `v0.7.x` 升级到 `v0.8.0`
在下面的文本中,我们假设您的 Frontend 的 HTTP 端口为 `127.0.0.1:4000`。输出目录是 `/tmp/greptimedb-export`
在下面的文本中,我们假设您的数据库的 HTTP 端口为 `127.0.0.1:4000`
### 导出 `CREATE TABLE`
Expand Down Expand Up @@ -101,7 +101,7 @@ CREATE TABLE foo (
TIME INDEX (ts),
PRIMARY KEY(host)
) ENGINE=mito
WITH(
WITH( # 删除
regions=1
);
```
Expand Down Expand Up @@ -149,7 +149,7 @@ CREATE TABLE IF NOT EXISTS "phy" (
"__tsid" BIGINT UNSIGNED NOT NULL,
"host" STRING NULL,
"job" STRING NULL,
PRIMARY KEY ("__table_id", "__tsid", "host", "job")
PRIMARY KEY ("__table_id", "__tsid", "host", "job") # 修改此处
)
ENGINE=metric
WITH(
Expand Down Expand Up @@ -183,7 +183,7 @@ CREATE TABLE IF NOT EXISTS "phy" (
"val" DOUBLE NULL,
"host" STRING NULL,
"job" STRING NULL,
PRIMARY KEY ("host", "job")
PRIMARY KEY ("host", "job")
)
ENGINE=metric
WITH(
Expand All @@ -199,14 +199,44 @@ CREATE TABLE IF NOT EXISTS "phy" (
"host" STRING NULL,
"job" STRING NULL,
PRIMARY KEY ("host", "job")
TIME INDEX ("ts")
TIME INDEX ("ts") # 添加在此处
)
ENGINE=metric
WITH(
physical_metric_table = ''
);
```
#### 为 InfluxDB 协议的表更新建表语句
相关 [issue](https://github.com/GreptimeTeam/greptimedb/pull/3794)
修改前:
```sql
CREATE TABLE IF NOT EXISTS "phy" (
"ts" TIMESTAMP(6) NOT NULL, # 修改此处
"val" DOUBLE NULL,
"host" STRING NULL,
"job" STRING NULL,
PRIMARY KEY ("host", "job"),
TIME INDEX ("ts")
)
ENGINE=mito;
```
修改后:
```sql
CREATE TABLE IF NOT EXISTS "phy" (
"ts" TIMESTAMP(9) NOT NULL,
"val" DOUBLE NULL,
"host" STRING NULL,
"job" STRING NULL,
PRIMARY KEY ("host", "job"),
TIME INDEX ("ts")
)
ENGINE=mito;
```
### 导入表结构和数据
Expand Down

0 comments on commit 0ff9dcf

Please sign in to comment.