使用权
- 默认情况下,InfluxDB 3 Core 监听:
http://<SERVER_IP>:8181 - 确保端口
8181/tcp如果远程访问则打开。
身份验证和令牌
- InfluxDB 3 Core 使用基于令牌的身份验证。
- 创建管理员(操作员)令牌:
influxdb3 create token --admin - 该令牌仅显示一次。
- 安全地保存它——以后无法取回。
重要文件和目录
- 配置文件:
/etc/influxdb3/influxdb3-core.conf - 数据目录:
/var/lib/influxdb3/data - 插件目录:
/var/lib/influxdb3/plugins - 系统服务:
influxdb3-core
服务管理
停止服务:
systemctl stop influxdb3-core
启动服务:
systemctl start influxdb3-core
重新启动服务:
systemctl restart influxdb3-core
检查状态:
systemctl status influxdb3-core
查看日志:
journalctl -u influxdb3-core -f
基本用法 (CLI)
显示可用的数据库:
influxdb3 show databases --token <AUTH_TOKEN>
使用 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"