InfluxDB入門第一篇:安裝

1. InfluxDB入門第一篇:安裝

1.1. 環境準備

Centos 7 + Telegraf 1.10.3 + InfluxDB 1.7.6 + InfluxDb Studiogit

1.2. InfluxDB

1.2.1. 安裝influxDB

wget https://dl.influxdata.com/influxdb/releases/influxdb-1.7.6.x86_64.rpm
sudo yum localinstall influxdb-1.7.6.x86_64.rpm複製代碼

1.2.2. 啓動InfluxDB

systemctl start influxd複製代碼

1.2.3. 配置influxDB

# 建立數據庫,使用influx 命令進入到influxdb命令行
influx
create database telegraf;
use telegraf;

# 下面建立用戶名telegraf 密碼爲telegraf的用戶,注意用戶名用雙引號,密碼用單引號
create user "telegraf" with password 'telegraf';

# 輸入exit 退出influx命令行
exit複製代碼

1.3. telegraf

1.3.1. 安裝telegraf

wget https://dl.influxdata.com/telegraf/releases/telegraf-1.10.3-1.x86_64.rpm
sudo yum localinstall telegraf-1.10.3-1.x86_64.rpm複製代碼

1.3.2. 配置telegraf

一、配置鏈接Influxdb信息(outputs.influxdb)github

sudo vi /etc/telegraf/telegraf.conf

# Configuration for influxdb server to send metrics to
[[outputs.influxdb]]
  ## The full HTTP or UDP URL for your InfluxDB instance.
  ##
  ## Multiple urls can be specified as part of the same cluster,
  ## this means that only ONE of the urls will be written to each interval.
  # urls = ["udp://localhost:8089"] # UDP endpoint example
  urls = ["http://localhost:8086"] # required
  ## The target database for metrics (telegraf will create it if not exists).
  database = "telegraf" # required

  ## Name of existing retention policy to write to.  Empty string writes to
  ## the default retention policy.
  retention_policy = ""
  ## Write consistency (clusters only), can be: "any", "one", "quorum", "all"
  write_consistency = "any"

  ## Write timeout (for the InfluxDB client), formatted as a string.
  ## If not provided, will default to 5s. 0s means no timeout (not recommended).
  timeout = "5s"
  username = "telegraf"
  password = "telegraf"
  ## Set the user agent for HTTP POSTs (can be useful for log differentiation)
  # user_agent = "telegraf"
  ## Set UDP payload size, defaults to InfluxDB UDP Client default (512 bytes)
  # udp_payload = 512複製代碼

urls:表示influxdb的地址及端口號
database:influxdb數據庫名
username:數據庫用戶名
password:數據庫密碼複製代碼

1.3.3. 啓動telegraf

systemctl start telegraf複製代碼

1.4. 使用 InfluxDb Studio查看Influx數據

1.4.1. 下載 InfluxDb Studio

https://github.com/CymaticLabs/InfluxDBStudio/releases/download/v0.2.0-beta.1/InfluxDBStudio-0.2.0.zip複製代碼

1.4.2. 鏈接至Influxdb

解壓後,打開InfluxDBStudio.exe複製代碼

點擊【Create】,建立InfluxDB鏈接。file數據庫

Name: 給鏈接起個名字
Address:InfluxDB IP地址及端口號,端口默認爲8086
Database: 建立的數據庫,剛建立的爲:telegraf
UserName: 數據庫用戶名
Password:數據庫密碼複製代碼

點擊【Save】,保存鏈接,而後點擊【Connect】,進入到數據庫詳情。file服務器

展現的爲telegraf默認監控服務器數據。ide

雙擊某個表名稱,便可建立一條查詢語句。點擊工具欄中的【Run Query】便可查看數據信息。filefilefile工具

至此,基礎環境搭建完成。ui

相關文章
相關標籤/搜索