connect SQL to apache nifi

前端 未结 3 611
孤街浪徒
孤街浪徒 2021-01-02 05:42

I\'m new to nifi and i want to connect SQL server database to nifi and create a data flow with the processors. how can I do this, can any one Help me with this clearly.

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-02 06:28

    Expanding on TamusJRoyce's answer

    If you are running nifi via a docker image like apache/nifi or the aforementioned Hortonworks sandbox, the following should help you get the required driver on the image so that you don't need to exec into the container to do it manually.

    See the comments below the docker file

    FROM apache/nifi
    
    USER root
    RUN mkdir /lib/jdbc
    WORKDIR /lib/jdbc
    RUN wget https://download.microsoft.com/download/3/F/7/3F74A9B9-C5F0-43EA-A721-07DA590FD186/sqljdbc_6.2.2.0_enu.tar.gz
    RUN tar xvzf sqljdbc_6.2.2.0_enu.tar.gz
    RUN cp ./sqljdbc_6.2/enu/mssql-jdbc-6.2.2.jre8.jar ./
    
    USER nifi
    
    EXPOSE 8080 8443 10000 8000
    
    WORKDIR ${NIFI_HOME}
    ENTRYPOINT ["../scripts/start.sh"]
    
    1. The above image uses apache/nifi as the base image. You can use any nifi docker image has a base if you would like.
    2. You can specify any location for lib/jdbc, just remember that you need to use this as the reference for the file location so that it is referenced as file:///lib/jdbc/mssql-jdbc-6.2.2.jre8.jar
    3. Lastly, switch back to the nifi user and finish off with the standard nifi image details. This will allow the image to run correctly.

提交回复
热议问题