Skip to content

Instantly share code, notes, and snippets.

@jayjanssen
jayjanssen / gist:5805930
Last active July 12, 2016 15:51
Using pt-query-digest to analyze workloads for PXC
#!/bin/sh
PATH=$PATH:~
echo "Creating digests for $1"
@jayjanssen
jayjanssen / gist:5699348
Created June 3, 2013 16:25
PMP nagios with Galera (Credit to Roman Vynar)
# Note status (similar to what clustercheck does)
[root@civic ~]# /usr/lib64/nagios/plugins/pmp-check-mysql-status -x wsrep_local_state -C '!=' -w 4
OK wsrep_local_state = 4 | wsrep_local_state=4;4;;0;
# Cluster size (warn when it's lower than 3)
[root@civic ~]# /usr/lib64/nagios/plugins/pmp-check-mysql-status -x wsrep_cluster_size -C '<' -w 3
WARN wsrep_cluster_size = 1 | wsrep_cluster_size=1;3;;0;
# Checking replication health
[root@civic ~]# /usr/lib64/nagios/plugins/pmp-check-mysql-status -x wsrep_flow_control_paused -C '>=' -w 0.5 -c 1
@jayjanssen
jayjanssen / gist:5697813
Created June 3, 2013 12:33
Testing multicast with iperf
this is a sample of output:
root@percona-db-2:~# iperf -s -u -B 226.94.1.1 -i 1
------------------------------------------------------------
Server listening on UDP port 5001
Binding to local address 226.94.1.1
Joining multicast group 226.94.1.1
Receiving 1470 byte datagrams
UDP buffer size: 122 KByte (default)
------------------------------------------------------------
@jayjanssen
jayjanssen / gist:5294528
Created April 2, 2013 17:55
keepalived vip a reader and writer vip (no LB) and PXC cluster check
vrrp_script prefer_node1 {
script "test `hostname` == 'node1'"
interval 600
weight 5
}
vrrp_script prefer_node2 {
script "test `hostname` == 'node2'"
interval 600
weight 5
vrrp_script chk_node1 {
script "test `hostname` == 'node1'"
interval 2
weight 5
}
vrrp_script chk_node3 {
script "test `hostname` == 'node3'"
interval 2
weight 2
@jayjanssen
jayjanssen / gist:5014173
Created February 22, 2013 15:24
Non Innodb tables outside of system schemas
select table_schema, table_name, engine from information_schema.tables where engine != 'InnoDB' and table_schema not in ('information_schema', 'performance_schema', 'mysql');
@jayjanssen
jayjanssen / gist:4945584
Last active December 13, 2015 17:08
PXC locking on large transactions
# Prep:
[root@node1 ~]# date; sysbench --test=sysbench_tests/db/oltp.lua \
--mysql-host=node1 --mysql-user=test --mysql-db=test \
--oltp-table-size=250000 --report-interval=1 --max-requests=0 \
--tx-rate=10 prepare
node1> CREATE TABLE `other` (
`i` int(10) unsigned NOT NULL AUTO_INCREMENT,
`j` varchar(32) DEFAULT NULL,
PRIMARY KEY (`i`)
@jayjanssen
jayjanssen / gist:4944530
Last active December 13, 2015 16:58
PXC haproxy config example
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
maxconn 4096
uid 99
gid 99
daemon
defaults
log global
@jayjanssen
jayjanssen / gist:4674892
Created January 30, 2013 17:27
Running perf
install perf
install galera-debuginfo (if PXC)
install PS/PXC debuginfo
# collect 1 pid
perf record -g -p 16004
# collect all procs
perf record -a -g
@jayjanssen
jayjanssen / gist:4613620
Created January 23, 2013 21:24
modify limits on a running process
echo -n "Max processes=X:Y" > /proc/`pidof mysqld`/limits
X = soft limit
Y = hard limit