influxdb + Grafana在centos7下的安装

InfluxDB的安装

cat <<EOF | sudo tee /etc/yum.repos.d/influxdb.repo

[influxdb]

name = InfluxDB Repository - RHEL \$releasever

baseurl = https://repos.influxdata.com/rhel/\$releasever/\$basearch/stable

enabled = 1

gpgcheck = 1

gpgkey = https://repos.influxdata.com/influxdb.key

EOF

sudo yum install influxdb

sudo systemctl start influxdb

测试一下

connect:

influx -database 'energy' -host 192.168.1.103 -port 8086

常用操作

#创建数据库

create database "db_name"

#显示所有的数据库

show databases

#删除数据库

drop database "db_name"

#使用数据库

use db_name

#显示该数据库中所有的表

show measurements

#创建表,直接在插入数据的时候指定表名

insert test,host=127.0.0.1,monitor_name=test count=1

#删除表

drop measurement "measurement_name"

///防火墙操作

sudo firewall-cmd --state

sudo firewall -cmd  --list-port

sudo firewall-cmd  --add-port=8086/tcp  --permanent (永久开放端口)
sudo firewall-cmd  --add-port=3000/tcp  --permanent (永久开放端口)
sudo firewall-cmd --reload (生效)

influx开启身份认证,参考 https://www.imzcy.cn/1352.html

Grafana安装

wget https://mirrors.huaweicloud.com/grafana/6.7.3/grafana-6.7.3-1.x86_64.rpm

sudo yum install grafana-6.7.3-1.x86_64.rpm

Start the server with systemd

To start the service and verify that the service has started:

sudo systemctl daemon-reload

sudo systemctl start grafana-server

sudo systemctl status grafana-server

Bash

Configure the Grafana server to start at boot:

sudo systemctl enable grafana-server.service

打开http://ip:3000就可以了

posted @ 2020-04-29 13:26  探索无止境  阅读(283)  评论(0编辑  收藏  举报