【Flink】Standalone operating mode

        The independent mode runs independently and does not rely on any external resource management platform; of course, independence also comes at a price: if resources are insufficient or failure occurs , there is no guarantee of automatic expansion or reallocation of resources, and must be handled manually . Therefore, the independent mode is generally only used in development testing or scenarios with very few tasks .

1. Session mode deployment

Start the cluster in advance and submit tasks through the web page client (multiple tasks are possible, but the cluster resources are fixed).

2. Single job mode deployment

Flink's Standalone cluster does not support single-job mode deployment . Because the single-job mode requires the help of some resource management platforms.

3. Application mode deployment

In application mode, the cluster will not be created in advance, so the start-cluster.sh script cannot be called . We can use standalone-job.sh also in the bin directory to create a JobManager.

Specific steps are as follows:

(0)Environmental preparation. Execute the following command in hadoop102 to start netcat.

[root@hadoop102 flink-1.17.0]$ nc -lk 7777

(1) Enter the Flink installation path and place the application jar package in the lib/ directory.

[root@hadoop102 flink-1.17.0]$ mv FlinkTutorial-1.0-SNAPSHOT.jar lib/

(2) Execute the following command to start JobManager.

[root@hadoop102 flink-1.17.0]$ bin/standalone-job.sh start --job-classname com.example.wc.SocketStreamWordCount

Here we directly specify the job entry class, and the script will go to the lib directory to scan all jar packages.

(3) Also use the script in the bin directory to start TaskManager.

[root@hadoop102 flink-1.17.0]$ bin/taskmanager.sh start

(4) Simulate sending word data on hadoop102.

[root@hadoop102 ~]$ nc -lk 7777

hello

(5) Observe the output data in the hadoop102:8081 address

(6) If you want to stop the cluster, you can also use a script. The command is as follows.

[root@hadoop102 flink-1.17.0]$ bin/taskmanager.sh stop

[root@hadoop102 flink-1.17.0]$ bin/standalone-job.sh stop

Guess you like

Origin blog.csdn.net/weixin_38996079/article/details/134588456