0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Nifi简单Demo

Last updated at Posted at 2022-02-01

概要

根据客户的需求,做一个简单的Nifi Demo
客户需求

结构

スクリーンショット 2022-02-01 12.52.24.png

  1. ListFile作为入口
  2. FetchFile来处理数据,处理完了以后mv到别的目录
  3. PutSyslog来处理FetchFile出现错误的情形
  4. PutHDFS将处理完的数据存到HDFS上

知识点

  1. cdp的log都存在/var/log/下面
  2. config文件都在/etc下面
  3. 查看权限的command namei。使用例子
namei -l /home/cdp/nifi_test
f: /home/cdp/nifi_test
dr-xr-xr-x root root /
drwxr-xr-x root root home
drwxrwxrwx cdp  cdp  cdp
drwxrwxrwx cdp  cdp  nifi_test
  1. touch。对着一个已经存在的文件进行touch,不会覆盖源文件,而是直接更新文件的新建时间
  2. dmesg。查看开机信息
  3. journalctl。查看系统日志
  4. hdfs dfs设置用户可以用sudo -u hdfs

典型

设置udp

在PutSyslog阶段,需要设置udp广播,然后检测nifi出现问题之后,message被广播
スクリーンショット 2022-02-01 13.09.46.png

查看运行的syslog
ps auxww | grep syslog
cdp       8198  0.0  0.0 112824   972 pts/0    S+   04:05   0:00 grep --color=auto syslog
设置config
sudo vi /etc/rsyslog.conf
# Provides UDP syslog reception
$ModLoad imudp
$UDPServerRun 514
查看message日志
sudo cat /var/log/messages | grep "there is an error"
[sudo] cdp のパスワード:
Feb  1 02:41:27 zzeng03.novalocal there is an error
Feb  1 02:43:36 zzeng03.novalocal there is an error
Feb  1 02:44:36 zzeng03.novalocal there is an error
Feb  1 02:45:47 zzeng03.novalocal there is an error

完成。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?