Bootstrap Properties
conf目录下的bootstrap.conf文件允许用户配置NiFi应该如何启动的设置。 这包括参数,例如Java堆的大小,运行的Java命令以及Java系统属性。
只有在NiFi停止并重新启动之后,对此文件的任何更改才会生效。
| Property | Description |
|---|---|
| java | 指定要运行的完全限定的java命令。 默认情况下,它只是java,但可以改为绝对路径或引用一个环境变量,如$ JAVA_HOME / bin / java |
| run.as | 运行NiFi的用户名。 例如,如果NiFi应该作为nifi用户运行,则将此值设置为nifi将导致NiFi进程作为nifi用户运行。 在Windows上忽略此属性。 对于Linux,指定的用户可能需要sudo权限。 |
| lib.dir | 用于NiFi的lib目录。 默认情况下,它被设置为./lib |
| conf.dir | 用于NiFi的conf目录。 默认情况下,它被设置为./conf |
| graceful.shutdown.seconds | 当NiFi被指示关闭时,Bootstrap会等待这个秒数,以便进程彻底关闭。 在这段时间内,如果服务仍在运行,Bootstrap将“终止”该进程,或强制终止进程。 |
| java.arg.N | 当进程启动时,任何数量的JVM参数都可以传递给NiFi JVM。 缺省值包括最小和最大Java堆大小的属性,要使用的垃圾回收器等 |
| notification.services.file | 当NiFi启动或停止时,或Bootstrap检测到NiFi已经死亡时,Bootstrap能够向相关方发送这些事件的通知。 这是通过指定一个定义可以使用哪个通知服务的XML文件来配置的。 有关此文件的更多信息,请参阅通知服务部分。 |
| notification.max.attempts | 如果配置了通知服务但无法执行其功能,则会再次尝试最多次尝试次数。 该属性配置最大尝试次数。 默认值是5。 |
| nifi.start.notification.services | 此属性是通知服务标识符的逗号分隔列表,与notification.services.file属性中定义的Notification Services对应。 具有指定标识符的服务将用于在NiFi启动时通知其配置的收件人。 |
| nifi.stop.notification.services | 此属性是通知服务标识符的逗号分隔列表,与notification.services.file属性中定义的Notification Services对应。 具有指定标识符的服务将用于在NiFi停止时通知其配置的收件人。 |
| nifi.died.notification.services | 此属性是通知服务标识符的逗号分隔列表,与notification.services.file属性中定义的Notification Services对应。 具有指定标识符的服务将用于在NiFi停止时通知其配置的收件人。 |
通知服务 Notification Services
当NiFi引导程序启动或停止NiFi,或者检测到它意外死亡时,它可以通知已配置的收件人。 目前,唯一提供的机制是发送电子邮件或HTTP POST通知。 通知服务配置文件是配置通知功能的XML文件。
XML文件的默认位置是conf / bootstrap-notification-services.xml,但可以在conf / bootstrap.conf文件中更改此值。
XML文件的语法如下所示:
<services>
<!-- any number of service elements can be defined. -->
<service>
<id>some-identifier</id>
<!-- The fully-qualified class name of the Notification Service. -->
<class>org.apache.nifi.bootstrap.notification.email.EmailNotificationService</class>
<!-- Any number of properties can be set using this syntax.
The properties available depend on the Notification Service. -->
<property name="Property Name 1">Property Value</property>
<property name="Another Property Name">Property Value 2</property>
</service>
</services>
一旦配置了所需的服务,就可以在bootstrap.conf文件中引用它们。
电子邮件通知服务Email Notification Service
通过电子邮件发送通知,实现是org.apache.nifi.bootstrap.notification.email.EmailNotificationService。 它具有以下属性:
| Property | Required | Description |
|---|---|---|
| SMTP Hostname | true | 用于发送电子邮件通知的SMTP服务器的主机名 |
| SMTP Port | true | 用于SMTP通信的端口 |
| SMTP Username | true | Username for the SMTP account |
| SMTP Password | Password for the SMTP account | |
| SMTP Auth | Flag indicating whether authentication should be used | |
| SMTP TLS | 是否应启用TLS的标志 | |
| SMTP Socket Factory | javax.net.ssl.SSLSocketFactory | |
| SMTP X-Mailer Header | 在发送电子邮件的标题中使用的X-Mailer | |
| Content Type | 电子邮件内容的MIME类型,例如text / plain或text / html | |
| From | true | 指定用作发件人的电子邮件地址。 |
| To | 收件人列表 | |
| CC | The recipients to include in the CC-Line of the email | |
| BCC | The recipients to include in the BCC-Line of the email |
除了上面标记为必需的属性之外,还必须至少设置一个“收件人”,“抄送”或“密件抄送”属性。
配置电子邮件服务的完整示例如下所示:
<service>
<id>email-notification</id>
<class>org.apache.nifi.bootstrap.notification.email.EmailNotificationService</class>
<property name="SMTP Hostname">smtp.gmail.com</property>
<property name="SMTP Port">587</property>
<property name="SMTP Username">username@gmail.com</property>
<property name="SMTP Password">super-secret-password</property>
<property name="SMTP TLS">true</property>
<property name="From">"NiFi Service Notifier"</property>
<property name="To">username@gmail.com</property>
</service>
配置NiFi Bootstrap Properties与邮件通知服务
本文介绍了如何配置NiFi的Bootstrap Properties,包括Java启动参数和系统属性。同时讲解了NiFi的Notification Services,特别是电子邮件通知服务的设置,详细说明了配置XML文件的位置和语法,并给出了配置示例。
656

被折叠的 条评论
为什么被折叠?



