NiFi版本升級

CodingStudio發表於2020-12-15

NiFi版本升級

轉載自https://cwiki.apache.org/confluence/display/NIFI/1.x.0+to+1.x.0+Upgrade

發行說明&遷移指南

升級之前,您應該仔細閱讀《發行說明》,以確保您瞭解所做的更改及其對現有資料流和/或環境的影響。

以下說明是從1.x.0版本升級到另一個版本時要遵循的一般步驟。 在特定版本的NiFi之間移動時,請注意``遷移指南''頁面上的特定專案。

重要:

  • 同一群集中不能包含具有不同NiFi版本的節點。

  • 不建議在同一臺主機上執行多個NiFi節點。

在你開始之前

在開始之前,您可以執行一些任務來提高升級的效率和成功率。

保留您的自定義處理器

如果您編寫了任何自定義NAR,請先在單獨的新NiFi版本沙盒中進行測試和驗證,然後再進行升級。可以在升級過程中通過以下方式將已驗證的NAR儲存在集中位置中,以保留它們:

  1. 建立另一個庫目錄,稱為custom_lib。

  2. 將您的自定義NAR移到這個新的lib目錄。

  3. 在nifi.properties檔案中新增新行以指定此新的lib目錄

     nifi.nar.library.directory=./lib

     nifi.nar.library.directory.custom=/opt/configuration_resources/custom_lib

保留修改後的NAR

如果您修改了任何預設的NAR檔案,則升級將覆蓋這些更改。 保留定製:

  1. 在現有例項中標識並儲存對預設NAR檔案所做的更改。

  2. 執行升級到新的NiFi版本。

  3. 在升級的NiFi例項中重做對NAR檔案所做的更改。

安裝

1.下載並解壓縮新的NiFi tar.gz檔案。

2.對於群集中的每個節點,將新的NiFi安裝在與現有NiFi安裝平行的目錄中。 假設您已安裝到opt /目錄,例如:

主機-節點1

|--> opt/

   |--> existing-nifi

   |--> new-nifi

 

主機-節點2

|--> opt/

   |--> existing-nifi

   |--> new-nifi

 

主機-節點3

|--> opt/

   |--> existing-nifi

   |--> new-nifi

 

注意:請確保新NiFi目錄的所有檔案和目錄所有權與您在現有目錄上設定的所有權相匹配。

3. 在現有安裝的NiFi上:

  • 停止所有負責提取新資料的處理器。
  • 允許NiFi執行,直到不再有FlowFiles排隊在資料流中的任何地方。
  • 關閉您現有的NiFi例項。

4. 使用現有NiFi安裝中的配置檔案(<安裝目錄> / conf)更新新NiFi部署中的相應屬性。

配置檔案必要的更改
authorizers.xml

Copy the <authorizer>...</authorizer> configured in the existing NiFi to new the NiFi file.

將在現有NiFi中配置的<authorizer> ... </ authorizer>複製到新的NiFi檔案。

If you are using the default “file-provider” authorizer, ensure that you copy the users.xml and authorizations.xml files from the existing to the new NiFi.

如果使用預設的“檔案提供者”授權者,請確保將users.xml和authorizations.xml檔案從現有檔案複製到新的NiFi。

Configuration best practices recommend creating a separate location outside of the NiFi base directory for storing such configuration files. If you are storing these files in a separate directory, you do not need to move them. Instead, ensure that the new NiFi is pointing to the same files. For example: /opt/nifi/configuration-resources/

配置最佳做法建議在NiFi基本目錄之外建立一個單獨的位置,以儲存此類配置檔案。如果要將這些檔案儲存在單獨的目錄中,則無需移動它們。相反,請確保新的NiFi指向相同的檔案。例如:/opt/nifi/configuration-resources/

bootstrap-notification-services.xml

Update the values based on values from the existing NiFi file.

根據現有NiFi檔案中的值更新值。

bootstrap.conf

Use the existing NiFi bootstrap.conf file to update properties in the new NiFi.

使用現有的NiFi bootstrap.conf檔案來更新新NiFi中的屬性。

logback.xml

If you added any custom logging modification to the existing NiFi, make those same changes to the new NiFi.

如果您對現有的NiFi新增了任何自定義日誌記錄修改,請對新的NiFi進行相同的更改。

login-identity-providers.xml

If you used a provider value in the existing NiFi, copy the <provider>...</provider> configuration from the existing NiFi to this file in your new NiFi.

如果您在現有NiFi中使用了提供者值,請將<provider> ... </ provider>配置從現有NiFi複製到新NiFi中的該檔案。

nifi.properties





 

Use the existing file to populate the same properties in the new NiFi nifi.properties file.

使用現有檔案在新的NiFi nifi.properties檔案中填充相同的屬性。

This file contains the majority of NiFi configuration settings, so ensure that you have copied the values correctly.

該檔案包含大多數NiFi配置設定,因此請確保您已正確複製了這些值。

If you followed NiFi best practices, the following properties should be pointing to external directories outside of the base NiFi installation path.

如果您遵循NiFi最佳做法,則以下屬性應指向基本NiFi安裝路徑之外的外部目錄。

If the below properties point to directories inside the NiFi base installation path, you must copy the target directories to the new NiFi. Stop your existing NiFi installation before you do this.

如果以下屬性指向NiFi基本安裝路徑內的目錄,則必須將目標目錄複製到新的NiFi。在執行此操作之前,請停止現有的NiFi安裝。

nifi.flow.configuration.file=

If you have retained the default value, (./conf/flow.xml.gz), copy flow.xml.gz from the existing to the new NiFi base install conf directory.

Alternately, you can copy to an external location and update the property value to point there.

如果保留了預設值(./conf/flow.xml.gz),請將flow.xml.gz從現有值複製到新的NiFi基本安裝conf目錄。

或者,您可以複製到外部位置並更新屬性值以指向該位置。

nifi.flow.configuration.archive.dir=

Same applies as above if you want to retain archived copies of the flow.xml.gz.

如果要保留flow.xml.gz的歸檔副本,則與上述相同。

nifi.database.directory=

Best practices recommends that you use an external location for each repository. Point the new NiFi at the same external database repository location.

最佳做法建議您為每個儲存庫使用外部位置。將新的NiFi指向相同的外部資料庫儲存庫位置。

nifi.flowfile.repository.directory=

Best practices recommends that you use an external location for each repository. Point the new NiFi at the same external flowfile repository location.

最佳做法建議您為每個儲存庫使用外部位置。將新的NiFi指向相同的外部資料庫儲存庫位置。

Warning: You may experience data loss if flowfile repositories are not accessible to the new NiFi.

警告:如果新NiFi無法訪問流檔案儲存庫,則可能會丟失資料。

nifi.content.repository.directory.default=

Best practices recommends that you use an external location for each repository. Point the new NiFi at the same external content repository location.

最佳做法建議您為每個儲存庫使用外部位置。將新的NiFi指向相同的外部內容儲存庫位置。

Your existing NiFi may have multiple content repos defined. Make sure the exact same property names are used and point to the appropriate matching content repo locations. For example:

您現有的NiFi可能定義了多個內容儲存庫。確保使用完全相同的屬性名稱,並指向適當的匹配內容儲存庫位置。例如:

nifi.content.repository.directory.content1=
nifi.content.repository.directory.content2=

Warning: You may experience data loss if content repositories are not accessible to new NiFi.

Warning: You may experience data loss may if property names are wrong or the property points to wrong content repository.

警告:如果新NiFi無法訪問內容儲存庫,則可能會丟失資料。

警告:如果屬性名稱錯誤或屬性指向錯誤的內容儲存庫,則可能會丟失資料。

nifi.provenance.repository.directory.default=

Best practices recommends that you use an external location for each repository. Point new NiFi at same external provenance repository location.

最佳做法建議您為每個儲存庫使用外部位置。將新的NiFi指向相同的外部來源儲存庫位置。

Your existing NiFi may have multiple provenance repos defined. Make sure exact same property names are used and point to appropriate matching provenance repo locations. For example:

nifi.provenance.repository.directory.provenance1=
nifi.provenance.repository.directory.provenance2=

Note: You may not be able to query old events if provenance repos are not moved correctly or properties are not updated correctly.

注意:如果出處回購未正確移動或屬性未正確更新,則您可能無法查詢舊事件。

state-management.xml

 

For the “local-provider” value, verify the location of “state/local” directory.

對於“ local-provider”值,請驗證“ state / local”目錄的位置。

If you have retained the default location (./state/local), copy the complete directory tree to the new NiFi. The existing NiFi should be stopped if you are copying this directory because it may be constantly writing to this directory while running.

如果您保留了預設位置(./state/local),請將完整的目錄樹複製到新的NiFi。如果要複製該目錄,則應停止現有的NiFi,因為它在執行時可能會不斷寫入該目錄。

Configuration best practices recommend that you move the state to an external directory like/opt/nifi/configuration-resources/ to facilitate easier upgrading later.

配置最佳實踐建議您將狀態移動到外部目錄,例如/opt /nifi/configuration-resources/,以方便以後的升級。

For a NiFi cluster, the “cluster-provider” ZooKeeper “Connect String" should be using the same external ZooKeeper as the existing NiFi installation.

對於NiFi群集,“群集提供者” ZooKeeper“連線字串”應使用與現有NiFi安裝相同的外部ZooKeeper。

For a NiFi cluster, make sure the “cluster-provider” ZooKeeper "Root Node" matches exactly the value you used in the existing NiFi.

對於NiFi群集,請確保“群集提供者” ZooKeeper“根節點”與您在現有NiFi中使用的值完全匹配。

If you are also setting up a new external ZooKeeper, see the ZooKeeper Migrator section of the NiFi System Administrator’s Guide for instructions on how to move ZooKeeper information from one cluster to another and migrating ZooKeeper node ownership.

如果您還要設定新的外部ZooKeeper,請參閱《 NiFi系統管理員指南》中的ZooKeeper遷移器部分,以獲取有關如何將ZooKeeper資訊從一個群集移至另一個群集以及遷移ZooKeeper節點所有權的說明。


注意:

  • 請勿將配置檔案從舊的NiFi版本複製到新的NiFi版本。較新的配置檔案可能會引入新的屬性,否則將丟失這些新屬性。
  • 仔細檢查所有配置的屬性是否存在錯別字。
  • 如果要通過nifi.properties檔案中的敏感屬性金鑰對資料流中的敏感元件屬性進行加密,請確保在複製flow.xml.gz時使用相同的金鑰。如果需要更改金鑰,請使用流遷移過程和NiFi Encrypt-Config工具從現有檔案中生成一個新的flow.xml.gz檔案。

5.啟動每個新的NiFi例項。

6. 驗證:

  • 您的所有資料流都已返回執行狀態。一些處理器可能具有需要配置的新屬性,在這種情況下,它們將被停止並標記為“無效”。
  • 您所有預期的控制器服務和報告任務將再次執行。解決任何標記為“無效”的控制器服務或報告任務。

7. 確認新的NiFi例項穩定並按預期工作後,可以刪除舊例項。

注意:如果將原始NiFi設定為作為服務執行,請更新所有符號連結或服務指令碼以指向新的NiFi版本可執行檔案。

相關文章