The colocated docker-compose.yml is a Docker Compose definition providing an easy way to start up an Apache NiFi Cluster.
There are two primary ways in which the cluster can be configured:
mvn clean install -Pdocker
.image
property of the nifi
service definition to be an available Docker Hub tag such as apache/nifi:1.7.0
. NOTE Changes to the image can affect the expected conventions of the docker-compose.yml configuration. All released images 1.7.0 or later should work with the file as provided. If there are any issues, please file a JIRA.A user can start a minimal NiFi cluster with a simple docker-compose up -d
in the docker-compose
directory after configuring a desired NiFi version above. This will start a NiFi cluster of one node in Compose's detached mode, with containers running in the background.
Typically, however, when clustering a user will likely want multiple instances of NiFi. In this, more pragmatic perspective, a user would opt to instead run docker-compose up --scale nifi=<number of instances> -d
, specifying a number of instances, such as docker-compose up --scale nifi=3 -d
. The docker-compose up --scale
command can be performed at any point in the lifecycle of a running cluster instance and Compose will scale up or down to meet the number specified. Consider the following user commands after a user starts a NiFi cluster specifying n-instances through docker-compose up --scale nifi=n -d
:
docker-compose up --scale nifi=n-m -d
: Compose will notice that the requested number of instances (n-m
) is less than those currently running and remove m
instances of the nifi
service from the running configuration,docker-compose up --scale nifi=n -d
: Compose will notice that the requested number of instances is the number currently running and not perform any changesdocker-compose up --scale nifi=n+m -d
: Compose will notice that the requested number of instances (n+m
) is more than those currently running and add m
instances of the nifi
service from the running configurationNOTE: NiFi currently does not provide any management of removed nodes from the cluster and, by virtue of how Compose works, data on those instances will be lost when instances are scaled down or removed.
Logs for all running services (ZooKeeper and NiFi Nodes) can be viewed by performing docker-compose logs
to receive a view of the collected logs thus far. Alternatively, a user can follow the logs by adding the -f
option such as docker-compose logs -f
.
To facilitate accommodating multiple instances of NiFi on one host, a fixed and exposed port is not specified in the docker-compose.yml configuration. A user can find the host allocated port by performing docker-compose port nifi 8080
. This will return output similar to 0.0.0.0:32787
, indicating that the UI port, 8080, is available on all network interfaces of the host at port 32787. If you are running the Compose environment on your local system, this would create an address of http://localhost:32787/nifi/. If you would like to access the UI of other instances for additional evaluation, the docker-compose port
command additionally accepts an --index
option as follows docker-compose port --index=<instance number> port nifi 8080
.
When a user has completed their usage of the cluster, all containers can be stopped by performing docker-compose down
from the docker-compose folder. This will both stop and remove all containers associated with services in the docker-compose.yml configuration.
NOTE: NiFi currently does not provide any management of removed nodes from the cluster and, by virtue of how Compose works, data on those instances will be lost when instances are scaled down or removed.