官网:
https://www.influxdata.com/
centos7安装
wget https://dl.influxdata.com/influxdb/releases/influxdb2-2.0.4.x86_64.rpmyum localinstall influxdb2-2.0.4.x86_64.rpm
启动
systemctl start influxdb
systemctl enable influxdb
# netstat -npult |grep influx
tcp 0 0 127.0.0.1:40938 0.0.0.0:* LISTEN 16456/influxd
tcp6 0 0 :::8086 :::* LISTEN 16456/influxd
# influx version
Influx CLI 2.0.7 (git: 2a45f0c037) build_date: 2021-06-04T19:17:40Z
初始化并创建数据库和token账户
# influx setup
Welcome to InfluxDB 2.0!
Please type your primary username: admin # 用户名Please type your password: Please type your password again: Please type your primary organization name: clouddeep # 组织名称Please type your primary bucket name: deeptun # 数据库名称Please type your retention period in hours.
Or press ENTER for infinite: # 有效期无限制You have entered:Username: adminOrganization: clouddeepBucket: deeptunRetention Period: infinite
Confirm? (y/n): yConfig default has been stored in /root/.influxdbv2/configs.
User Organization Bucket
admin clouddeep deeptun# cat /root/.influxdbv2/configs
[default]url = "http://localhost:8086"token = "1-8e0zXxXGmD7j8GNkJLN-fq-C3MDqDd_gO6CCt6tMIS5bmOkHT2lqdZ_dihAMrLG-2kwpJY3R0U_lLA--KNpg=="org = "clouddeep"active = true
访问:
通过http://192.168.1.23:8086访问:
安装后配置文件
/root/.influxdbv2
图形界面创建数据库(上面初始化的时候已经创建好数据库了,如下想再创建数据库就通过这里创建)
1、创建数据库
2、创建用户并把数据库授权给用户
在程序中调用influxdb
[root@k8s-gateway-dev influxdb]# cat /project/deepctl-statistic/etc/config.toml
[Basic]Name = "deepctl_statistic"Port = 62213[Mysql] MysqlHost = "39.97.184.6:3306"MysqlUser = "root"MysqlPass = "Clouddeep@8890"MysqlDb = "deepctl_manager"MysqlEncrypt = 0[Redis]RedisHost = "39.97.184.6:6379"RedisPass = "Clouddeep&&Redis9910"RedisDb = 0RedisEncrypt = 0[InfluxDB]# 连接的influxdb地址InfluxDBHost = "http://127.0.0.1:8086" # 用户TonkenInfluxDBToken = "TYP1RgqjU_8w9SMM2t9u0CX446BesTC0PPr6ELKvxMk3DQFUR_Q8HmtzDb943l1gRmBhmbqDFvv24G1kzVEFxQ==" # 初始化时指定的组织名称InfluxDBOrg = "clouddeep"# 数据库名称InfluxDBBucket = "deeptun"InfluxDBEncrypt = 0