Replies: 1 comment 1 reply
-
I've got a functional prototype of this implementation here: https://github.com/michael81877/nifikop/tree/add-unclustered-type |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Overview
Proposal #98 suggested creating a new CRD to enable NiFiKOp to deploy and configure a set of unclustered, or standalone, NiFi nodes. In that discussion and through experimenting with actually making the change, I found that this use case didn't warrant creating a new CRD to accomplish the ultimate goal:
Why
The first question is likely why you might want to do this.
There are benefits and drawbacks of clustering in NiFi.
Benefits of clustering
Drawbacks of clustering
Benefits of unclustered NiFis
Drawbacks of unclustered NiFis
Standalone Cluster Design
We can extend the existing
NifiCluster
CRD to enable nifikop to deploy and configure standalone NiFi nodes. First, let's review how the NiFi cluster coordinator works.NiFi Cluster Coordinator
In a clustered NiFi scenario, NiFi uses Apache Zookeeper to elect a single cluster coordinator. This enables a client to interact with the entire cluster through a single node. When the cluster coordinator receives a REST request, it internally replicates that request to each other node in the NiFi cluster.
In order to guarantee that newly created components (e.g. process groups, users, user groups, parameter contexts, etc.) get the same UUID, the cluster coordinator sets the following header on each replicated request: X-Cluster-Id-Generation-Seed.
And then when a new Id is generated for a component, it uses the value of that header as a seed.
So for standalone clusters, we can have NiFiKOp act like the elected cluster coordinator to replicate requests to each of the standalone NiFi nodes, ensuring that each component created gets the same ID.
NiFiKOp Changes
We need a new cluster type. There are already
internal
andexternal
clusters. There will be a newinternal-standalone
cluster type.For
internal-standalone
cluster types, NiFiKOp needs to act like the elected cluster coordinator. This means that it needs to interact with every node for every REST call that typically goes to the cluster coordinator. And when components are created, the operator must set the X-Cluster-Id-Generation-Seed header so that the component has the same UUID on each node.For each CRD that can be attached to a
NifiCluster
, we will track the seed used to create the component. This is so that if nodes are added in the future or there's a failure during setup, we can re-generate the UUID for the component. For example, forNifiRegistryClient
, we addNifiRegistryClient.Status.IdSeed
which will use the value of the X-Cluster-Id-Generation-Seed header used to create the component.Beta Was this translation helpful? Give feedback.
All reactions