Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Kenny Gryp
kenny.gryp@percona.com Principal Consultant @ Percona
Collaborate 2011
Percona
MySQL/LAMP Consulting MySQL Support Percona Server (XtraDB) Percona XtraBackup InnoDB Recovery Toolkit, tcprstat (maatkit, innotop, aspersa, mysql-mmm, mysql-cactitemplates)
Topics
Why Graph? What is Cacti and mysql-cacti-templates? How Cacti works Installation Add Graphs Demo Graphs! Extras
3
Topics
Why Graph? What is Cacti and mysql-cacti-templates? How Cacti works Installation Add Graphs Demo Graphs! Extras
4
Why Graph?
Troubleshooting
-behavior over time -sudden spikes in graphs after application updates -traffic patterns -predictions
Capacity Planning
Topics
Why Graph? What is Cacti and mysql-cacti-templates? How Cacti works Installation Add Graphs Demo Graphs! Extras
6
Cacti?
open source graphing solution uses RRDTool advanced graphs, scriptable web interface quite complex to add graphs adding servers is a manual process
mysql-cacti-templates?
collection of templates for cacti graph MySQL metrics Has a lot of non-MySQL Metrics too: IO stats,
apache, memcache, mongodb, java...
Topics
Why Graph? What is Cacti and mysql-cacti-templates? How Cacti works Installation Add Graphs Demo Graphs! Extras
9
Cacti
Poller
fetch
(cronjob which fetches data from servers)
what
MySQL
(contains cacti conguration)
Web Server
httpd sshd snmpd
stores
Apache
(serves web interface)
.rrd Files
(contains rrd data)
Web Browser
10
Topics
Why Graph? What is Cacti and mysql-cacti-templates? How Cacti works Installation Add Graphs Demo Graphs! Extras
11
Installation
Cacti Mysql-cacti-templates Configuring Servers
12
Installation
Cacti Mysql-cacti-templates Configuring Servers
13
14
15
Setup: Extract
Recommended is using apt/yum/... to install cacti if not:
cacti# cacti# cacti# cacti# cd /var/www/html/ # may vary tar xzvf cacti-0.8.7g.tar.gz ln -s cacti-0.8.7g cacti chown -R cactiuser rra/ log/
16
Setup: Webserver
Apache (may be something else) Enable php Set DirectoryIndex index.php
LoadModule php5_module modules/libphp5.so AddHandler php5-script .php AddType text/html .php DirectoryIndex index.php
17
Setup: MySQL
Create Cacti MySQL user:
cactimysql> GRANT ALL PRIVILEGES ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'password';
Edit include/config.php
$database_type = "mysql"; $database_default = "cacti"; $database_hostname = "localhost"; $database_username = "cactiuser"; $database_password = "password"; 18
Setup: Poller
Add cronjob (/etc/cron.d/cacti)
*/5 * * * * cactiuser php /var/www/html/cacti/ poller.php > /dev/null 2>&1
19
Setup: UI
20
Setup: UI
21
Setup: UI
22
Setup: UI
23
Setup: UI
24
Setup: UI
25
Setup: UI
26
Installation
Cacti Mysql-cacti-templates Configuring Servers
27
28
29
31
install: templates
32
install: templates
33
install: templates
34
Installation
Cacti Mysql-cacti-templates Configuring Servers
35
Configure Servers
configure net-snmpd add a cacti user in MySQL configure ssh access
36
Verify
Topics
Why Graph? What is Cacti and mysql-cacti-templates? How Cacti works Installation Add Graphs Demo Graphs! Extras
40
Adding Graphs
41
Adding Graphs
42
Adding Graphs
43
Adding Graphs
Apply wanted templates on the device Click on Create Graphs:
- MySQL & GNU/Linux templates
Select graphs to create and Add! Might ask some more questions
44
Adding Graphs
45
Adding Graphs
Assign ucd/net SNMP template to have:
-cpu usage/load -memory used/available -network statistics -free disk space
46
Adding Graphs
47
Adding Graphs
What if I have multiple disk devices to monitor?
-Go to Create graphs for this host -Select graph to add in select menu -Create and fill in other device when asked
48
49
Topics
Why Graph? What is Cacti and mysql-cacti-templates? How Cacti works Installation Add Graphs Demo Graphs! Extras
50
Topics
Why Graph? What is Cacti and mysql-cacti-templates? How Cacti works Installation Add Graphs Demo Graphs! Extras
51
MySQL Handlers
52
MySQL Handlers
Table scans, backup?
53
MySQL Handlers
54
MySQL Handlers
MySQL Connections
56
MySQL Connections
max_connections not reached yet
MySQL Replication
58
MySQL Replication
Replication never caught up
MySQL Replication
60
MySQL Replication
In 2 hours, almost 6900 seconds replication lag
61
62
63
keep an eye on: * temp tables * temp disk tables if it grows > query optimization
64
65
66
67
MySQL Sorts
68
MySQL Sorts
69
The peaks should be understood, not necessarily be removed as they might be really fast in terms of rows
70
71
72
74
75
76
78
79
80
InnoDB I/O
81
InnoDB I/O
Increase in load
82
83
85
86
87
88
CPU Usage
90
Memory
91
Disk Operations
92
Topics
Why Graph? What is Cacti and mysql-cacti-templates? How Cacti works Installation Add Graphs Demo Graphs! Extras
93
non-MySQL mysql-cacti-templates
Apache JMX Memcached Mongodb Nginx OpenVZ Redis Unix
94
non-MySQL mysql-cacti-templates
95
non-MySQL mysql-cacti-templates
96
non-MySQL mysql-cacti-templates
97
non-MySQL mysql-cacti-templates
98
99
100
101
103