blob: 2709045dca62cd40f3ed93f5656504f77dca9c22 [file] [log] [blame]
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>InfluxDB sink connector · Apache Pulsar</title><meta name="viewport" content="width=device-width, initial-scale=1.0"/><meta name="generator" content="Docusaurus"/><meta name="description" content="The InfluxDB sink connector pulls messages from Pulsar topics "/><meta name="docsearch:version" content="next"/><meta name="docsearch:language" content="en"/><meta property="og:title" content="InfluxDB sink connector · Apache Pulsar"/><meta property="og:type" content="website"/><meta property="og:url" content="https://pulsar.apache.org/"/><meta property="og:description" content="The InfluxDB sink connector pulls messages from Pulsar topics "/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://pulsar.apache.org/img/pulsar.svg"/><link rel="shortcut icon" href="/img/pulsar.ico"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"/><link rel="alternate" type="application/atom+xml" href="https://pulsar.apache.org/blog/atom.xml" title="Apache Pulsar Blog ATOM Feed"/><link rel="alternate" type="application/rss+xml" href="https://pulsar.apache.org/blog/feed.xml" title="Apache Pulsar Blog RSS Feed"/><link rel="stylesheet" href="/css/code-blocks-buttons.css"/><script type="text/javascript" src="https://buttons.github.io/buttons.js"></script><script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js"></script><script type="text/javascript" src="/js/custom.js"></script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/en"><img class="logo" src="/img/pulsar.svg" alt="Apache Pulsar"/></a><a href="/en/versions"><h3>next</h3></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-site-internal"><li class=""><a href="/docs/en/next/getting-started-standalone" target="_self">Docs</a></li><li class=""><a href="/en/download" target="_self">Download</a></li><li class=""><a href="/docs/en/next/client-libraries" target="_self">Clients</a></li><li class=""><a href="#restapis" target="_self">REST APIs</a></li><li class=""><a href="#cli" target="_self">Cli</a></li><li class=""><a href="/blog/" target="_self">Blog</a></li><li class=""><a href="#community" target="_self">Community</a></li><li class=""><a href="#apache" target="_self">Apache</a></li><li class=""><a href="https://pulsar-next.staged.apache.org/" target="_self">New Website (Beta)</a></li><span><li><a id="languages-menu" href="#"><img class="languages-icon" src="/img/language.svg" alt="Languages icon"/>English</a><div id="languages-dropdown" class="hide"><ul id="languages-dropdown-items"><li><a href="/docs/ja/next/io-influxdb-sink">日本語</a></li><li><a href="/docs/fr/next/io-influxdb-sink">Français</a></li><li><a href="/docs/ko/next/io-influxdb-sink">한국어</a></li><li><a href="/docs/zh-CN/next/io-influxdb-sink">中文</a></li><li><a href="/docs/zh-TW/next/io-influxdb-sink">繁體中文</a></li><li><a href="https://crowdin.com/project/apache-pulsar" target="_blank" rel="noreferrer noopener">Help Translate</a></li></ul></div></li><script>
const languagesMenuItem = document.getElementById("languages-menu");
const languagesDropDown = document.getElementById("languages-dropdown");
languagesMenuItem.addEventListener("click", function(event) {
event.preventDefault();
if (languagesDropDown.className == "hide") {
languagesDropDown.className = "visible";
} else {
languagesDropDown.className = "hide";
}
});
</script></span></ul></nav></div></header></div></div><div class="navPusher"><div class="docMainWrapper wrapper"><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><a class="edit-page-link button" href="https://github.com/apache/pulsar/edit/master/site2/docs/io-influxdb-sink.md" target="_blank" rel="noreferrer noopener">Edit</a><h1 id="__docusaurus" class="postHeaderTitle">InfluxDB sink connector</h1></header><article><div><span><p>The InfluxDB sink connector pulls messages from Pulsar topics
and persists the messages to InfluxDB.</p>
<p>The InfluxDB sink provides different configurations for InfluxDBv1 and v2 respectively.</p>
<h2><a class="anchor" aria-hidden="true" id="configuration"></a><a href="#configuration" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Configuration</h2>
<p>The configuration of the InfluxDB sink connector has the following properties.</p>
<h3><a class="anchor" aria-hidden="true" id="property"></a><a href="#property" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Property</h3>
<h4><a class="anchor" aria-hidden="true" id="influxdbv2"></a><a href="#influxdbv2" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>InfluxDBv2</h4>
<table>
<thead>
<tr><th>Name</th><th>Type</th><th>Required</th><th>Default</th><th>Description</th></tr>
</thead>
<tbody>
<tr><td><code>influxdbUrl</code></td><td>String</td><td>true</td><td>&quot; &quot; (empty string)</td><td>The URL of the InfluxDB instance.</td></tr>
<tr><td><code>token</code></td><td>String</td><td>true</td><td>&quot; &quot; (empty string)</td><td>The authentication token used to authenticate to InfluxDB.</td></tr>
<tr><td><code>organization</code></td><td>String</td><td>true</td><td>&quot; &quot; (empty string)</td><td>The InfluxDB organization to write to.</td></tr>
<tr><td><code>bucket</code></td><td>String</td><td>true</td><td>&quot; &quot; (empty string)</td><td>The InfluxDB bucket to write to.</td></tr>
<tr><td><code>precision</code></td><td>String</td><td>false</td><td>ns</td><td>The timestamp precision for writing data to InfluxDB. <br><br>Below are the available options:<li>ns<br><li>us<br><li>ms<br><li>s</td></tr>
<tr><td><code>logLevel</code></td><td>String</td><td>false</td><td>NONE</td><td>The log level for InfluxDB request and response. <br><br>Below are the available options:<li>NONE<br><li>BASIC<br><li>HEADERS<br><li>FULL</td></tr>
<tr><td><code>gzipEnable</code></td><td>boolean</td><td>false</td><td>false</td><td>Whether to enable gzip or not.</td></tr>
<tr><td><code>batchTimeMs</code></td><td>long</td><td>false</td><td>1000L</td><td>The InfluxDB operation time in milliseconds.</td></tr>
<tr><td><code>batchSize</code></td><td>int</td><td>false</td><td>200</td><td>The batch size of writing to InfluxDB.</td></tr>
</tbody>
</table>
<h4><a class="anchor" aria-hidden="true" id="influxdbv1"></a><a href="#influxdbv1" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>InfluxDBv1</h4>
<table>
<thead>
<tr><th>Name</th><th>Type</th><th>Required</th><th>Default</th><th>Description</th></tr>
</thead>
<tbody>
<tr><td><code>influxdbUrl</code></td><td>String</td><td>true</td><td>&quot; &quot; (empty string)</td><td>The URL of the InfluxDB instance.</td></tr>
<tr><td><code>username</code></td><td>String</td><td>false</td><td>&quot; &quot; (empty string)</td><td>The username used to authenticate to InfluxDB.</td></tr>
<tr><td><code>password</code></td><td>String</td><td>false</td><td>&quot; &quot; (empty string)</td><td>The password used to authenticate to InfluxDB.</td></tr>
<tr><td><code>database</code></td><td>String</td><td>true</td><td>&quot; &quot; (empty string)</td><td>The InfluxDB to which write messages.</td></tr>
<tr><td><code>consistencyLevel</code></td><td>String</td><td>false</td><td>ONE</td><td>The consistency level for writing data to InfluxDB. <br><br>Below are the available options:<li>ALL<br><li> ANY<br><li>ONE<br><li>QUORUM</td></tr>
<tr><td><code>logLevel</code></td><td>String</td><td>false</td><td>NONE</td><td>The log level for InfluxDB request and response. <br><br>Below are the available options:<li>NONE<br><li>BASIC<br><li>HEADERS<br><li>FULL</td></tr>
<tr><td><code>retentionPolicy</code></td><td>String</td><td>false</td><td>autogen</td><td>The retention policy for InfluxDB.</td></tr>
<tr><td><code>gzipEnable</code></td><td>boolean</td><td>false</td><td>false</td><td>Whether to enable gzip or not.</td></tr>
<tr><td><code>batchTimeMs</code></td><td>long</td><td>false</td><td>1000L</td><td>The InfluxDB operation time in milliseconds.</td></tr>
<tr><td><code>batchSize</code></td><td>int</td><td>false</td><td>200</td><td>The batch size of writing to InfluxDB.</td></tr>
</tbody>
</table>
<h3><a class="anchor" aria-hidden="true" id="example"></a><a href="#example" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Example</h3>
<p>Before using the InfluxDB sink connector, you need to create a configuration file through one of the following methods.</p>
<h4><a class="anchor" aria-hidden="true" id="influxdbv2-1"></a><a href="#influxdbv2-1" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>InfluxDBv2</h4>
<ul>
<li><p>JSON</p>
<pre><code class="hljs css language-json">{
<span class="hljs-attr">"configs"</span>: {
<span class="hljs-attr">"influxdbUrl"</span>: <span class="hljs-string">"http://localhost:9999"</span>,
<span class="hljs-attr">"organization"</span>: <span class="hljs-string">"example-org"</span>,
<span class="hljs-attr">"bucket"</span>: <span class="hljs-string">"example-bucket"</span>,
<span class="hljs-attr">"token"</span>: <span class="hljs-string">"xxxx"</span>,
<span class="hljs-attr">"precision"</span>: <span class="hljs-string">"ns"</span>,
<span class="hljs-attr">"logLevel"</span>: <span class="hljs-string">"NONE"</span>,
<span class="hljs-attr">"gzipEnable"</span>: <span class="hljs-literal">false</span>,
<span class="hljs-attr">"batchTimeMs"</span>: <span class="hljs-number">1000</span>,
<span class="hljs-attr">"batchSize"</span>: <span class="hljs-number">100</span>
}
}
</code></pre></li>
<li><p>YAML</p>
<pre><code class="hljs css language-yaml"><span class="hljs-attr">configs:</span>
<span class="hljs-attr">influxdbUrl:</span> <span class="hljs-string">"http://localhost:9999"</span>
<span class="hljs-attr">organization:</span> <span class="hljs-string">"example-org"</span>
<span class="hljs-attr">bucket:</span> <span class="hljs-string">"example-bucket"</span>
<span class="hljs-attr">token:</span> <span class="hljs-string">"xxxx"</span>
<span class="hljs-attr">precision:</span> <span class="hljs-string">"ns"</span>
<span class="hljs-attr">logLevel:</span> <span class="hljs-string">"NONE"</span>
<span class="hljs-attr">gzipEnable:</span> <span class="hljs-literal">false</span>
<span class="hljs-attr">batchTimeMs:</span> <span class="hljs-number">1000</span>
<span class="hljs-attr">batchSize:</span> <span class="hljs-number">100</span>
</code></pre></li>
</ul>
<h4><a class="anchor" aria-hidden="true" id="influxdbv1-1"></a><a href="#influxdbv1-1" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>InfluxDBv1</h4>
<ul>
<li><p>JSON</p>
<pre><code class="hljs css language-json">{
<span class="hljs-attr">"configs"</span>: {
<span class="hljs-attr">"influxdbUrl"</span>: <span class="hljs-string">"http://localhost:8086"</span>,
<span class="hljs-attr">"database"</span>: <span class="hljs-string">"test_db"</span>,
<span class="hljs-attr">"consistencyLevel"</span>: <span class="hljs-string">"ONE"</span>,
<span class="hljs-attr">"logLevel"</span>: <span class="hljs-string">"NONE"</span>,
<span class="hljs-attr">"retentionPolicy"</span>: <span class="hljs-string">"autogen"</span>,
<span class="hljs-attr">"gzipEnable"</span>: <span class="hljs-literal">false</span>,
<span class="hljs-attr">"batchTimeMs"</span>: <span class="hljs-number">1000</span>,
<span class="hljs-attr">"batchSize"</span>: <span class="hljs-number">100</span>
}
}
</code></pre></li>
<li><p>YAML</p>
<pre><code class="hljs css language-yaml"><span class="hljs-attr">configs:</span>
<span class="hljs-attr">influxdbUrl:</span> <span class="hljs-string">"http://localhost:8086"</span>
<span class="hljs-attr">database:</span> <span class="hljs-string">"test_db"</span>
<span class="hljs-attr">consistencyLevel:</span> <span class="hljs-string">"ONE"</span>
<span class="hljs-attr">logLevel:</span> <span class="hljs-string">"NONE"</span>
<span class="hljs-attr">retentionPolicy:</span> <span class="hljs-string">"autogen"</span>
<span class="hljs-attr">gzipEnable:</span> <span class="hljs-literal">false</span>
<span class="hljs-attr">batchTimeMs:</span> <span class="hljs-number">1000</span>
<span class="hljs-attr">batchSize:</span> <span class="hljs-number">100</span>
</code></pre></li>
</ul>
</span></div></article></div><div class="docs-prevnext"></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#configuration">Configuration</a><ul class="toc-headings"><li><a href="#property">Property</a></li><li><a href="#example">Example</a></li></ul></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="copyright">Copyright © 2022 The Apache Software Foundation. All Rights Reserved. Apache, Apache Pulsar and the Apache feather logo are trademarks of The Apache Software Foundation.</section><span><script>
const community = document.querySelector("a[href='#community']").parentNode;
const communityMenu =
'<li>' +
'<a id="community-menu" href="#">Community <span style="font-size: 0.75em">&nbsp;▼</span></a>' +
'<div id="community-dropdown" class="hide">' +
'<ul id="community-dropdown-items">' +
'<li><a href="/en/contact">Contact</a></li>' +
'<li><a href="/en/contributing">Contributing</a></li>' +
'<li><a href="/en/coding-guide">Coding guide</a></li>' +
'<li><a href="/en/events">Events</a></li>' +
'<li><a href="https://twitter.com/Apache_Pulsar" target="_blank">Twitter &#x2750</a></li>' +
'<li><a href="https://github.com/apache/pulsar/wiki" target="_blank">Wiki &#x2750</a></li>' +
'<li><a href="https://github.com/apache/pulsar/issues" target="_blank">Issue tracking &#x2750</a></li>' +
'<li><a href="https://pulsar-summit.org/" target="_blank">Pulsar Summit &#x2750</a></li>' +
'<li>&nbsp;</li>' +
'<li><a href="/en/resources">Resources</a></li>' +
'<li><a href="/en/team">Team</a></li>' +
'<li><a href="/en/powered-by">Powered By</a></li>' +
'</ul>' +
'</div>' +
'</li>';
community.innerHTML = communityMenu;
const communityMenuItem = document.getElementById("community-menu");
const communityDropDown = document.getElementById("community-dropdown");
communityMenuItem.addEventListener("click", function(event) {
event.preventDefault();
if (communityDropDown.className == 'hide') {
communityDropDown.className = 'visible';
} else {
communityDropDown.className = 'hide';
}
});
</script></span></footer></div><script>window.twttr=(function(d,s, id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src='https://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js, fjs);t._e = [];t.ready = function(f) {t._e.push(f);};return t;}(document, 'script', 'twitter-wjs'));</script></body></html>