flink 命令
Last updated on November 22, 2024 pm
🧙 Questions
flink常用命令
☄️ Ideas
deploy per job
# 采用perjob模式运行
flink run -t yarn-per-job --detached /opt/flink/examples/streaming/TopSpeedWindowing.jar
flink run -t yarn-per-job --detached /opt/flink/examples/batch/WordCount.jar
flink run -t yarn-per-job --detached /home/ispong/.flink/application_1671711845218_1373/acorn-sql-plugin.jar ""
# List running job on the cluster
flink list -t yarn-per-job -Dyarn.application.id=application_XXXX_YY
# Cancel running job
flink cancel -t yarn-per-job -Dyarn.application.id=application_XXXX_YY <jobId>
查询所有的job
flink list -a
查看版本号
flink --version
sql shell
sql-client.sh
# scala2.11
# start-scala-shell.sh remote localhost 34256
- mysql同步到mysql
需要mysql-jdbc的驱动
需要重启flink on yarn
wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-8.0.22.tar.gz
tar -vzxf mysql-connector-java-8.0.22.tar.gz
mv mysql-connector-java-8.0.22/mysql-connector-java-8.0.22.jar /opt/flink/lib/
cd /opt/flink/lib/
wget https://repo1.maven.org/maven2/org/apache/flink/flink-connector-jdbc_2.12/1.14.0/flink-connector-jdbc_2.12-1.14.0.jar
CREATE TABLE from_table(
username STRING,
age INT
) WITH (
'connector'='jdbc',
'url'='jdbc:mysql://isxcode:30306/ispong_db',
'table-name'='users',
'driver'='com.mysql.cj.jdbc.Driver',
'username'='root',
'password'='ispong123');
CREATE TABLE to_table(
username STRING,
age INT
) WITH (
'connector'='jdbc',
'url'='jdbc:mysql://isxcode:30306/ispong_db',
'table-name'='users_sink',
'driver'='com.mysql.cj.jdbc.Driver',
'username'='root',
'password'='ispong123');
insert into to_table select username, age from from_table;
清理flink在hdfs中的文件
hadoop fs -rm -r /user/ispong/.flink/application_*
hadoop fs -rm -r /user/ispong/.Trash/Current/user/ispong/.flink/application_*
推送到k8s
./bin/flink run-application \
--target kubernetes-application \
-Dkubernetes.cluster-id=my-first-application-cluster7 \
-Dkubernetes.container.image.ref=apache/flink:1.12.7-scala_2.12 \
local:///opt/flink/examples/streaming/WordCount.jar
🔗 Links
flink 命令
https://ispong.isxcode.com/hadoop/flink/flink 命令/