| "use strict";(self.webpackChunkhertzbeat=self.webpackChunkhertzbeat||[]).push([[73976],{15680:(e,t,n)=>{n.d(t,{xA:()=>u,yg:()=>f});var a=n(96540);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),c=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=c(e.components);return a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=c(n),f=r,m=d["".concat(s,".").concat(f)]||d[f]||p[f]||o;return n?a.createElement(m,i(i({ref:t},u),{},{components:n})):a.createElement(m,i({ref:t},u))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var c=2;c<o;c++)i[c]=n[c];return a.createElement.apply(null,i)}return a.createElement.apply(null,n)}d.displayName="MDXCreateElement"},50861:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var a=n(58168),r=(n(96540),n(15680));const o={id:"influxdb-init",title:"Use Time Series Database InfluxDB to Store Metrics Data (Optional)",sidebar_label:"Use InfluxDB Store Metrics"},i=void 0,l={unversionedId:"start/influxdb-init",id:"start/influxdb-init",title:"Use Time Series Database InfluxDB to Store Metrics Data (Optional)",description:"HertzBeat's historical data storage relies on the time series database, you can choose one of them to install and initialize, or not to install (note \u26a0\ufe0f but it is strongly recommended to configure in the production environment)",source:"@site/docs/start/influxdb-init.md",sourceDirName:"start",slug:"/start/influxdb-init",permalink:"/docs/start/influxdb-init",draft:!1,editUrl:"https://github.com/apache/hertzbeat/edit/master/home/docs/start/influxdb-init.md",tags:[],version:"current",frontMatter:{id:"influxdb-init",title:"Use Time Series Database InfluxDB to Store Metrics Data (Optional)",sidebar_label:"Use InfluxDB Store Metrics"},sidebar:"docs",previous:{title:"Use GreptimeDB Store Metrics",permalink:"/docs/start/greptime-init"},next:{title:"Use MYSQL Instead of H2",permalink:"/docs/start/mysql-change"}},s={},c=[{value:"1. Use HuaweiCloud GaussDB For Influx",id:"1-use-huaweicloud-gaussdb-for-influx",level:3},{value:"2. Install TDengine via Docker",id:"2-install-tdengine-via-docker",level:3},{value:"Configure the database connection in hertzbeat <code>application.yml</code> configuration file",id:"configure-the-database-connection-in-hertzbeat-applicationyml-configuration-file",level:3},{value:"FAQ",id:"faq",level:3}],u={toc:c};function p(e){let{components:t,...n}=e;return(0,r.yg)("wrapper",(0,a.A)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.yg)("p",null,"HertzBeat's historical data storage relies on the time series database, you can choose one of them to install and initialize, or not to install (note \u26a0\ufe0f but it is strongly recommended to configure in the production environment)\nWe recommend VictoriaMetrics for long term support."),(0,r.yg)("p",null,"TDengine is the Time Series Data Platform where developers build IoT, analytics, and cloud applications."),(0,r.yg)("p",null,(0,r.yg)("strong",{parentName:"p"},"Note\u26a0\ufe0f Time series database is optional, but production environment configuration is strongly recommended to provide more complete historical chart functions and high performance"),(0,r.yg)("br",{parentName:"p"}),"\n",(0,r.yg)("strong",{parentName:"p"},"\u26a0\ufe0f If you do not configure a time series database, only the last hour of historical data is retained."),(0,r.yg)("br",{parentName:"p"}),"\n","Note\u26a0\ufe0f Need InfluxDB 1.x Version. "),(0,r.yg)("h3",{id:"1-use-huaweicloud-gaussdb-for-influx"},"1. Use HuaweiCloud GaussDB For Influx"),(0,r.yg)("blockquote",null,(0,r.yg)("p",{parentName:"blockquote"},"Use ",(0,r.yg)("a",{parentName:"p",href:"https://www.huaweicloud.com/product/gaussdbforinflux.html"},"HuaweiCloud GaussDB For Influx"))),(0,r.yg)("blockquote",null,(0,r.yg)("p",{parentName:"blockquote"},"Get the ",(0,r.yg)("inlineCode",{parentName:"p"},"GaussDB For Influx")," service url, username and password config. ")),(0,r.yg)("p",null,"\u26a0\ufe0fNote ",(0,r.yg)("inlineCode",{parentName:"p"},"GaussDB For Influx")," enable SSL default, the service url should use ",(0,r.yg)("inlineCode",{parentName:"p"},"https:")),(0,r.yg)("h3",{id:"2-install-tdengine-via-docker"},"2. Install TDengine via Docker"),(0,r.yg)("blockquote",null,(0,r.yg)("p",{parentName:"blockquote"},"Refer to the official website ",(0,r.yg)("a",{parentName:"p",href:"https://hub.docker.com/_/influxdb"},"installation tutorial")," "),(0,r.yg)("ol",{parentName:"blockquote"},(0,r.yg)("li",{parentName:"ol"},"Download and install Docker environment",(0,r.yg)("br",{parentName:"li"}),"Docker tools download refer to ",(0,r.yg)("a",{parentName:"li",href:"https://docs.docker.com/get-docker/"},"Docker official document"),".",(0,r.yg)("br",{parentName:"li"}),"After the installation you can check if the Docker version normally output at the terminal. ",(0,r.yg)("pre",{parentName:"li"},(0,r.yg)("code",{parentName:"pre"},"$ docker -v\nDocker version 20.10.12, build e91ed57\n"))),(0,r.yg)("li",{parentName:"ol"},"Install InfluxDB with Docker ",(0,r.yg)("pre",{parentName:"li"},(0,r.yg)("code",{parentName:"pre"},"$ docker run -p 8086:8086 \\\n -v /opt/influxdb:/var/lib/influxdb \\\n influxdb:1.8\n")),(0,r.yg)("inlineCode",{parentName:"li"},"-v /opt/influxdb:/var/lib/influxdb")," is local persistent mount of InfluxDB data directory. ",(0,r.yg)("inlineCode",{parentName:"li"},"/opt/influxdb")," should be replaced with the actual local directory.",(0,r.yg)("br",{parentName:"li"}),"use",(0,r.yg)("inlineCode",{parentName:"li"},"$ docker ps")," to check if the database started successfully"))),(0,r.yg)("h3",{id:"configure-the-database-connection-in-hertzbeat-applicationyml-configuration-file"},"Configure the database connection in hertzbeat ",(0,r.yg)("inlineCode",{parentName:"h3"},"application.yml")," configuration file"),(0,r.yg)("ol",null,(0,r.yg)("li",{parentName:"ol"},"Configure HertzBeat's configuration file",(0,r.yg)("br",{parentName:"li"}),"Modify ",(0,r.yg)("inlineCode",{parentName:"li"},"hertzbeat/config/application.yml")," configuration file ",(0,r.yg)("a",{parentName:"li",href:"https://github.com/dromara/hertzbeat/raw/master/script/application.yml"},"/script/application.yml"),(0,r.yg)("br",{parentName:"li"}),"Note\u26a0\ufe0fThe docker container way need to mount application.yml file locally, while you can use installation package way to unzip and modify ",(0,r.yg)("inlineCode",{parentName:"li"},"hertzbeat/config/application.yml"),(0,r.yg)("br",{parentName:"li"}),"Replace ",(0,r.yg)("inlineCode",{parentName:"li"},"warehouse.store.influxdb")," data source parameters, URL account and password. ")),(0,r.yg)("pre",null,(0,r.yg)("code",{parentName:"pre",className:"language-yaml"},"warehouse:\n store:\n # disable jpa\n jpa:\n enabled: false\n # enable influxdb\n influxdb:\n enabled: true\n server-url: http://localhost:8086\n username: root\n password: root\n expire-time: '30d'\n replication: 1\n")),(0,r.yg)("ol",{start:2},(0,r.yg)("li",{parentName:"ol"},"Restart HertzBeat")),(0,r.yg)("h3",{id:"faq"},"FAQ"),(0,r.yg)("ol",null,(0,r.yg)("li",{parentName:"ol"},"Do both the time series databases InfluxDB, IoTDB and TDengine need to be configured? Can they both be used?")),(0,r.yg)("blockquote",null,(0,r.yg)("p",{parentName:"blockquote"},"You don't need to configure all of them, you can choose one of them. Use the enable parameter to control whether it is used or not. You can also install and configure neither, which only affects the historical chart data.")))}p.isMDXComponent=!0}}]); |