Flume
  1. Flume
  2. FLUME-1336

Create a Windows Service for flume (fully manageable)

    Details

    • Type: Improvement Improvement
    • Status: Patch Available
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Issue Links

        Activity

        Hide
        Sergey added a comment - - edited

        Service Installation

        I added two folders under \bin: win32 and win64. Both of them contain corresponding version of prunsrv.exe and two PowerShell scripts for installing/uninstalling FlumeAgent service: InstallService.ps1 and UninstallService.ps1.

        In order to install the service, open PowerShell promptand type (I assume you have 64-bit operating system and 64-bit version of Java). You might need to enable script execution by running

        Set-ExecutionPolicy RemoteSigned

        then type:

        cd \apache-flume\bin\win64
        .\InstallService.ps1
        

        After that service will be installed, and you can start it:

        net start FlumeAgent

        In order to uninstall service, do the following:

        cd \apache-flume\bin\win64
        .\UninstallService.ps1
        

        Log files (including one created by prunsrv) are stored in logs.

        x86 and x64 Versions

        There are two versions of prunsrv for different architectures: x86 (32-bit) and x64 (64-bit). You need to choose which one to use based on the version of Java you have installed. I configured prunsrv to use such called JVM-mode. In that mode prunesrv.exe loads jvm.dll from JRE and then runs that VM. If you have 32-bit version of Java, 64-bit prunsrv will not be able to load 32-bit version of jvm.dll and service will not start.

        Show
        Sergey added a comment - - edited Service Installation I added two folders under \bin: win32 and win64. Both of them contain corresponding version of prunsrv.exe and two PowerShell scripts for installing/uninstalling FlumeAgent service: InstallService.ps1 and UninstallService.ps1. In order to install the service, open PowerShell promptand type (I assume you have 64-bit operating system and 64-bit version of Java). You might need to enable script execution by running Set-ExecutionPolicy RemoteSigned then type: cd \apache-flume\bin\win64 .\InstallService.ps1 After that service will be installed, and you can start it: net start FlumeAgent In order to uninstall service, do the following: cd \apache-flume\bin\win64 .\UninstallService.ps1 Log files (including one created by prunsrv) are stored in logs. x86 and x64 Versions There are two versions of prunsrv for different architectures: x86 (32-bit) and x64 (64-bit). You need to choose which one to use based on the version of Java you have installed. I configured prunsrv to use such called JVM-mode. In that mode prunesrv.exe loads jvm.dll from JRE and then runs that VM. If you have 32-bit version of Java, 64-bit prunsrv will not be able to load 32-bit version of jvm.dll and service will not start.
        Hide
        Alexander Alten-Lorenz added a comment -

        Sergey: Some nits:
        1) Please add the apache license to all new files.
        2) The file prunsrv.exe is a binary file, do this have any additional licenses (commercial Microsoft, Tomcat, JBoss)?
        3) Could you please open a review request per https://reviews.apache.org (Project Flume-git)?

        Technically the patch looks great and works as expected. We need to get sure that we don't violate any propriety licenses, and that all files are shipped with Apache License.

        Thanks in advance,
        Alex

        Show
        Alexander Alten-Lorenz added a comment - Sergey: Some nits: 1) Please add the apache license to all new files. 2) The file prunsrv.exe is a binary file, do this have any additional licenses (commercial Microsoft, Tomcat, JBoss)? 3) Could you please open a review request per https://reviews.apache.org (Project Flume-git)? Technically the patch looks great and works as expected. We need to get sure that we don't violate any propriety licenses, and that all files are shipped with Apache License. Thanks in advance, Alex
        Hide
        Sergey added a comment -

        Updated patch (added Apache License to all new files)

        Show
        Sergey added a comment - Updated patch (added Apache License to all new files)
        Hide
        Sergey added a comment -

        Alex,

        The Procrun (aka prunsrv.exe):
        http://commons.apache.org/proper/commons-daemon/procrun.html

        is an Apache Commons product and is covered by Apache license as well. We intentionally did not use any commercial/proprietary solution to host the Flume.

        Sincerely,
        Sergey

        Show
        Sergey added a comment - Alex, The Procrun (aka prunsrv.exe): http://commons.apache.org/proper/commons-daemon/procrun.html is an Apache Commons product and is covered by Apache license as well. We intentionally did not use any commercial/proprietary solution to host the Flume. Sincerely, Sergey
        Hide
        Sergey added a comment -

        Fixed Uninstall.ps1 as it was in UCS-2 encoding and was treated as binary.

        Show
        Sergey added a comment - Fixed Uninstall.ps1 as it was in UCS-2 encoding and was treated as binary.
        Hide
        Roshan Naik added a comment -

        service creation will be valuable. I have left some comments on reviewboard.

        Show
        Roshan Naik added a comment - service creation will be valuable. I have left some comments on reviewboard.
        Hide
        Alexander Alten-Lorenz added a comment -

        Sergey, could you please assign?

        Show
        Alexander Alten-Lorenz added a comment - Sergey, could you please assign?
        Hide
        Alexander Alten-Lorenz added a comment -

        Depends on FLUME-1334, see comments from Roshan (https://reviews.apache.org/r/12822/#review23668)

        Show
        Alexander Alten-Lorenz added a comment - Depends on FLUME-1334 , see comments from Roshan ( https://reviews.apache.org/r/12822/#review23668 )
        Hide
        Roshan Naik added a comment -

        fyi: Added the draft startup script in FLUME-1334 in case you need it for reference.

        Show
        Roshan Naik added a comment - fyi: Added the draft startup script in FLUME-1334 in case you need it for reference.
        Hide
        Sergey added a comment -

        Updated code after review.

        Show
        Sergey added a comment - Updated code after review.
        Hide
        Roshan Naik added a comment -

        Sergey, could you refresh review board with the new patch ?

        Show
        Roshan Naik added a comment - Sergey, could you refresh review board with the new patch ?

          People

          • Assignee:
            Unassigned
            Reporter:
            Alexander Alten-Lorenz
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:

              Development