docker install Apache NIFI

illustrate

System: CentOS7.9

nifi version: 1.23.2

Download image

The nifi image is relatively large, about 2G, and the download time depends on your personal network speed.

docker pull apache/nifi:1.23.2

View the downloaded image

docker images

Copy container data

Create mounting directory

The purpose of creating a mounting directory is to mount the data inside the image to the host to prevent data loss caused by accidentally deleting the container.

mkdir -p /root/data/nifi
# 查看创建好的目录
ls -l /root/data

Start a temporary container

The purpose is to copy the data in the container to the corresponding mounting directory of the host.

docker run --name nifi -d apache/nifi:1.23.2

Check whether the container started successfully

docker ps

Copy container data to host

The nifi after docker cp in the command is the name of the container. You can also use the id of the container. 

docker cp nifi:/opt/nifi/nifi-current/ /root/data/nifi/

After the copy is completed, a successful log will be printed.

Check if the host has data

cd /root/data/nifi/
ll

Remove nifi container

docker rm -f nifi

Modify the permissions of the mounted directory

chmod +777 -R /root/data/nifi/ 

Start nifi container

SINGLE_USER_CREDENTIALS_USERNAME: User name for logging into nifi

SINGLE_USER_CREDENTIALS_PASSWORD: The password required to log in to nifi. Please note that the password must be at least 12 characters, otherwise NiFi will generate a random username and password.

Execute command to start

docker run -p 8443:8443 --privileged=true \
--name nifi \
-e SINGLE_USER_CREDENTIALS_USERNAME=<your username> \
-e SINGLE_USER_CREDENTIALS_PASSWORD=<your password> \
-v /root/data/nifi/nifi-current:/opt/nifi/nifi-current \
-d apache/nifi:1.23.2

Check whether the container started successfully

docker ps

View default username and password

If you do not specify a username and password when officially starting the container, you can use the following command to view the default username and password.

docker logs -f nifi | grep Generated

After executing the command, you will see the following username and password. The username and password are randomly generated. If you have configured your own username and password, and the password meets the requirements, then no username or password will be displayed after executing the above command. You can use this command to verify whether your username and password are valid.

Login to nifi

You must use https protocol to log in to nifi, and you cannot log in using ip+port number. There will be the following prompt.

Click Advanced => After continuing, you will see the following prompts

Configure hosts

Configure your own hosts file, add the following content in the hosts file, and change the IP inside to your actual IP

192.168.88.141(自己的ip) 95cf55450ad8:8443
192.168.88.141(自己的ip) 95cf55450ad8

After configuring hosts, use https + randomly generated string + port access

https://95cf55450ad8:8443/

Click Advanced => Continue to xxxx

It is found that the interface can be displayed normally at this time.

Click /nifi, or wait 5 seconds and you will be redirected to the login page. 

Enter your username and password to log in. The successful login interface is as follows

 Conclusion

The above is the entire process of installing apache/nifi using docker. If you have any questions, please comment or send a private message.

Guess you like

Origin blog.csdn.net/LSW_JAVADP/article/details/132657208
Recommended