Skip to content

Instantly share code, notes, and snippets.

@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: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');
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: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
@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: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: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 / parse_bamboo_contacts.pl
Created September 18, 2013 13:41
Parse CSV download from BambooHR to make it useful to import into OSX Contacts
#!/usr/bin/perl
use Text::CSV;
use Data::Dumper;
my $headers = <STDIN>;
my $csv = new Text::CSV;
print "Last, First, Mobile, \"Phone (work)\", \"Email (work)\", \"Skype (work)\"\n";
@jayjanssen
jayjanssen / gist:7945311
Last active December 31, 2015 06:09
Munin plugin for Bitcasa Linux client
#!/usr/bin/perl
my $stats = "/var/lib/bitcasa/stats";
my %patterns = (
'max_cache' => qr/Maximum Cache Size Setting: (.*)$/,
'current_cache' => qr/Current Cache Size: (.*)$/,
'available_cache' => qr/Available Cache Space: (.*)$/,
'used_cache' => qr/Used Cache Space: (.*)$/,
tell application "System Events"
tell current location of network preferences
set VPNservice to service "My VPN" -- name of the VPN service
if exists VPNservice then connect VPNservice
repeat until (connected of current configuration of VPNservice)
delay 1
end repeat
end tell