• InfluxDB学习(一):基本概念和安装


    一. InfluxDB数据库介绍

    InfluxDB是Influxdata旗下开源的一种时序数据库(Time Series Database),根据DB-engine排名,目前在time series数据库领域排名第一位。

    InfluxDB下载地址

    https://portal.influxdata.com/downloads/

    InfluxDB排名

    https://db-engines.com/en/ranking/time+series+dbms

     InfluxDB主要功能

    1. 对时序数据(sereis data)使用TSM存储引擎,提供高性能的数据写入和压缩功能。
    2. go语言编写,程序只有一个二进制的可执行文件,没有其他依关系。
    3. 通过http API可提供高性能的便捷的读写操作。
    4. 插件支持采集Graphite, collectd, and OpenTSDB等数据源。
    5. 提供类似SQL语法格式的数据操作。
    6. 保留策略(retention policies)功能可以定期清除老旧数据。
    7. 不间断(continuous queries)自动化查询功能统计聚合数据来使数据查询更有效率。

    缺点:

    1. 社区版只支持单机部署,集群功能需要使用收费的企业版。
    2. InfluxDB中文学习文档较少,对于想要了解该数据库的用户有一定的不便。

    InfluxDB与RDBMS中的概念比较

    概念 InfluxDB RDBMS
    数据库 database database
    measurement table
    point row
    tag(可索引),field(不可索引) column

    二. InfluxDB数据库安装

    # mkdir /usr/local/influxdb
    # groupadd -r dba
    # useradd -r -g dba tnuser
    # chown -R tnuser.dba /usr/local/influxdb
    # sudo su - tnuser
    $ cd /usr/local/influxdb
    $ wget https://dl.influxdata.com/influxdb/releases/influxdb-1.8.0-static_linux_amd64.tar.gz
    $ tar -zxf influxdb-1.8.0-static_linux_amd64.tar.gz
    $ mv influxdb-1.8.0-1/* .
    $ rm -rf influxdb-1.8.0*

    修改InfluxDB数据库配置文件,模板文件在数据库安装路径下的etc/influxdb/influxdb.conf

    reporting-disabled = true
    bind-address = "0.0.0.0:8088"
    [meta]
      dir = "/usr/local/influxdb/meta"
      retention-autocreate = true
    [data]
      dir = "/usr/local/influxdb/data"
      wal-dir = "/usr/local/influxdb/wal"

    使用CentOS7的systemctl管理InfluxDB服务

    [Unit]
    Description=InfluxDB is time series database
    Documentation=https://docs.influxdata.com/influxdb/v1.8/introduction/get-started/
    After=syslog.target
    After=network.target

    [Service]
    Type=fork
    User=tnuser
    Group=dba
    Restart=always

    # Disable OOM kill on the Redis
    OOMScoreAdjust=-1000
    Environment=PG_OOM_ADJUST_FILE=/proc/self/oom_score_adj
    Environment=PG_OOM_ADJUST_VALUE=0

    ExecStart=/usr/local/influxdb/usr/bin/influxd run -config /usr/local/influxdb/etc/influxdb/influxdb.conf
    ExecStop=/bin/kill -15 $MAINPID
    ExecReload=/bin/kill -s HUP $MAINPID
    LimitNOFILE=65536

    [Install]
    WantedBy=multi-user.target

    # systemctl daemon-reload
    # systemctl enable influxdb
    # systemctl start influxdb
    # systemctl status influxdb
    ● influxdb.service - InfluxDB is time series database
       Loaded: loaded (/usr/lib/systemd/system/influxdb.service; disabled; vendor preset: disabled)
       Active: active (running) since Sat 2020-04-18 23:19:03 PDT; 1s ago
         Docs: https://docs.influxdata.com/influxdb/v1.8/introduction/get-started/
     Main PID: 22583 (influxd)
       CGroup: /system.slice/influxdb.service
               └─22583 /usr/local/influxdb/usr/bin/influxd
    
    Apr 18 23:19:04 ec2t-dbaadmin-01.mypna.com influxd[22583]: ts=2020-04-19T06:19:04.203421Z lvl=info msg="InfluxDB starting" log...568f5
    Apr 18 23:19:04 ec2t-dbaadmin-01.mypna.com influxd[22583]: ts=2020-04-19T06:19:04.203467Z lvl=info msg="Go runtime" log_id=0MG...ocs=4
    Apr 18 23:19:04 ec2t-dbaadmin-01.mypna.com influxd[22583]: ts=2020-04-19T06:19:04.311597Z lvl=info msg="Using data dir" log_id.../data
    Apr 18 23:19:04 ec2t-dbaadmin-01.mypna.com influxd[22583]: ts=2020-04-19T06:19:04.311635Z lvl=info msg="Compaction settings" l...31648
    Apr 18 23:19:04 ec2t-dbaadmin-01.mypna.com influxd[22583]: ts=2020-04-19T06:19:04.311647Z lvl=info msg="Open store (start)" lo...start
    Apr 18 23:19:04 ec2t-dbaadmin-01.mypna.com influxd[22583]: ts=2020-04-19T06:19:04.553803Z lvl=info msg="Reading file" log_id=0...87843
    Apr 18 23:19:04 ec2t-dbaadmin-01.mypna.com influxd[22583]: ts=2020-04-19T06:19:04.572851Z lvl=info msg="Opened file" log_id=0M...749ms
    Apr 18 23:19:04 ec2t-dbaadmin-01.mypna.com influxd[22583]: ts=2020-04-19T06:19:04.594031Z lvl=info msg="Opened file" log_id=0M...915ms
    Apr 18 23:19:04 ec2t-dbaadmin-01.mypna.com influxd[22583]: ts=2020-04-19T06:19:04.610554Z lvl=info msg="Opened shard" log_id=0...256ms
    Apr 18 23:19:04 ec2t-dbaadmin-01.mypna.com influxd[22583]: ts=2020-04-19T06:19:04.612039Z lvl=info msg="Opened shard" log_id=0...741ms
    Hint: Some lines were ellipsized, use -l to show in full.
  • 相关阅读:
    GitLab使用公钥SSH key登录
    P1305 新二叉树 /// 二叉树的先序遍历
    P1030 求先序排列 /// 二叉树的遍历
    P1020 导弹拦截 /// DP Dilworth定理 LIS、LDS优化
    USACO 2008 November Gold Cheering up the Cows /// MST oj24381
    USACO 2009 Open Grazing2 /// DP+滚动数组oj26223
    Mid-Atlantic 2008 Lawrence of Arabia /// 区间DP oj21080
    炮兵阵地 /// 状压DP oj26314
    Post Office IOI 2000 /// 区间DP oj24077
    Print Article /// 斜率优化DP oj26302
  • 原文地址:https://www.cnblogs.com/ilifeilong/p/12731327.html
Copyright © 2020-2023  润新知