Skip to content

Commit

Permalink
chore: v0.9 blank spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
nicecui committed Aug 20, 2024
1 parent d9484d7 commit 44db20a
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 101 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ greptime/greptimedb:VAR::greptimedbVersion standalone start \

1. 设置 `--security-opt seccomp=unconfined`

```shell
```shell
docker run --security-opt seccomp=unconfined -p 4000-4003:4000-4003 \
-v "$(pwd)/greptimedb:/tmp/greptimedb" \
--name greptime --rm \
Expand All @@ -77,7 +77,7 @@ greptime/greptimedb:VAR::greptimedbVersion standalone start \
--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
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@

1. 使用 MySQL cli 连接到 Frontend。

```shell
```shell
mysql -h 127.0.0.1 -P 4002
```
```

2. 通过 `CREATE` 语句创建一个分布式表。

```SQL
```SQL
CREATE TABLE dist_table(
ts TIMESTAMP DEFAULT current_timestamp(),
n INT,
Expand All @@ -32,11 +32,11 @@
n >= 9
)
engine=mito;
```
```

结果如下:

```shell
```shell
mysql> CREATE TABLE dist_table(
-> ts TIMESTAMP DEFAULT current_timestamp(),
-> n INT,
Expand All @@ -51,13 +51,13 @@
-> )
-> engine=mito;
Query OK, 3 rows affected (0.09 sec)
```
```

`dist_table` 被分布在 `Datanode` 中。你可以参考 ["Table Sharding"](/contributor-guide/frontend/table-sharding.md) 了解更多细节。

3. 通过 `INSERT` 语句输入一些数据。

```SQL
```SQL
INSERT INTO dist_table(n, row_id) VALUES (1, 1);
INSERT INTO dist_table(n, row_id) VALUES (2, 2);
INSERT INTO dist_table(n, row_id) VALUES (3, 3);
Expand All @@ -70,15 +70,15 @@
INSERT INTO dist_table(n, row_id) VALUES (10, 10);
INSERT INTO dist_table(n, row_id) VALUES (11, 11);
INSERT INTO dist_table(n, row_id) VALUES (12, 12);
```
```

4. 通过 `SELECT` 语句执行查询:

```sql
```sql
SELECT * FROM dist_table ORDER BY n LIMIT 5;
```
```

```sql
```sql
+---------------------+------+--------+
| ts | n | row_id |
+---------------------+------+--------+
Expand All @@ -89,39 +89,39 @@
| 2022-11-14 12:02:32 | 5 | 5 |
+---------------------+------+--------+
5 rows in set (0.081 sec)
```
```

```sql
```sql
SELECT MAX(n) FROM dist_table;
```
```

```sql
```sql
+-------------------+
| MAX(dist_table.n) |
+-------------------+
| 12 |
+-------------------+
1 row in set (0.057 sec)
```
```

```sql
```sql
SELECT MIN(n) FROM dist_table;
```
```

```sql
```sql
+-------------------+
| MIN(dist_table.n) |
+-------------------+
| 1 |
+-------------------+
1 row in set (0.079 sec)
```
```

```sql
```sql
SELECT * FROM dist_table WHERE n > 2 AND n < 10 ORDER BY row_id;
```
```

```sql
```sql
+---------------------+------+--------+
| ts | n | row_id |
+---------------------+------+--------+
Expand All @@ -134,18 +134,18 @@
| 2022-11-14 12:02:32 | 9 | 9 |
+---------------------+------+--------+
7 rows in set (0.02 sec)
```
```

```sql
```sql
SELECT * FROM dist_table WHERE row_id = 10;
```
```

```sql
```sql
+---------------------+------+--------+
| ts | n | row_id |
+---------------------+------+--------+
| 2022-11-14 12:02:32 | 10 | 10 |
+---------------------+------+--------+
1 row in set (0.03 sec)
```
```

Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,16 @@ docker run \

1. **用 MySQL 协议连接 GrepimeDB**

```
```
mysql -h 127.0.0.1 -P 4002
```
```


2. **写入测试数据**

- 创建 `system_metrics`

```sql
```sql
CREATE TABLE IF NOT EXISTS system_metrics (
host STRING,
idc STRING,
Expand All @@ -102,11 +102,11 @@ docker run \
PRIMARY KEY(host, idc),
TIME INDEX(ts)
);
```
```

- 写入测试数据

```sql
```sql
INSERT INTO system_metrics
VALUES
("host1", "idc_a", 11.8, 10.3, 10.3, 1667446797450),
Expand All @@ -118,24 +118,24 @@ docker run \
("host1", "idc_b", 78.0, 66.7, 20.6, 1667446798050),
("host1", "idc_b", 68.0, 63.9, 50.6, 1667446798150),
("host1", "idc_b", 90.0, 39.9, 60.6, 1667446798250);
```
```

3. **查询数据**

```sql
```sql
SELECT * FROM system_metrics;
```
```

4. **查询 Kafka Topics**

```
```
# List the Kafka topics.
docker exec kafka /opt/bitnami/kafka/bin/kafka-topics.sh --list --bootstrap-server localhost:9092
```
```
默认所有 topic 都以 `greptimedb_wal_topic` 开头,例如:
```
```
docker exec kafka /opt/bitnami/kafka/bin/kafka-topics.sh --list --bootstrap-server localhost:9092
greptimedb_wal_topic_0
greptimedb_wal_topic_1
Expand All @@ -146,20 +146,20 @@ docker run \

- 停止 GreptimeDB 和 Kafka

```
```
docker stop greptimedb
docker stop kafka
```
```

- 移除 Docker bridge

```
```
docker network rm greptimedb-remote-wal
```
```

- 删除数据

```
```
rm -r <working-dir>/greptimedb
rm -r <working-dir>/kafka-data
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ You can:

1. Set `--security-opt seccomp=unconfined`, for example:

```shell
```shell
docker run --security-opt seccomp=unconfined -p 4000-4003:4000-4003 \
-v "$(pwd)/greptimedb:/tmp/greptimedb" \
--name greptime --rm \
Expand All @@ -77,7 +77,7 @@ You can:
--rpc-addr 0.0.0.0:4001 \
--mysql-addr 0.0.0.0:4002 \
--postgres-addr 0.0.0.0:4003
```
```

2. Upgrade the Docker version to v23.0.0 or higher;
:::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ You can find the GreptimeDB URL, database name, as well as the username and pass

<TabItem value="InfluxDB line protocol v2" label="InfluxDB line protocol v2">

```shell
```shell
curl -X POST 'https://<host>/v1/influxdb/api/v2/write?bucket=<db-name>' \
-H 'authorization: token <greptime_user:greptimedb_password>' \
-d 'census,location=klamath,scientist=anderson bees=23 1566086400000000000'
Expand All @@ -26,7 +26,7 @@ curl -X POST 'https://<host>/v1/influxdb/api/v2/write?bucket=<db-name>' \

<TabItem value="InfluxDB line protocol v1" label="InfluxDB line protocol v1">

```shell
```shell
curl 'https://<host>/v1/influxdb/write?db=<db-name>&u=<greptime_user>&p=<greptimedb_password>' \
-d 'census,location=klamath,scientist=anderson bees=23 1566086400000000000'
```
Expand All @@ -44,7 +44,7 @@ curl 'https://<host>/v1/influxdb/write?db=<db-name>&u=<greptime_user>&p=<greptim

<TabItem value="InfluxDB line protocol v2" label="InfluxDB line protocol v2">

```toml
```toml
[[outputs.influxdb_v2]]
urls = ["https://<host>/v1/influxdb"]
token = "<greptime_user>:<greptimedb_password>"
Expand All @@ -57,7 +57,7 @@ curl 'https://<host>/v1/influxdb/write?db=<db-name>&u=<greptime_user>&p=<greptim

<TabItem value="InfluxDB line protocol v1" label="InfluxDB line protocol v1">

```toml
```toml
[[outputs.influxdb]]
urls = ["https://<host>/v1/influxdb"]
database = "<db-name>"
Expand All @@ -77,7 +77,7 @@ curl 'https://<host>/v1/influxdb/write?db=<db-name>&u=<greptime_user>&p=<greptim

<TabItem value="Node.js" label="Node.js">

```js
```js
'use strict'
/** @module write
**/
Expand Down
4 changes: 2 additions & 2 deletions versioned_docs/version-0.9/reference/sql/cast.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ CAST (expression AS data_type)

Convert a string to an integer:

```sql
```sql
SELECT CAST('123' AS INT) ;
```
```

```sql
+-------------+
Expand Down
Loading

0 comments on commit 44db20a

Please sign in to comment.