-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[FLINK-35634] Add CdcUp playground CLI scripts #3605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
0b720cb
[FLINK-35634] Add CdcUp playground CLI scripts
yuxiqian 7f7325b
fix: use unified proxy port for starrocks
yuxiqian 382d3e1
nit: bump to cdc 3.2.1
yuxiqian 5a619e4
docs: fix README.md
yuxiqian 4225ecb
cli: allow accessing MySQL CLI
yuxiqian 1dea7a1
minor: update README docs & fix `flink` command glitch
yuxiqian 47a61f3
nit: unify emoji
yuxiqian b84e812
docs: add quickstart guide
yuxiqian 9288f5d
legal: add missing ASF license headers
yuxiqian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
108 changes: 108 additions & 0 deletions
108
docs/content.zh/docs/get-started/quickstart/cdc-up-quickstart-guide.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| --- | ||
| title: "CdcUp Quickstart Guide" | ||
| weight: 3 | ||
| type: docs | ||
| aliases: | ||
| - /get-started/quickstart/cdc-up-quickstart-guide | ||
| --- | ||
| <!-- | ||
| Licensed to the Apache Software Foundation (ASF) under one | ||
| or more contributor license agreements. See the NOTICE file | ||
| distributed with this work for additional information | ||
| regarding copyright ownership. The ASF licenses this file | ||
| to you under the Apache License, Version 2.0 (the | ||
| "License"); you may not use this file except in compliance | ||
| with the License. You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, | ||
| software distributed under the License is distributed on an | ||
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| KIND, either express or implied. See the License for the | ||
| specific language governing permissions and limitations | ||
| under the License. | ||
| --> | ||
|
|
||
| # Setting-up a CDC Pipeline Environment with CdcUp CLI | ||
|
|
||
| Flink CDC now provides a CdcUp CLI utility to start a playground environment and run Flink CDC jobs quickly. | ||
|
|
||
| You will need a working Docker and Docker Compose V2 environment to use it. | ||
|
|
||
| ## Step-by-step Guide | ||
|
|
||
| 1. Open a terminal and run `git clone https://github.com/apache/flink-cdc.git --depth=1` to retrieve a copy of Flink CDC source code. | ||
|
|
||
| 2. Run `cd flink-cdc/tools/cdcup/` to enter CDC directory and run `./cdcup.sh` to use the "cdc-up" tool to start a playground environment. You should see the following output: | ||
|
|
||
| ``` | ||
| Usage: ./cdcup.sh { init | up | pipeline <yaml> | flink | mysql | stop | down | help } | ||
|
|
||
| Commands: | ||
| * init: | ||
| Initialize a playground environment, and generate configuration files. | ||
|
|
||
| * up: | ||
| Start docker containers. This may take a while before database is ready. | ||
|
|
||
| * pipeline <yaml>: | ||
| Submit a YAML pipeline job. | ||
|
|
||
| * flink: | ||
| Print Flink Web dashboard URL. | ||
|
|
||
| * mysql: | ||
| Open MySQL console. | ||
|
|
||
| * stop: | ||
| Stop all running playground containers. | ||
|
|
||
| * down: | ||
| Stop and remove containers, networks, and volumes. | ||
|
|
||
| * help: | ||
| Print this message. | ||
| ``` | ||
|
|
||
| 3. Run `./cdcup.sh init`, waiting for pulling base docker image, and you should see the following output: | ||
|
|
||
| ``` | ||
| 🎉 Welcome to cdc-up quickstart wizard! | ||
| There are a few questions to ask before getting started: | ||
| 🐿️ Which Flink version would you like to use? (Press ↑/↓ arrow to move and Enter to select) | ||
| 1.17.2 | ||
| 1.18.1 | ||
| 1.19.1 | ||
| ‣ 1.20.0 | ||
| ``` | ||
|
|
||
| Use the arrow keys to navigate and press Enter to select specified Flink and CDC version, source, and sink connectors. | ||
|
|
||
| 4. Run `./cdcup.sh up` to boot-up docker containers, and wait for them to be ready. Some sink connectors (like Doris and StarRocks) need some time to initialize and ready for handling requests. | ||
|
|
||
| 5. If you're choosing MySQL as data source, you need to run `./cdcup.sh mysql` to open a MySQL session and create at least one table. | ||
|
|
||
| For example, the following SQL commands create a database and a table, insert some test data, and verify the result: | ||
|
|
||
| ```sql | ||
| -- initialize db and table | ||
| CREATE DATABASE cdc_playground; | ||
| USE cdc_playground; | ||
| CREATE TABLE test_table (id INT PRIMARY KEY, name VARCHAR(32)); | ||
|
|
||
| -- insert test data | ||
| INSERT INTO test_table VALUES (1, 'alice'), (2, 'bob'), (3, 'cicada'), (4, 'derrida'); | ||
|
|
||
| -- verify if it has been successfully inserted | ||
| SELECT * FROM test_table; | ||
| ``` | ||
|
|
||
| 6. Run `./cdcup.sh pipeline pipeline-definition.yaml` to submit the pipeline job. You may also edit the pipeline definition file for further configurations. | ||
|
|
||
| 7. Run `./cdcup.sh flink` and navigate to the printed URL to access the Flink Web UI. | ||
|
|
||
| ``` | ||
| $ ./cdcup.sh flink | ||
| 🚩 Visit Flink Dashboard at: http://localhost:33448 | ||
| ``` |
108 changes: 108 additions & 0 deletions
108
docs/content/docs/get-started/quickstart/cdc-up-quickstart-guide.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| --- | ||
| title: "CdcUp Quickstart Guide" | ||
| weight: 3 | ||
| type: docs | ||
| aliases: | ||
| - /get-started/quickstart/cdc-up-quickstart-guide | ||
| --- | ||
| <!-- | ||
| Licensed to the Apache Software Foundation (ASF) under one | ||
| or more contributor license agreements. See the NOTICE file | ||
| distributed with this work for additional information | ||
| regarding copyright ownership. The ASF licenses this file | ||
| to you under the Apache License, Version 2.0 (the | ||
| "License"); you may not use this file except in compliance | ||
| with the License. You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, | ||
| software distributed under the License is distributed on an | ||
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| KIND, either express or implied. See the License for the | ||
| specific language governing permissions and limitations | ||
| under the License. | ||
| --> | ||
|
|
||
| # Setting-up a CDC Pipeline Environment with CdcUp CLI | ||
|
|
||
| Flink CDC now provides a CdcUp CLI utility to start a playground environment and run Flink CDC jobs quickly. | ||
|
|
||
| You will need a working Docker and Docker Compose V2 environment to use it. | ||
|
|
||
| ## Step-by-step Guide | ||
|
|
||
| 1. Open a terminal and run `git clone https://github.com/apache/flink-cdc.git --depth=1` to retrieve a copy of Flink CDC source code. | ||
|
|
||
| 2. Run `cd flink-cdc/tools/cdcup/` to enter CDC directory and run `./cdcup.sh` to use the "cdc-up" tool to start a playground environment. You should see the following output: | ||
|
|
||
| ``` | ||
| Usage: ./cdcup.sh { init | up | pipeline <yaml> | flink | mysql | stop | down | help } | ||
|
|
||
| Commands: | ||
| * init: | ||
| Initialize a playground environment, and generate configuration files. | ||
|
|
||
| * up: | ||
| Start docker containers. This may take a while before database is ready. | ||
|
|
||
| * pipeline <yaml>: | ||
| Submit a YAML pipeline job. | ||
|
|
||
| * flink: | ||
| Print Flink Web dashboard URL. | ||
|
|
||
| * mysql: | ||
| Open MySQL console. | ||
|
|
||
| * stop: | ||
| Stop all running playground containers. | ||
|
|
||
| * down: | ||
| Stop and remove containers, networks, and volumes. | ||
|
|
||
| * help: | ||
| Print this message. | ||
| ``` | ||
|
|
||
| 3. Run `./cdcup.sh init`, waiting for pulling base docker image, and you should see the following output: | ||
|
|
||
| ``` | ||
| 🎉 Welcome to cdc-up quickstart wizard! | ||
| There are a few questions to ask before getting started: | ||
| 🐿️ Which Flink version would you like to use? (Press ↑/↓ arrow to move and Enter to select) | ||
| 1.17.2 | ||
| 1.18.1 | ||
| 1.19.1 | ||
| ‣ 1.20.0 | ||
| ``` | ||
|
|
||
| Use the arrow keys to navigate and press Enter to select specified Flink and CDC version, source, and sink connectors. | ||
|
|
||
| 4. Run `./cdcup.sh up` to boot-up docker containers, and wait for them to be ready. Some sink connectors (like Doris and StarRocks) need some time to initialize and ready for handling requests. | ||
|
|
||
| 5. If you're choosing MySQL as data source, you need to run `./cdcup.sh mysql` to open a MySQL session and create at least one table. | ||
|
|
||
| For example, the following SQL commands create a database and a table, insert some test data, and verify the result: | ||
|
|
||
| ```sql | ||
| -- initialize db and table | ||
| CREATE DATABASE cdc_playground; | ||
| USE cdc_playground; | ||
| CREATE TABLE test_table (id INT PRIMARY KEY, name VARCHAR(32)); | ||
|
|
||
| -- insert test data | ||
| INSERT INTO test_table VALUES (1, 'alice'), (2, 'bob'), (3, 'cicada'), (4, 'derrida'); | ||
|
|
||
| -- verify if it has been successfully inserted | ||
| SELECT * FROM test_table; | ||
| ``` | ||
|
|
||
| 6. Run `./cdcup.sh pipeline pipeline-definition.yaml` to submit the pipeline job. You may also edit the pipeline definition file for further configurations. | ||
|
|
||
| 7. Run `./cdcup.sh flink` and navigate to the printed URL to access the Flink Web UI. | ||
|
|
||
| ``` | ||
| $ ./cdcup.sh flink | ||
| 🚩 Visit Flink Dashboard at: http://localhost:33448 | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| *.gem | ||
| *.rbc | ||
| /.config | ||
| /coverage/ | ||
| /InstalledFiles | ||
| /pkg/ | ||
| /spec/reports/ | ||
| /spec/examples.txt | ||
| /test/tmp/ | ||
| /test/version_tmp/ | ||
| /tmp/ | ||
|
|
||
| # Used by dotenv library to load environment variables. | ||
| # .env | ||
|
|
||
| # Ignore Byebug command history file. | ||
| .byebug_history | ||
|
|
||
| ## Specific to RubyMotion: | ||
| .dat* | ||
| .repl_history | ||
| build/ | ||
| *.bridgesupport | ||
| build-iPhoneOS/ | ||
| build-iPhoneSimulator/ | ||
|
|
||
| ## Specific to RubyMotion (use of CocoaPods): | ||
| # | ||
| # We recommend against adding the Pods directory to your .gitignore. However | ||
| # you should judge for yourself, the pros and cons are mentioned at: | ||
| # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control | ||
| # | ||
| # vendor/Pods/ | ||
|
|
||
| ## Documentation cache and generated files: | ||
| /.yardoc/ | ||
| /_yardoc/ | ||
| /doc/ | ||
| /rdoc/ | ||
|
|
||
| ## Environment normalization: | ||
| /.bundle/ | ||
| /vendor/bundle | ||
| /lib/bundler/man/ | ||
|
|
||
| # for a library or gem, you might want to ignore these files since the code is | ||
| # intended to run in multiple environments; otherwise, check them in: | ||
| # Gemfile.lock | ||
| # .ruby-version | ||
| # .ruby-gemset | ||
|
|
||
| # unless supporting rvm < 1.11.0 or doing something fancy, ignore this: | ||
| .rvmrc | ||
|
|
||
| # Used by RuboCop. Remote config files pulled in from inherit_from directive. | ||
| # .rubocop-https?--* | ||
|
|
||
| .idea/** | ||
|
|
||
| # These are generated files | ||
| cdc/** | ||
| /docker-compose.yaml | ||
| /pipeline-definition.yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more | ||
| # contributor license agreements. See the NOTICE file distributed with | ||
| # this work for additional information regarding copyright ownership. | ||
| # The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| # (the "License"); you may not use this file except in compliance with | ||
| # the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| FROM ruby:3.3-slim | ||
|
|
||
| WORKDIR /src | ||
| RUN apt-get update && apt-get install -y wget | ||
| RUN gem install tty-prompt | ||
| COPY src /src | ||
| RUN chmod +x /src/app.rb | ||
| ENTRYPOINT ["/src/app.rb"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # cdcup | ||
|
|
||
| A `docker` (`compose`) environment on Linux / macOS is required to play with this. Ruby is **not** necessary. | ||
|
|
||
| ## `./cdcup.sh init` | ||
|
|
||
| Initialize a playground environment, and generate configuration files. | ||
|
|
||
| ## `./cdcup.sh up` | ||
|
|
||
| Start docker containers. Note that it may take a while before database is ready. | ||
|
|
||
| ## `./cdcup.sh pipeline <yaml>` | ||
|
|
||
| Submit a YAML pipeline job. Before executing this, please ensure that: | ||
|
|
||
| 1. All container are running and ready for connections | ||
| 2. (For MySQL) You've created at least one database & tables to be captured | ||
|
|
||
| ## `./cdcup.sh flink` | ||
|
|
||
| Print Flink Web dashboard URL. | ||
|
|
||
| ## `./cdcup.sh stop` | ||
|
|
||
| Stop all running playground containers. | ||
|
|
||
| ## `./cdcup.sh down` | ||
|
|
||
| Stop and remove containers, networks, and volumes. | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.