部署 InfluxDB
APT方式部署
# wget -q https://repos.influxdata.com/influxdata-archive_compat.key
# echo '393e8779c89ac8d958f81f942f9ad7fb82a25e133faddaf92e15b16e6ac9ce4c influxdata-archive_compat.key' | sha256sum -c && cat influxdata-archive_compat.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/influxdata-archive_compat.gpg > /dev/null
# echo 'deb [signed-by=/etc/apt/trusted.gpg.d/influxdata-archive_compat.gpg] https://repos.influxdata.com/debian stable main' | sudo tee /etc/apt/sources.list.d/influxdata.list
# sudo apt-get update && sudo apt-get install influxdb2
二进制部署
创建influxdb用户
# groupadd -g 998 -o -r influxdb
# useradd -M -N -g influxdb -o -r -d /data/apps/influxdb2 -s /bin/false -c "Influxdb Server" -u 998 influxdb
# mkdir /data/apps/influxdb -pv
# chown influxdb.influxdb /data/apps/influxdb2/
下载 InfluxDB 二进制文件
# wget https://dl.influxdata.com/influxdb/releases/influxdb2-2.6.1-linux-amd64.tar.gz
解压InfluxDB
# tar xf influxdb2-2.6.1-linux-amd64.tar.gz -C /data/apps/influxdb2
# ln -sv /data/apps/influxdb2/influxdb2_linux_amd64/ /usr/local/influxdb2
设置目录权限
# chmod 0750 /data/apps/influxdb2/
# chown influxdb.influxdb /usr/local/influxdb2 && chown -R influxdb.influxdb /data/apps/influxdb2/
启动脚本
influxd-systemd-start.sh
#!/bin/bash
/usr/local/influxdb2/influxd --reporting-disabled &
PID=$!
echo $PID > /data/apps/influxdb2/influxd.pid
设置权限
# chmod +x influxd-systemd-start.sh
# chown influxdb.influxdb influxd-systemd-start.sh
influxdb.service
[Unit]
Description=InfluxDB is an open-source, distributed, time series database
Documentation=https://docs.influxdata.com/influxdb/
After=network-online.target
[Service]
User=influxdb
Group=influxdb
LimitNOFILE=65536
WorkingDirectory=/usr/local/influxdb2
ExecStart=/data/apps/influxdb2/influxd-systemd-start.sh
KillMode=control-group
Restart=on-failure
Type=forking
PIDFile=/data/apps/influxdb2/influxd.pid
StateDirectory=influxdb
StateDirectoryMode=0750
LogsDirectory=influxdb
LogsDirectoryMode=0750
UMask=0027
[Install]
WantedBy=multi-user.target
Alias=influxd.service
启动服务
# systemctl enable influxdb && systemctl start influxdb
验证服务
# curl http://127.0.0.1:8086/ready
{
"status": "ready",
"started": "2023-03-24T16:31:05.053951093+08:00",
"up": "39m35.620502113s"
}
查看数据目录
# tree -a /data/apps/influxdb2/
/data/apps/influxdb2/
├── .cache
│ └── snowflake
│ └── ocsp_response_cache.json
├── .influxdbv2
│ ├── engine
│ │ ├── data
│ │ └── replicationq
│ ├── influxd.bolt
│ └── influxd.sqlite
├── influxd-systemd-start.sh
├── influxd.pid
└── influxdb2_linux_amd64
├── LICENSE
├── README.md
└── influxd
7 directories, 8 files
UI 设置 InfluxDB
访问dashboard
http://localhost:8086
设置初始用户
创建全访问令牌
创建一个桶
参考文档
https://docs.influxdata.com/influxdb/v2.6/install/
标签:v2.6,influxdb2,influxd,apps,influxdb,部署,InfluxDB,influxdata,data From: https://www.cnblogs.com/wangguishe/p/17251689.html