influxdb首次安装教程

步骤1.

首先,通过apt在终端中运行以下以下命令,确保所有系统软件包都是最新的。

sudo apt update

步骤2:

wget -qO- https://repos.influxdata.com/influxdb.key | sudo apt-key add -
source /etc/lsb-release
echo "deb https://repos.influxdata.com/${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" | sudo tee /etc/apt/sources.list.d/influxdb.list

安装并启动InfluxDB:

sudo apt update
sudo apt install influxdb

成功安装后,启动并启用服务:

sudo systemctl enable --now influxdb

步骤3:

配置influxdb,关键!!!

即,只配置:

[http]
  # Determines whether HTTP endpoint is enabled.
  enabled = true
 
  # Determines whether the Flux query endpoint is enabled.
  flux-enabled = true
 
  # The bind address used by the HTTP service.
  bind-address = ":8086"

否则会报错:

Authorization failed everytime with: no user provided error

步骤4:

设置好配置以后将重启服务:

service influxdb restart

步骤5:配置防火墙。

我们将打开端口8086。默认情况下,InfluxDB使用以下网络端口:TCP端口8086用于通过InfluxDB的HTTP API进行客户端-服务器通信,而TCP端口8088用于RPC服务进行备份和还原:

sudo ufw enable
sudo ufw allow 8086/tcp

步骤6:

查看influx安装版本:

influx -version

如果报错,则根据提示安装:sudo apt install influxdb-client

步骤7:

进入influxdb数据库,并且设置用户名和密码:

influx
show status#查看状态
CREATE USER 'admin' WITH PASSWORD 'password' WITH ALL PRIVILEGES#如果报错则查看配置设置是否和上述的一致

如果报错:ERR: error parsing query: found admin, expected identifier at line 1, char 12

解决:

步骤8:使用Influxdb之使用数据库

新建数据库:create database "wxx"
查看所有的数据库:show databases 
使用数据库:use wxx
删除数据库:drop database 'wxx'

使用Influxdb之使用创建表

insert test,host=127.0.0.1,monitor_name=test,count=1 
#插入表名为test,字段为host,monitor_name,count的数据
drop measurement measurement_name
#删除表名
select * from database limit 10

#查询表
SELECT field1,field2 FROM "tableName"   WHERE time > '2018-08-15T02:29:20Z' AND time < '2018-08-15T02:30:20Z' Order by time DESC
#添加条件

参考文献:

influxdb用户权限篇-阿里云开发者社区

https://www.cnblogs.com/guyeshanrenshiwoshifu/p/9188368.html

在Ubuntu 20.04 LTS上安装InfluxDB_ubuntu20.4进入influx-CSDN博客

InfluxDB使用教程:Linux常用操作和命令_linux系统重启influxdb服务,并且执行 influxd --no-pprof命令-CSDN博客

  • 5
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Sure! Here's a step-by-step guide to installing InfluxDB on Windows: 1. First, visit the InfluxDB downloads page at https://portal.influxdata.com/downloads/ and scroll down to the "InfluxDB OSS" section. 2. Under the "Windows" subsection, click on the "Download" button for the version of InfluxDB that you want to install. Choose between 32-bit or 64-bit based on your system architecture. 3. Once the download completes, open the downloaded file (e.g., influxdb-1.8.0_windows_amd64.zip). Extract the contents of the zip file to a directory of your choice. 4. Open the extracted directory and locate the `influxd.exe` file. This is the main executable for running InfluxDB. 5. Open a command prompt with administrative privileges by right-clicking on the Windows Start button and selecting "Command Prompt (Admin)". 6. Change the current directory to the directory where you extracted InfluxDB. For example, if you extracted it to `C:\InfluxDB`, run the following command: ``` cd C:\InfluxDB ``` 7. Run the following command to initialize the InfluxDB configuration: ``` influxd.exe config > influxdb.conf ``` 8. Next, start the InfluxDB server by running the following command: ``` influxd.exe ``` 9. By default, InfluxDB will start on port `8086`. You can access the InfluxDB web interface by opening your web browser and navigating to `http://localhost:8086`. That's it! You have successfully installed InfluxDB on Windows. From here, you can create databases, write data, and perform various operations using InfluxDB's query language (InfluxQL) or its API. Note: Make sure to refer to the official InfluxDB documentation for more detailed information on configuring and using InfluxDB.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值