Skip to content

Instantly share code, notes, and snippets.

@kevinbin
kevinbin / ibd2sql.py
Last active September 4, 2022 05:11
Parsing MySQL 8.0 ibd2sdi json output
#!/usr/bin/env python3
import json
import sys
# not support list partition type
# only support default Btree index, no other index types tested
# only gb* latin1 utf8mb3 utf8mb4
char_collate = {
248:["gb18030","gb18030_chinese_ci"],249:["gb18030","gb18030_bin"],250:["gb18030","gb18030_unicode_520_ci"],24:["gb2312","gb2312_chinese_ci"],86:["gb2312","gb2312_bin"],28:["gbk","gbk_chinese_ci"],87:["gbk","gbk_bin"],
@kevinbin
kevinbin / PostgreSQL Dashboard.json
Last active November 9, 2021 06:22
PostgreSQL Dashboard View
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@kevinbin
kevinbin / gist:e6ff4cb43024be43b2326cfd784202d8
Created June 20, 2020 03:09
centos 7 gcc4.8 upgrade 5.0
cat <<EOF > /etc/yum.repos.d/fedora.repo
[warning:fedora]
name=fedora
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-23&arch=$basearch
enabled=1
EOF
yum -y update gcc gcc-c++
{
"Name":"tpcc1-ali-jd",
"Failover":false,
"Orders":[],
"Type":"synchronous",
"Tasks":[
{
"Type":"Src",
"NodeId":"90f3cd4d-7997-7b1b-cd99-e2c4d05c69e1",
"Config":{
@kevinbin
kevinbin / ndb_mgmd.sh
Created January 20, 2014 03:25
MySQL Cluster ndb_mgmd process init start script
#!/bin/bash
# chkconfig: 345 99 30
# description: ndb_mgmd start/stop script
### BEGIN INIT INFO
# Provides: ndb_mgmd start/stop
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Default-Start: 3 4 5
@kevinbin
kevinbin / ndbmtd.sh
Created January 20, 2014 03:25
MySQL Cluster ndbmtd process init start script
#!/bin/bash
# chkconfig: 345 60 40
# description: datanode start/stop script
### BEGIN INIT INFO
# Provides: datanode
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 3 4 5
@kevinbin
kevinbin / mysql_db_rename.sh
Created January 20, 2014 03:04
mysql database rename script
#!/bin/bash
MYSQLCONN="mysql -uroot -pxxxx"
old_db_name="fff"
new_db_name="sj"
$MYSQLCONN -e "CREATE DATABASE $new_db_name"
params=$($MYSQLCONN -N -e "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='$old_db_name'")
for name in $params; do
$MYSQLCONN -e "RENAME TABLE $old_db_name.$name to $new_db_name.$name";
done;
@kevinbin
kevinbin / monitor.sh
Created January 20, 2014 03:02
some os resource monitor function
#!/usr/bin/env bash
function GetPID #User #Name
{
PsUser=$1
PsName=$2
pid=`ps -u $PsUser|grep $PsName|grep -v grep|grep -v vi|grep -v dbx \
|grep -v tail|grep -v start|grep -v stop |sed -n 1p |awk '{print $1}'`
echo $pid
}
@kevinbin
kevinbin / lvs_real.sh
Created January 20, 2014 02:54
LVS real server start/stop script
#!/bin/bash
#description : start realserver
VIP=172.16.6.8
/etc/init.d/functions
case "$1" in
start)
/sbin/ifconfig lo:0 $VIP broadcast $VIP netmask 255.255.255.255 up
/sbin/route add -host $SNS_VIP dev lo:0
echo "1" >/proc/sys/net/ipv4/conf/lo/arp_ignore
echo "2" >/proc/sys/net/ipv4/conf/lo/arp_announce
@kevinbin
kevinbin / nagios_install.sh
Created January 20, 2014 02:52
nagios install script
#!/bin/sh
# Any Failing Command Will Cause The Script To Stop
set -e
# Treat Unset Variables As Errors
set -u
NAGIOS_VERSION=3.5.0
PLUGIN_VERSION=1.4.16