安装 Chronograf

方式一:使用 systemd 将 Chronograf 安装为 服务
1、使用以下命令从 InfluxData 下载页面使用 URL 下载并安装适当的 .deb 或文件:.rpm

下载页面:https://portal.influxdata.com/downloads/


# Ubuntu/Debian
wget https://dl.influxdata.com/chronograf/releases/chronograf_1.10.0_amd64.deb
sudo dpkg -i chronograf_1.10.0_amd64.deb

# RedHat & CentOS
wget https://dl.influxdata.com/chronograf/releases/chronograf-1.10.0.x86_64.rpm
sudo yum localinstall chronograf-1.10.0.x86_64.rpm

使用.rpm包下载的确切文件名(例如,chronograf-1.10.0.x86_64.rpm)。

2、启动 InfluxDB 服务:
sudo service chronograf start

systemctl start chronograf #启动服务
systemctl status chronograf #查看状态
systemctl enable chronograf #开启开机启动

安装 InfluxDB 包会创建一个服务文件,/lib/systemd/system/influxdb.service 用于在启动时将 InfluxDB 作为后台服务启动。

3、重新启动系统并验证服务是否正常运行:
$  sudo service influxdb status
● influxdb.service - InfluxDB is an open-source, distributed, time series database
  Loaded: loaded (/lib/systemd/system/influxdb.service; enabled; vendor preset: enable>
  Active: active (running)
4、开机自启动

将参数传递给 systemd

添加一行或多行,如下所示,包含influxdto的参数/etc/default/influxdb2:

ARG1="--http-bind-address :8087"
ARG2="<another argument here>"

编辑 /lib/systemd/system/influxdb.service 文件如下:

ExecStart=/usr/bin/influxd $ARG1 $ARG2

方式二:手动下载并安装 influxd 二进制文件

1、下载 InfluxDB 二进制文件。

从浏览器 或 命令行 下载 InfluxDB 二进制文件。

注意:可先网页下载到本地,上传到 /usr/local/src 目录下,也可以使用 wget 下载;

从您的浏览器下载

从命令行下载

  • Linux Binaries (64-bit)
wget https://dl.influxdata.com/chronograf/releases/chronograf-1.10.0_linux_amd64.tar.gz
tar xvfz chronograf-1.10.0_linux_amd64.tar.gz
  • Linux Binaries (32-bit)
wget https://dl.influxdata.com/chronograf/releases/chronograf-1.10.0_linux_i386.tar.gz
tar xvfz chronograf-1.10.0_linux_i386.tar.gz
  • Linux Binaries (ARMv8)
wget https://dl.influxdata.com/chronograf/releases/chronograf-1.10.0_linux_arm64.tar.gz
tar xvfz chronograf-1.10.0_linux_arm64.tar.gz
  • Linux Binaries (ARMv7)
wget https://dl.influxdata.com/chronograf/releases/chronograf-1.10.0_linux_armhf.tar.gz
tar xvfz chronograf-1.10.0_linux_armhf.tar.gz
2、解压并安装
amd64
$ cd /usr/local/src && tar xvzf influxdb2-2.6.1-linux-amd64.tar.gz -C /usr/local
$ cd .. && mv influxdb2_linux_amd64 influxdb2
$ echo 'export INFLUXDB_HOME=/usr/local/influxdb2/' >>/etc/profile
$ echo 'export PATH="$PATH:$INFLUXDB_HOME/bin"' >>/etc/profile
$ source /etc/profile
# (可选)将提取的influxd可执行二进制文件放入您的系统中$PATH
$ sudo cp influxdb2/influxd /usr/local/bin/
$ ln -s influxdb2/influxd /usr/local/bin/influxd;
arm
# 本地安装包
$ cd /usr/local/src && tar xvzf influxdb2-2.6.1-linux-arm64.tar.gz -C /usr/local
$ cd .. && mv influxdb2_linux_amd64 influxdb2
$ echo 'export INFLUXDB_HOME=/usr/local/influxdb2/' >>/etc/profile
$ echo 'export PATH="$PATH:$INFLUXDB_HOME/bin"' >>/etc/profile
$ source /etc/profile
# (可选)将提取的influxd可执行二进制文件放入您的系统中$PATH
$ sudo cp influxdb2/influxd /usr/local/bin/
3、启动 InfluxDB

如果 InfluxDB 作为 systemd 服务安装,则 systemd 管理influxd守护进程,不需要进一步的操作。如果二进制文件是手动下载并添加到系统中的,请使用以下命令$PATH启动守护进程:influxd

[root@localhost local]# influxd
2023-02-08T08:40:26.285251Z     info    Welcome to InfluxDB     {"log_id": "0ft2mDg0000", "version": "v2.6.1", "commit": "9dcf880fe0", "build_date": "2022-12-29T15:53:07Z", "log_level": "info"}
2023-02-08T08:40:26.326574Z     info    Resources opened        {"log_id": "0ft2mDg0000", "service": "bolt", "path": "/root/.influxdbv2/influxd.bolt"}
2023-02-08T08:40:26.326708Z     info    Resources opened        {"log_id": "0ft2mDg0000", "service": "sqlite", "path": "/root/.influxdbv2/influxd.sqlite"}
2023-02-08T08:40:26.338018Z     info    Bringing up metadata migrations {"log_id": "0ft2mDg0000", "service": "KV migrations", "migration_count": 20}
2023-02-08T08:40:27.847882Z     info    Bringing up metadata migrations {"log_id": "0ft2mDg0000", "service": "SQL migrations", "migration_count": 8}
2023-02-08T08:40:28.143999Z     info    Using data dir  {"log_id": "0ft2mDg0000", "service": "storage-engine", "service": "store", "path": "/root/.influxdbv2/engine/data"}
2023-02-08T08:40:28.144207Z     info    Compaction settings     {"log_id": "0ft2mDg0000", "service": "storage-engine", "service": "store", "max_concurrent_compactions": 4, "throughput_bytes_per_second": 50331648, "throughput_bytes_per_second_burst": 50331648}
2023-02-08T08:40:28.144291Z     info    Open store (start)      {"log_id": "0ft2mDg0000", "service": "storage-engine", "service": "store", "op_name": "tsdb_open", "op_event": "start"}
2023-02-08T08:40:28.144402Z     info    Open store (end)        {"log_id": "0ft2mDg0000", "service": "storage-engine", "service": "store", "op_name": "tsdb_open", "op_event": "end", "op_elapsed": "0.127ms"}
2023-02-08T08:40:28.144468Z     info    Starting retention policy enforcement service   {"log_id": "0ft2mDg0000", "service": "retention", "check_interval": "30m"}
2023-02-08T08:40:28.144499Z     info    Starting precreation service    {"log_id": "0ft2mDg0000", "service": "shard-precreation", "check_interval": "10m", "advance_period": "30m"}
2023-02-08T08:40:28.146053Z     info    Starting query controller       {"log_id": "0ft2mDg0000", "service": "storage-reads", "concurrency_quota": 1024, "initial_memory_bytes_quota_per_query": 9223372036854775807, "memory_bytes_quota_per_query": 9223372036854775807, "max_memory_bytes": 0, "queue_size": 1024}
2023-02-08T08:40:28.150441Z     info    Configuring InfluxQL statement executor (zeros indicate unlimited).     {"log_id": "0ft2mDg0000", "max_select_point": 0, "max_select_series": 0, "max_select_buckets": 0}
2023-02-08T08:40:28.191576Z     info    Starting        {"log_id": "0ft2mDg0000", "service": "telemetry", "interval": "8h"}
2023-02-08T08:40:28.194039Z     info    Listening       {"log_id": "0ft2mDg0000", "service": "tcp-listener", "transport": "http", "addr": ":8086", "port": 8086}
4、开机自启动

[root@local ~]# vi /lib/systemd/system/influxd.service

脚本内容:

[Unit]
Description=InfluxDB is an open source time series platform.
Documentation=https://github.com/influxdata/influxdb
After=network.target

[Service]
User=root
ExecStart=/usr/local/bin/influxd -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraf/telegraf.d
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
LimitNOFILE=65536
TimeoutStopSec=20
Restart=on-failure
StartLimitInterval=60
StartLimitBurst=3000

[Install]
WantedBy=multi-user.target

设置随机启动:

[root@local ~]# systemctl daemon-reload
[root@local ~]# systemctl disable influxd.service
[root@local ~]# systemctl enable influxd.service
[root@local ~]# systemctl start influxd.service
[root@local ~]# systemctl status influxd.service
[root@local ~]# systemctl stop influxd.service
[root@local ~]# systemctl restart influxd.service

浏览器访问数据库管理平台:

http://[IP]:8086/

安装 influx CLI(可选)

使用influxCLI 与 InfluxDB 实例交互并对其进行管理。编写和查询数据、生成 InfluxDB 模板、导出数据等。

1、下载 influx CLI 包。

从 浏览器 或命令行下载influxCLI 包。

注意:可先网页下载到本地,上传到 /usr/local/src 目录下,也可以使用 wget 下载;

从您的浏览器下载

从命令行下载

# amd64
wget https://dl.influxdata.com/influxdb/releases/influxdb2-client-2.6.1-linux-amd64.tar.gz

# arm
wget https://dl.influxdata.com/influxdb/releases/influxdb2-client-2.6.1-linux-arm64.tar.gz
2、解压并安装
amd64
$ cd /usr/local/src && tar xvzf influxdb2-client-2.6.1-linux-amd64.tar.gz -C /usr/local
$ cd .. && mv influxdb2-client-2.6.1-linux-amd64 influxdb2-client
$ echo 'export INFLUXDB_HOME=/usr/local/influxdb2-client/' >>/etc/profile
$ echo 'export PATH="$PATH:$INFLUXDB_HOME/bin"' >>/etc/profile
$ source /etc/profile
# (可选)将提取的influxd可执行二进制文件放入您的系统中$PATH
$ sudo cp influxdb2-client/influx /usr/local/bin/
arm
$ cd /usr/local/src && tar xvzf influxdb2-client-2.6.1-linux-arm64.tar.gz -C /usr/local
$ cd .. && mv influxdb2-client-2.6.1-linux-arm64 influxdb2-client
$ echo 'export INFLUXDB_HOME=/usr/local/influxdb2-client/' >>/etc/profile
$ echo 'export PATH="$PATH:$INFLUXDB_HOME/bin"' >>/etc/profile
$ source /etc/profile
# (可选)将提取的influxd可执行二进制文件放入您的系统中$PATH
$ sudo cp influxdb2-client/influx /usr/local/bin/

配置完成后命令行执行 influx 查看命令情况

[root@localhost local]# influx
NAME:
   influx - Influx Client

USAGE:
   influx [command]

HINT: If you are looking for the InfluxQL shell from 1.x, run "influx v1 shell"

COMMANDS:
   version              Print the influx CLI version
   write                Write points to InfluxDB
   bucket               Bucket management commands
   completion           Generates completion scripts
   query                Execute a Flux query
   config               Config management commands
   org, organization    Organization management commands
   delete               Delete points from InfluxDB
   user                 User management commands
   task                 Task management commands
   telegrafs            List Telegraf configuration(s). Subcommands manage Teleg                                                                                             raf configurations.
   dashboards           List Dashboard(s).
   export               Export existing resources as a template
   secret               Secret management commands
   v1                   InfluxDB v1 management commands
   auth, authorization  Authorization management commands
   apply                Apply a template to manage resources
   stacks               List stack(s) and associated templates. Subcommands mana                                                                                             ge stacks.
   template             Summarize the provided template
   bucket-schema        Bucket schema management commands
   scripts              Scripts management commands
   ping                 Check the InfluxDB /health endpoint
   setup                Setup instance with initial user, org, bucket
   backup               Backup database
   restore              Restores a backup directory to InfluxDB
   remote               Remote connection management commands
   replication          Replication stream management commands
   server-config        Display server config
   help, h              Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h  show help

通过 UI 设置 InfluxDB

在 InfluxDB 运行的情况下,访问 http://localhost:8086。

  1. 点击开始

  1. 设置您的初始用户

  1. 输入初始用户的用户名。
  2. 为您的用户输入密码和确认密码。
  3. 输入您的初始组织名称。
  4. 输入您的初始Bucket Name。
  5. 单击继续。

  1. 您的 InfluxDB 实例现已初始化。
使用 Linux Binaries 方式安装
1、c:
作者:Jeebiz  创建时间:2023-02-08 21:23
最后编辑:Jeebiz  更新时间:2024-02-26 11:18