Access
- 默认情况下,InfluxDB 3 Core 监听以下端口:
http://<SERVER_IP>:8181 - Ensure port
8181/tcp如需远程访问,请确保该端口已开放。
Authentication & Tokens
- InfluxDB 3 Core 使用基于令牌的身份验证。
- 创建管理员(operator)令牌:
influxdb3 create token --admin - 令牌仅显示一次。
- 请妥善保存,之后无法再次获取。
重要文件与目录
- Configuration file:
/etc/influxdb3/influxdb3-core.conf - Data directory:
/var/lib/influxdb3/data - Plugin directory:
/var/lib/influxdb3/plugins - Systemd service:
influxdb3-core
Service Management
停止服务:
systemctl stop influxdb3-core
启动服务:
systemctl start influxdb3-core
重启服务:
systemctl restart influxdb3-core
Check status:
systemctl status influxdb3-core
View logs:
journalctl -u influxdb3-core -f
基本用法(CLI)
显示可用数据库:
influxdb3 show databases --token <AUTH_TOKEN>
Use the write 插入数据的命令:
influxdb3 write
--database <DATABASE_NAME>
--token <AUTH_TOKEN>
--precision s
'home,room=Living Room temp=21.1,hum=35.9,co=0i 1641024000
home,room=Kitchen temp=21.0,hum=35.9,co=0i 1641024000
home,room=Living Room temp=21.4,hum=35.9,co=0i 1641027600
home,room=Kitchen temp=23.0,hum=36.2,co=0i 1641027600
home,room=Living Room temp=21.8,hum=36.0,co=0i 1641031200
home,room=Kitchen temp=22.7,hum=36.1,co=0i 1641031200'
对数据库执行 SQL 查询:
influxdb3 query
--database <DATABASE_NAME>
--token <AUTH_TOKEN>
"SELECT * FROM home ORDER BY time"