Big Data 219 - Grafana Installation & Startup
Basic Introduction
Grafana is a powerful open-source visualization and monitoring platform, created by Torkel Ödegaard in 2014. Written in Go, with frontend built on React framework, supports cross-platform deployment.
Main Application Scenarios
- IT Infrastructure Monitoring: Real-time display of server CPU, memory, disk and other resource usage
- Application Performance Monitoring (APM): Track application response times, error rates, and other key metrics
- Business Data Analysis: Visualize sales data, user behavior, and other business metrics
- IoT Monitoring: Display temperature, humidity, and other environmental data from sensors
Core Features
Data Source Support
Grafana supports multiple data sources including Prometheus, Graphite, Elasticsearch, MySQL, PostgreSQL, InfluxDB, and more. Users can combine data from different data sources in one dashboard.
Flexible Visualization
Grafana provides various visualization options: line charts, bar charts, scatter plots, pie charts, gauges, and more. It also supports setting data query time ranges, dynamic refresh, and multiple filters.
Custom Alerting
Grafana supports creating condition-based alerts (alert), which can automatically send notifications when metrics reach preset thresholds. Alert notifications support multiple channels including email, Slack, Microsoft Teams, and more.
Users and Access Control
Grafana supports user grouping and permission management, allowing different dashboards access permissions for different users or teams.
Installation Download
yum install -y https://dl.grafana.com/enterprise/release/grafana-enterprise-11.3.0-1.x86_64.rpm
Start Service
sudo systemctl start grafana-server
sudo systemctl status grafana-server
Access Service
http://h121.wzk.icu:3000/login
Requires username and password. After initialization, default username and password are both admin.
Project Advantages
Cross-Data-Source Unified Monitoring
Grafana provides powerful data integration capabilities, supporting seamless integration of 50+ data sources including Prometheus, InfluxDB, Elasticsearch, MySQL, PostgreSQL, and more.
Active Community, Rich Plugins
Grafana has a community ecosystem of over 1 million active users. Main advantages include:
- Official plugin marketplace offers 200+ officially certified plugins
- Thousands of dashboard templates contributed by the community
Real-time and High Performance
- Supports processing 100,000+ data points per second
- Query response time <100ms (with reasonable hardware configuration)
Deep Integration with Other Monitoring Tools
Prometheus Integration
Prometheus is a powerful time-series data monitoring system. Through deep integration with Prometheus:
- Real-time data fetching
- Flexible query language PromQL
- Alert integration
Loki Integration
Loki is a log aggregation system developed by Grafana Labs, seamlessly integrated with Grafana:
- Unified visualization interface
- Efficient log search
- Correlation analysis capabilities
Jaeger Integration
Jaeger is an open-source distributed tracing system from Uber, combined with Grafana provides:
- Complete request chain visualization
- Performance bottleneck analysis
- Correlation with metrics and logs
Common Configuration
Configure Data Source
- Click “Configuration” → “Data Sources”
- Click “Add data source”
- Select Prometheus
- Enter URL: http://prometheus:9090
- Click “Save & Test”
Create Dashboard
- Click ”+” → “Dashboard”
- Click “Add new panel”
- Enter PromQL query in metric browser
- Adjust visualization type
- Save dashboard
Error Quick Reference
| Symptom | Root Cause | Fix |
|---|---|---|
systemctl start grafana-server failed | Missing dependencies/config file syntax error/port conflict | systemctl status grafana-server -l |
Service shows running, but browser can’t open :3000 | Firewall/security group not opened | ss -lntp | grep 3000 |
| Localhost curl works, external domain doesn’t | Reverse proxy/domain resolution/port mapping issue | Check Nginx/SLB config and DNS resolution |
| Login page opens but always 302/redirect loop | root_url/serve_from_sub_path config doesn’t match reverse proxy path | Browser Network check 302 Location |
| Login admin shows failed | Initial password changed/local login disabled | Check Grafana logs |
| Slow/dashboard loading stuck | Data source query slow/high concurrency | Grafana Explore/Query Inspector |
| Plugin install fails/panel missing | Plugin signature/version mismatch | Grafana logs |