<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Connecting to a Database using SSH tunnel in NiFi in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Connecting-to-a-Database-using-SSH-tunnel-in-NiFi/m-p/349906#M235813</link>
    <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/71250"&gt;@SandyClouds&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;The ExecuteSQL processors do not support SSH tunnel.&amp;nbsp; The expectation by these processors is that the SQL server is listening on a port reachable on the network.&amp;nbsp; SSH tunnels are used to access the server via remotely and then execute a command locally on that SQL utilizing the SQL client on that destination server.&amp;nbsp; &amp;nbsp;The ExecuteSQL processor uses a&amp;nbsp;&lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-dbcp-service-nar/1.17.0/org.apache.nifi.dbcp.DBCPConnectionPool/index.html" target="_self"&gt;DBCPConnectionPool&lt;/A&gt;&amp;nbsp;to facilitate the connection to the database.&amp;nbsp; The DBCPConnectionPool establishes a pool of connections used by one too many processors sharing this connection to execute their code.&amp;nbsp; A &lt;STRONG&gt;Validation Query&lt;/STRONG&gt; is very import to make sure a connection from this pool is still good before being passed to requesting processor for use.&lt;BR /&gt;&lt;BR /&gt;While I have not done this myself, I suppose you could set up and SSH tunnel on each NiFi cluster server (example: &lt;A href="https://linuxize.com/post/mysql-ssh-tunnel/" target="_blank"&gt;https://linuxize.com/post/mysql-ssh-tunnel/&lt;/A&gt;).&amp;nbsp; Then you could still use the&amp;nbsp;&lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-dbcp-service-nar/1.17.0/org.apache.nifi.dbcp.DBCPConnectionPool/index.html" target="_self"&gt;DBCPConnectionPool&lt;/A&gt;&amp;nbsp;except use the established tunnel address and port in the database connection URL.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Downside to this is that NiFi has not control over that tunnel, so if the tunnel is closed, your dataflow will stop working until the tunnel is re-established.&amp;nbsp; The &lt;STRONG&gt;Validation Query&lt;/STRONG&gt; will verify the connection is still good. If it is not, the&amp;nbsp;DBCPConnectionPool will drop it and try to establish a new connection.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;If you found this response assisted with your query, please take a moment to login and click on "&lt;STRONG&gt;Accept as Solution&lt;/STRONG&gt;" below this post.&lt;BR /&gt;&lt;BR /&gt;Thank you,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
    <pubDate>Wed, 10 Aug 2022 18:36:36 GMT</pubDate>
    <dc:creator>MattWho</dc:creator>
    <dc:date>2022-08-10T18:36:36Z</dc:date>
    <item>
      <title>Connecting to a Database using SSH tunnel in NiFi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Connecting-to-a-Database-using-SSH-tunnel-in-NiFi/m-p/349877#M235805</link>
      <description>&lt;P&gt;Hello Lovely community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to NiFi, I am able to connect to mysql dummy database from Nifi and everything works fine.&lt;/P&gt;&lt;P&gt;But I want to understand how can we connect to databases that use SSH tunneling..&lt;/P&gt;&lt;P&gt;Because I have not seen any properties related to SSH in the database processors.&lt;/P&gt;&lt;P&gt;My processors being used is "capturechangeMysql"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This source DB server is secured and I need SSH tunnel to make the connection.&lt;/P&gt;&lt;P&gt;I have 100 such sources. Should I add my nifi server ssh keys in all the source servers ? and even then where can i give the SSH tunnel information? and the private key..&lt;/P&gt;&lt;P&gt;Because while using any SQL client we can use the tunnel along with main DB username and password as shown in attached screen, but for Nifi I am not able to see a way..&lt;/P&gt;&lt;P&gt;Please help me with your suggestions.. /\&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SSH tunnel" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/35134i100000817051AB65/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2022-08-10 at 16.10.22.png" alt="SSH tunnel" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;SSH tunnel&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2022 14:19:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Connecting-to-a-Database-using-SSH-tunnel-in-NiFi/m-p/349877#M235805</guid>
      <dc:creator>SandyClouds</dc:creator>
      <dc:date>2022-08-10T14:19:43Z</dc:date>
    </item>
    <item>
      <title>Re: Connecting to a Database using SSH tunnel in NiFi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Connecting-to-a-Database-using-SSH-tunnel-in-NiFi/m-p/349906#M235813</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/71250"&gt;@SandyClouds&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;The ExecuteSQL processors do not support SSH tunnel.&amp;nbsp; The expectation by these processors is that the SQL server is listening on a port reachable on the network.&amp;nbsp; SSH tunnels are used to access the server via remotely and then execute a command locally on that SQL utilizing the SQL client on that destination server.&amp;nbsp; &amp;nbsp;The ExecuteSQL processor uses a&amp;nbsp;&lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-dbcp-service-nar/1.17.0/org.apache.nifi.dbcp.DBCPConnectionPool/index.html" target="_self"&gt;DBCPConnectionPool&lt;/A&gt;&amp;nbsp;to facilitate the connection to the database.&amp;nbsp; The DBCPConnectionPool establishes a pool of connections used by one too many processors sharing this connection to execute their code.&amp;nbsp; A &lt;STRONG&gt;Validation Query&lt;/STRONG&gt; is very import to make sure a connection from this pool is still good before being passed to requesting processor for use.&lt;BR /&gt;&lt;BR /&gt;While I have not done this myself, I suppose you could set up and SSH tunnel on each NiFi cluster server (example: &lt;A href="https://linuxize.com/post/mysql-ssh-tunnel/" target="_blank"&gt;https://linuxize.com/post/mysql-ssh-tunnel/&lt;/A&gt;).&amp;nbsp; Then you could still use the&amp;nbsp;&lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-dbcp-service-nar/1.17.0/org.apache.nifi.dbcp.DBCPConnectionPool/index.html" target="_self"&gt;DBCPConnectionPool&lt;/A&gt;&amp;nbsp;except use the established tunnel address and port in the database connection URL.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Downside to this is that NiFi has not control over that tunnel, so if the tunnel is closed, your dataflow will stop working until the tunnel is re-established.&amp;nbsp; The &lt;STRONG&gt;Validation Query&lt;/STRONG&gt; will verify the connection is still good. If it is not, the&amp;nbsp;DBCPConnectionPool will drop it and try to establish a new connection.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;If you found this response assisted with your query, please take a moment to login and click on "&lt;STRONG&gt;Accept as Solution&lt;/STRONG&gt;" below this post.&lt;BR /&gt;&lt;BR /&gt;Thank you,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2022 18:36:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Connecting-to-a-Database-using-SSH-tunnel-in-NiFi/m-p/349906#M235813</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2022-08-10T18:36:36Z</dc:date>
    </item>
  </channel>
</rss>

