1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
|
cat > /etc/yum.repos.d/influxdb.repo << 'EOF' [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
yum install -y influxdb
sudo systemctl start influxdb sudo systemctl enable influxdb sudo systemctl status influxdb
influx Connected to http://localhost:8086 version 1.4.2 InfluxDB shell version: 1.4.2 >
SHOW USERS
CREATE USER influx WITH PASSWORD 'influx' WITH ALL PRIVILEGES
SHOW USERS
CREATE DATABASE test
SHOW DATABASES
USE test
INSERT cpu,host=192.168.1.1 load=0.1,usage=0.2
SELECT * FROM "cpu" SELECT "host","load","usage" FROM "cpu"
SELECT "host","load","usage" FROM "cpu" WHERE "host" = '192.168.1.1' SELECT "host","load","usage" FROM "cpu" WHERE "usage" > 0.1
CREATE DATABASE "db_name"
SHOW DATABASES
DROP DATABASE "db_name"
USE mydb
SHOW MEASUREMENTS
DROP MEASUREMENT "t_name"
SELECT * FROM codis_usage ORDER BY time DESC LIMIT 3
SELECT * FROM codis_usage WHERE time >= now() - 60m;
precision rfc3339 select * from codis_usage order by time desc limit 10;
show retention policies on codis name duration shardGroupDuration replicaN default ---- -------- ------------------ -------- ------- autogen 0s 168h0m0s 1 true
create retention policy "rp_14d" ON "codis" duration 14d replication 1 default
alter retention policy "autogen" on "codis" duration 0s replication 1 default
curl -i -XPOST http://localhost:8086/query --data-urlencode "q=CREATE DATABASE test"
curl -i -XPOST http://localhost:8086/write?db=test --data-binary "cpu,host=192.168.1.3 load=0.1,usage=0.33" curl -i -XPOST http://localhost:8086/write?db=test --data-binary "cpu,host=192.168.1.3 load=0.1,usage=0.33 6666666666666666666"
curl -i -XPOST http://localhost:8086/write?db=test --data-binary "cpu,host=192.168.1.2 load=0.1,usage=0.22 1666666666666666661 cpu,host=192.168.1.3 load=0.1,usage=0.33 1666666666666666661 cpu,host=192.168.1.2 load=0.2,usage=0.22 1666666666666666662 cpu,host=192.168.1.3 load=0.2,usage=0.33 1666666666666666662"
curl -G http://localhost:8086/query?db=test --data-urlencode "q=SELECT * FROM \"cpu\""
|