Skip to content

Instantly share code, notes, and snippets.

@dotmanila
dotmanila / python-check-binlogs.py
Created August 29, 2015 02:44
Check create timestamp of binary logs
#!/usr/bin/python
import os, time
from struct import unpack
from datetime import datetime
d = '/home/mysql/backup_data/backup_str/binlogs'
x = 180
oldest = int(time.time())-(90*24*60*60)
@dotmanila
dotmanila / pcs-data.sh
Created December 10, 2014 03:25
Data Collection Script
#!/bin/bash
dir=$1
duration=$2
outputdir="${dir}/second_samples_output_$(date +%Y-%m-%d_%H-%M-%S)"
min_free_bytes=1073741824 # 1GB
min_free_pct=10 # 10%
function usage {
@dotmanila
dotmanila / ddoss.out
Last active August 29, 2015 14:22
DDoS Script Found
[root@acme ~]# netstat -plant
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1270/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2043/master
tcp 0 0 192.254.64.50:50611 103.240.141.54:3505 ESTABLISHED 722/whoami
tcp 0 268 192.254.64.50:22 122.2.123.122:54675 ESTABLISHED 15580/sshd: revin [
tcp6 0 0 :::22 :::* LISTEN 1270/sshd
tcp6 0 0 ::1:25 :::* LISTEN 2043/master
[root@acme ~]# w
@dotmanila
dotmanila / pcs-collect-metrics.sh
Created July 8, 2015 03:18
Metrics Collection
#!/bin/bash
dir=$1
duration=$2
if [ "$3" == "" ]; then
savedir=$(hostname)
else
savedir="$3"
fi
@dotmanila
dotmanila / latency.stp
Created July 16, 2015 08:00
systemtap Measuring mysqld functions latency
#!/bin/env stap
#
global latency, latency_histogram
probe begin {
printf("Begin.\n")
}
probe process("/usr/sbin/mysqld").function("*") {
latency[probefunc()] = gettimeofday_s()
@dotmanila
dotmanila / php-mysqlnd-LONGBLOB-test.php
Last active August 29, 2015 14:27
LONGBLOB and mysqlnd seems to be slower.
<?php
//mysql> insert into t (t) values (repeat('a',1048576));
//Query OK, 1 row affected (0.14 sec)
//mysql> show create table t \G
//*************************** 1. row ***************************
// Table: t
//Create Table: CREATE TABLE `t` (
// `t` longtext
@dotmanila
dotmanila / mysqlnd-stats-to src-constant.txt
Created August 25, 2015 07:50
mysqlnd stats name to source code constant mapping
bytes_sent STAT_BYTES_SENT
bytes_received STAT_BYTES_RECEIVED
packets_sent STAT_PACKETS_SENT
packets_received STAT_PACKETS_RECEIVED
protocol_overhead_in STAT_PROTOCOL_OVERHEAD_IN
protocol_overhead_out STAT_PROTOCOL_OVERHEAD_OUT
bytes_received_ok_packet STAT_BYTES_RECEIVED_OK
bytes_received_eof_packet STAT_BYTES_RECEIVED_EOF
bytes_received_rset_header_packet STAT_BYTES_RECEIVED_RSET_HEADER
bytes_received_rset_field_meta_packet STAT_BYTES_RECEIVED_RSET_FIELD_META
@dotmanila
dotmanila / percona.live.notes.md
Created September 17, 2011 13:56 — forked from eklitzke/percona.live.notes.md
percona live notes

Percona Server with XtraDB

Introduction

  • 2010 InnoDB 5.1 announced, will first ship with MySQL 5.5.
  • Historically InnoDB development lags while MySQL is trying to GA
  • lots of things fixed in InnoDB since MySQL 5.0
  • important note -- plugin version of InnoDB is not the default in 5.1
@dotmanila
dotmanila / rtime.init
Created October 7, 2011 01:45
rtime init script
#!/bin/sh
# rtime daemon start/stop script.
# Comments to support chkconfig on RedHat Linux
# chkconfig: 2345 64 36
# description: Passive TCP response time analysis tool.
# Comments to support LSB init script conventions
### BEGIN INIT INFO
@dotmanila
dotmanila / sysbench-sas-raid1-60g-fileio.out
Created October 10, 2011 03:30
SAS RAID1 sysbench 60G fileio All Modes
# Percona Toolkit System Summary Report ######################
Date | 2011-09-07 22:26:20 UTC (local TZ: EDT -0400)
Hostname | zoooe.dotmanila.com
Uptime | 34 days, 18:27, 1 user, load average: 0.04, 0.06, 0.07
System | Dell Inc.; PowerEdge R210; vNot Specified (<OUT OF SPEC>)
Service Tag | 2K408P1
Platform | Linux
Release | CentOS release 5.6 (Final)
Kernel | 2.6.18-194.32.1.el5
Architecture | CPU = 64-bit, OS = 64-bit