Skip to content

Commit

Permalink
examples
Browse files Browse the repository at this point in the history
  • Loading branch information
praktiskt committed Nov 10, 2020
1 parent 1aa4372 commit fabf5f1
Showing 1 changed file with 87 additions and 3 deletions.
90 changes: 87 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# flinkctl
A command line utility for managing remote Flink clusters and applications with a familiar api.

# Status of project
## Status of project
Lots of work to be done still, but currently it can do rudementary tasks. **Use this in production at your own risk, it's probably not stable.**

* [x] Add and manage multiple different (remote/local) clusters (`config add-cluster <url>`, `config use-cluster <existing url>`)
Expand All @@ -20,5 +20,89 @@ Lots of work to be done still, but currently it can do rudementary tasks. **Use
* [ ] Create job savepoint
* [ ] Monitor misc triggerids
* [ ] Clean up `.flinkctl.yaml`-management (at the moment it's pretty garbage)
* [ ] Clean up help
* [ ] Tests... Tests everywhere.
* [ ] Tests... Tests everywhere.

## Development / Examples
There's a dummy app that runs forever with minimum utilization in `flink-cluster`. In addition, the `Makefile` bootstraps a Flink cluster to your `kubectl config current-context`.

### Bootstrap a Flink cluster locally
```
# Start Kubernetes locally
minikube start
# Make sure your current context is minikube
kubectl config current-context #if it's not minikube, change.
# Deploy a Flink cluster
make deploy
# Port forward the jobmanager to your machine
minikube service flink-jobmanager # Opens up 3 browser tabs, find the Jobmanager master (it's the one with the regular Flink dashboard).
# Configure flinkctl to use your cluster
flinkctl config add-cluster <url to jobmanager, e.g. https://localhost:54321>
# Validate flinkctl can see cluster
flinkctl describe cluster
```

### Build a fat jar
If you have a Flink job packaged already, skip this.

```
# Go to the dummy app
cd flink-cluster/DummyApp
# Use Maven to build your app
mvn clean package
```

### Start using flinkctl features
Output from a freshly deployed (example) cluster.

```
flinkctl describe cluster -o json
# Outputs:
# {
# "flink-commit": "d04872d",
# "flink-version": "1.11.0",
# "jobs-cancelled": 0,
# "jobs-failed": 0,
# "jobs-finished": 0,
# "jobs-running": 0,
# "slots-available": 4,
# "slots-total": 4,
# "taskmanagers": 2
# }
flinkctl submit jar -f flink-cluster/DummyApp/target/DummyApp-1.0-SNAPSHOT.jar
# Outputs:
# FILENAME STATUS
# ---------------------------------------------------------------- ---------
# 066d0a1e-6e9d-44b6-af36-4a72727bc7b6_DummyApp-1.0-SNAPSHOT.jar success
flinkctl submit job 066d0a1e-6e9d-44b6-af36-4a72727bc7b6_DummyApp-1.0-SNAPSHOT.jar
# Outputs:
# JOBID
# ----------------------------------
# b68454ec5d7ca9e13669687871cea629
flinkctl get jobs
# Outputs:
# ID STATUS
# ---------------------------------- ---------
# b68454ec5d7ca9e13669687871cea629 RUNNING
flinkctl describe job b68454ec5d7ca9e13669687871cea629
# Outputs a lot, doesn't fit README. Even more with -o json
flinkctl stop job b68454ec5d7ca9e13669687871cea629
# Outputs:
# Successfully cancelled job b68454ec5d7ca9e13669687871cea629
flinkctl get jobs
# Outputs:
# ID STATUS
# ---------------------------------- ----------
# b68454ec5d7ca9e13669687871cea629 CANCELED
```

0 comments on commit fabf5f1

Please sign in to comment.