====== InfluxDB ====== * https://www.influxdata.com/ * [[monitoring:grafana|Grafana]] 와 자주 함께 사용됨 * https://www.influxdata.com/time-series-platform/chronograf/ ===== Install / Docker ===== * https://hub.docker.com/_/influxdb # 버전 명시해서 받기 docker run --name=influxdb -p 8086:8086 \ -v influxdb:/var/lib/influxdb influxdb:1.7 * 환경변수 등으로 설정할 수도 있고, config 파일을 마운트하여 설정도 가능하다. * CLI 툴을 실행하려면 # 앞서 생성한 docker 컨테이너에서 실행 docker exec -it influxdb influx # 혹은 별도 컨테이너로 앞서 생성한 docker 에 접속 docker run --rm --link=influxdb -it influxdb influx -host influxdb ===== 기본명령 ===== ==== 데이터베이스 ==== create database use show databases ==== measurement ==== * RDB의 테이블과 비슷한 역할. * 생성할 필요 없다. 즉시 사용하면 된다. * Schemaless 이다. tag(RDB의 컬럼개념)를 추가 insert하면 자동 추가된다. # insert - insert시점의 시간 정보가 함께 들어감. UTC 기준 nanoseconds insert ,host=server01,region=korea value=5.5 # 메저먼트 목록보기 show measurements # select select * from ## 결과 name: memory time host region value ---- ---- ------ ----- 1569475638653879967 server01 korea 5.5 # 태그 키 목록보기 show tag keys [FROM measurement] # 필드 키 목록 보기 show field keys [FROM measurement] * ''select'' 조회 조건은 항상 tag key 를 기준으로 한다. 그 결과로 필드 키의 값들을 가져오는 것이다. ===== REST API ===== ==== 조회 ==== curl -G 'http://localhost:8086/query?pretty=true' \ --data-urlencode 'db=' \ --data-urlencode "q=SELECT * FROM where host='server01'" ==== INSERT ==== curl -i -XPOST 'http://localhost:8086/write?db=' --data-binary ',host=server01,region=us-west value=0.65' ==== User ==== CREATE USER WITH PASSWORD '' WITH ALL PRIVILEGES # 사용자 목록 보기 show users ===== InfluxDB Relay ===== * https://github.com/strike-team/influxdb-relay * High Availability 오픈 소스 솔루션 * 혹은 상용 솔루션 사용 ===== TimeSeriesAdmin - GUI Admin ===== * https://timeseriesadmin.github.io/ : [[:electron|Electron]] 기반 혹은 웹 기반 Admin # 8085 포트로 지정 docker run --rm -p 8085:80 --name=myinfluxdbadmin timeseriesadmin/timeseriesadmin * 이제 http://localhost:8085 로 접속하여 influxdb 접속 정보를 주면된다. * **주의점: docker 이용시라도 influxdb 호출은 server-to-server가 아니라 browser-to-influxdb 로 이루어지므로 브라우저에서 influxdb 에 접근 가능하게 네트워크 설정을 해야한다.** ===== 참조 ===== * [[https://blog.naver.com/PostView.nhn?blogId=alice_k106&logNo=221226137412&parentCategoryNo=&categoryNo=27&viewDate=&isShowPopularPosts=true&from=search|130. [InfluxDB] InfluxDB Quickstart 및 간단한 사용 방법 정리]] * [[https://brunch.co.kr/@sunghyunlim/3|InfluxDB로 알아보는 time-series DB 0. InfluxDB소개]] * [[https://egkatzioura.com/2019/03/13/a-guide-to-the-influxdbmapper-and-querybuilder-for-java-part-1/|A guide to the InfluxDBMapper and QueryBuilder for Java Part: 1 – Emmanouil Gkatziouras]] * [[https://egkatzioura.com/2019/03/20/a-guide-to-the-influxdbmapper-and-querybuilder-for-java-part-2/|A guide to the InfluxDBMapper and QueryBuilder for Java Part: 2 – Emmanouil Gkatziouras]] * [[https://egkatzioura.com/2019/03/29/a-guide-to-the-influxdbmapper-and-querybuilder-for-java-part-3/|A guide to the InfluxDBMapper and QueryBuilder for Java: Group By – Emmanouil Gkatziouras]] * [[https://egkatzioura.com/2019/04/23/a-guide-to-the-influxdbmapper-and-querybuilder-for-java-part-into-and-order/|A guide to the InfluxDBMapper and QueryBuilder for Java: Into and Order – Emmanouil Gkatziouras]] * [[https://www.popit.kr/influxdb_telegraf_grafana_1/|InfluxDB, Telegraf, Grafana 를 활용한 Monitoring System 만들기(1) | Popit]] * [[https://www.popit.kr/influxdb_telegraf_grafana_2/|InfluxDB, Telegraf, Grafana 를 활용한 Monitoring System 만들기(2) | Popit]] * [[https://www.popit.kr/influxdb_telegraf_grafana_3/|InfluxDB, Telegraf, Grafana 를 활용한 Monitoring System 만들기(3) | Popit]] * [[https://swalloow.github.io/influx-grafana1|influxDB와 Grafana로 실시간 서버 모니터링 구축하기(1)]] * [[https://swalloow.github.io/influx-grafana2|influxDB와 Grafana로 실시간 서버 모니터링 구축하기(2)]]