NIFI系列---【设置开机自动重启】

Installing as a Service
Currently, installing NiFi as a service is supported only for Linux and macOS users. To install the application as a service, navigate to the installation directory in a Terminal window and execute the command bin/nifi.sh install to install the service with the default name nifi. To specify a custom name for the service, execute the command with an optional second argument that is the name of the service. For example, to install NiFi as a service with the name dataflow, use the command bin/nifi.sh install dataflow.
Once installed, the service can be started and stopped using the appropriate commands, such as sudo service nifi start and sudo service nifi stop. Additionally, the running status can be checked via sudo service nifi status.

按照官网提供的说明,通过service命令来实现NiFi的开机自启动。以下是详细步骤,假设您已经下载并解压了NiFi:

  1. 安装NiFi服务

    首先,进入NiFi的安装目录,然后运行install命令安装服务:

    cd /path/to/nifi
    sudo bin/nifi.sh install
    

    或者使用自定义服务名称,例如:

    sudo bin/nifi.sh install my-nifi-service
    
  2. 使服务开机自启动

    安装完成后,您可以使用以下命令将服务设置为开机自启动:

    如果您使用的是默认服务名称nifi

    sudo systemctl enable nifi
    

    如果您使用了自定义服务名称,例如my-nifi-service

    sudo systemctl enable my-nifi-service
    
  3. 管理NiFi服务

    现在,您可以使用以下命令来启动、停止和检查NiFi服务状态:

    启动NiFi服务:

    sudo service nifi start
    

    停止NiFi服务:

    sudo service nifi stop
    

    检查NiFi服务状态:

    sudo service nifi status
    

    如果您使用了自定义服务名称,使用相应的名称替换nifi即可,例如:

    sudo service my-nifi-service start
    sudo service my-nifi-service stop
    sudo service my-nifi-service status
    

通过上述步骤,您便可以成功地将NiFi配置为开机自启动的服务。请确保您有足够的权限来执行这些命令,并且nifi用户具有必要的权限来运行和管理NiFi服务。

posted on   少年攻城狮  阅读(66)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示