Skip to content

Commit 6dd7e4c

Browse files
committed
use standard Flink docker
1 parent 64971b1 commit 6dd7e4c

File tree

1 file changed

+73
-17
lines changed

1 file changed

+73
-17
lines changed

website/docs/quickstart/flink.md

Lines changed: 73 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,15 @@ mkdir fluss-quickstart-flink
3333
cd fluss-quickstart-flink
3434
```
3535

36-
2. Create a `docker-compose.yml` file with the following content:
36+
2. Create a Dockerfile named `fluss.Dockerfile` as follows. You can adjust the Flink version as needed. Please make sure to download the compatible versions of [fluss-flink connector jar](/downloads), [flink-connector-faker](https://github.com/knaufk/flink-faker/releases) in the Dockerfile.
37+
38+
```yaml
39+
FROM flink:1.20.2-scala_2.12
40+
RUN wget -P /opt/flink/lib https://github.com/knaufk/flink-faker/releases/download/v0.5.3/flink-faker-0.5.3.jar
41+
RUN wget -P /opt/flink/lib https://repo1.maven.org/maven2/org/apache/fluss/fluss-flink-1.20/0.8.0-incubating/fluss-flink-1.20-0.8.0-incubating.jar
42+
```
43+
44+
3. Create a `docker-compose.yml` file with the following content:
3745

3846

3947
```yaml
@@ -69,7 +77,8 @@ services:
6977
#end
7078
#begin Flink cluster
7179
jobmanager:
72-
image: apache/fluss-quickstart-flink:1.20-$FLUSS_DOCKER_VERSION$
80+
build:
81+
dockerfile: ./fluss.Dockerfile
7382
ports:
7483
- "8083:8081"
7584
command: jobmanager
@@ -78,7 +87,8 @@ services:
7887
FLINK_PROPERTIES=
7988
jobmanager.rpc.address: jobmanager
8089
taskmanager:
81-
image: apache/fluss-quickstart-flink:1.20-$FLUSS_DOCKER_VERSION$
90+
build:
91+
dockerfile: ./fluss.Dockerfile
8292
depends_on:
8393
- jobmanager
8494
command: taskmanager
@@ -89,16 +99,23 @@ services:
8999
taskmanager.numberOfTaskSlots: 10
90100
taskmanager.memory.process.size: 2048m
91101
taskmanager.memory.framework.off-heap.size: 256m
102+
sql-client:
103+
build:
104+
dockerfile: ./fluss.Dockerfile
105+
command: bin/sql-client.sh
106+
depends_on:
107+
- jobmanager
108+
environment:
109+
- |
110+
FLINK_PROPERTIES=
111+
jobmanager.rpc.address: jobmanager
112+
rest.address: jobmanager
92113
#end
93114
```
94115

95116
The Docker Compose environment consists of the following containers:
96117
- **Fluss Cluster:** a Fluss `CoordinatorServer`, a Fluss `TabletServer` and a `ZooKeeper` server.
97-
- **Flink Cluster**: a Flink `JobManager` and a Flink `TaskManager` container to execute queries.
98-
99-
**Note:** The `apache/fluss-quickstart-flink` image is based on [flink:1.20.1-java17](https://hub.docker.com/layers/library/flink/1.20-java17/images/sha256:bf1af6406c4f4ad8faa46efe2b3d0a0bf811d1034849c42c1e3484712bc83505) and
100-
includes the [fluss-flink](engine-flink/getting-started.md) and
101-
[flink-connector-faker](https://flink-packages.org/packages/flink-faker) to simplify this guide.
118+
- **Flink Cluster**: a Flink `JobManager`, a Flink `TaskManager`, and a Flink SQL client container to execute queries.
102119

103120
3. To start all containers, run:
104121
```shell
@@ -116,7 +133,6 @@ You can also visit http://localhost:8083/ to see if Flink is running normally.
116133

117134
:::note
118135
- If you want to additionally use an observability stack, follow one of the provided quickstart guides [here](maintenance/observability/quickstart.md) and then continue with this guide.
119-
- If you want to run with your own Flink environment, remember to download the [fluss-flink connector jar](/downloads), [flink-connector-faker](https://github.com/knaufk/flink-faker/releases) and then put them to `FLINK_HOME/lib/`.
120136
- All the following commands involving `docker compose` should be executed in the created working directory that contains the `docker-compose.yml` file.
121137
:::
122138

@@ -125,26 +141,66 @@ Congratulations, you are all set!
125141
## Enter into SQL-Client
126142
First, use the following command to enter the Flink SQL CLI Container:
127143
```shell
128-
docker compose exec jobmanager ./sql-client
144+
docker compose run sql-client
129145
```
130146

131-
**Note**:
132-
To simplify this guide, three temporary tables have been pre-created with `faker` connector to generate data.
133-
You can view their schemas by running the following commands:
147+
To simplify this guide, we will create three temporary tables with `faker` connector to generate data:
134148

135149
```sql title="Flink SQL"
136-
SHOW CREATE TABLE source_customer;
150+
CREATE TEMPORARY TABLE source_order (
151+
`order_key` BIGINT,
152+
`cust_key` INT,
153+
`total_price` DECIMAL(15, 2),
154+
`order_date` DATE,
155+
`order_priority` STRING,
156+
`clerk` STRING
157+
) WITH (
158+
'connector' = 'faker',
159+
'rows-per-second' = '10',
160+
'number-of-rows' = '10000',
161+
'fields.order_key.expression' = '#{number.numberBetween ''0'',''100000000''}',
162+
'fields.cust_key.expression' = '#{number.numberBetween ''0'',''20''}',
163+
'fields.total_price.expression' = '#{number.randomDouble ''3'',''1'',''1000''}',
164+
'fields.order_date.expression' = '#{date.past ''100'' ''DAYS''}',
165+
'fields.order_priority.expression' = '#{regexify ''(low|medium|high){1}''}',
166+
'fields.clerk.expression' = '#{regexify ''(Clerk1|Clerk2|Clerk3|Clerk4){1}''}'
167+
);
137168
```
138169

139170
```sql title="Flink SQL"
140-
SHOW CREATE TABLE source_order;
171+
CREATE TEMPORARY TABLE source_customer (
172+
`cust_key` INT,
173+
`name` STRING,
174+
`phone` STRING,
175+
`nation_key` INT NOT NULL,
176+
`acctbal` DECIMAL(15, 2),
177+
`mktsegment` STRING,
178+
PRIMARY KEY (`cust_key`) NOT ENFORCED
179+
) WITH (
180+
'connector' = 'faker',
181+
'number-of-rows' = '200',
182+
'fields.cust_key.expression' = '#{number.numberBetween ''0'',''20''}',
183+
'fields.name.expression' = '#{funnyName.name}',
184+
'fields.nation_key.expression' = '#{number.numberBetween ''1'',''5''}',
185+
'fields.phone.expression' = '#{phoneNumber.cellPhone}',
186+
'fields.acctbal.expression' = '#{number.randomDouble ''3'',''1'',''1000''}',
187+
'fields.mktsegment.expression' = '#{regexify ''(AUTOMOBILE|BUILDING|FURNITURE|MACHINERY|HOUSEHOLD){1}''}'
188+
);
141189
```
142190

143191
```sql title="Flink SQL"
144-
SHOW CREATE TABLE source_nation;
192+
CREATE TEMPORARY TABLE `source_nation` (
193+
`nation_key` INT NOT NULL,
194+
`name` STRING,
195+
PRIMARY KEY (`nation_key`) NOT ENFORCED
196+
) WITH (
197+
'connector' = 'faker',
198+
'number-of-rows' = '100',
199+
'fields.nation_key.expression' = '#{number.numberBetween ''1'',''5''}',
200+
'fields.name.expression' = '#{regexify ''(CANADA|JORDAN|CHINA|UNITED|INDIA){1}''}'
201+
);
145202
```
146203

147-
148204
## Create Fluss Tables
149205
### Create Fluss Catalog
150206
Use the following SQL to create a Fluss catalog:

0 commit comments

Comments
 (0)