Skip to content

Instantly share code, notes, and snippets.

@dotmanila
dotmanila / clickhouse-incr-refresh.sh
Created December 24, 2017 00:14
Clickhouse incremental refresh script using changelog data from https://gist.github.com/dotmanila/53a2c0b9b7a3be4f9e99b94aa203c66d
#!/bin/bash
_echo() {
echo "$(date +%Y-%m-%d_%H_%M_%S) incr-refresh $1"
}
TBL='hits'
# MySQL clickhouse_changelog command
MYCL="mysql -h source_db_host mydb -BNe"
# MySQL source table command
@dotmanila
dotmanila / clickhouse-changelog.py
Last active February 12, 2022 18:35
Python MySQL Binlog Change Data Capture for Clickhouse Example
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import sys
import pymysql.cursors
from pymysqlreplication import BinLogStreamReader
from pymysqlreplication.row_event import (
DeleteRowsEvent,
@dotmanila
dotmanila / zfs-git-master-module-parameters.txt
Last active November 25, 2017 15:50
ZFS Module Parameters as of git-0.7-master
dbuf_cache_hiwater_pct 10
dbuf_cache_lowater_pct 10
dbuf_cache_max_bytes 104857600
dbuf_cache_max_shift 5
dmu_object_alloc_chunk_shift 7
ignore_hole_birth 1
l2arc_feed_again 1 1
l2arc_feed_min_ms 200 200
l2arc_feed_secs 1 1
l2arc_headroom 2 2
@dotmanila
dotmanila / run-sysbench-ps5719.sh
Created November 10, 2017 21:14
Run 3 basic sysbench tests on Percona Server sandbox
#!/bin/bash
PREFIX=$1
time sysbench --db-driver=mysql --mysql-user=msandbox --mysql-password=msandbox \
--mysql-db=test --mysql-host=127.0.0.1 --mysql-port=57190 --tables=8 \
--table-size=20000000 --auto-inc=off --threads=8 --time=0 \
--rand-type=pareto oltp_read_only cleanup
time sysbench --db-driver=mysql --mysql-user=msandbox --mysql-password=msandbox \
@dotmanila
dotmanila / hp-dl380-g7-test-server.txt
Last active November 10, 2017 21:08
HP DL380 G7 Test Server
# Percona Toolkit System Summary Report ######################
Platform | Linux
Release | Ubuntu 16.04.3 LTS (xenial)
Kernel | 4.4.0-98-generic
Architecture | CPU = 64-bit, OS = 64-bit
Threading | NPTL 2.23
SELinux | No SELinux detected
Virtualized | No virtualization detected
# Processor ##################################################
Processors | physical = 2, cores = 12, virtual = 24, hyperthreading = yes
@dotmanila
dotmanila / zfs-bootstrap-bm-ubuntu-16.04-git.sh
Last active November 16, 2017 03:25
ZFS bootstrap Ubuntu 16.04 with git-master version, uses 6xSAS drives pool and PS 5.7.19 using MySQL sandbox.
#!/bin/bash
DISK=xvdb
USER=ubuntu
IP=$(ip -4 ad sh scope global | grep 'scope global' | awk '{print $2}' | cut -d'/' -f1 | head -n1)
KERNEL=$(uname -r)
wget https://repo.percona.com/apt/percona-release_0.1-4.$(lsb_release -sc)_all.deb
sudo dpkg -i percona-release_0.1-4.xenial_all.deb
sudo apt -y update
@dotmanila
dotmanila / zfs-bootstrap-ubuntu-16.04-git.sh
Last active November 18, 2017 05:01
ZFS bootstrap Ubuntu 16.04 with github master ZFS, uses xvdb for single vdev and PXC 5.7.19 using MySQL sandbox.
#!/bin/bash
USER=ubuntu
IP=$(ip -4 ad sh scope global | grep 'scope global' | awk '{print $2}' | cut -d'/' -f1 | head -n1)
KERNEL=$(uname -r)
wget https://repo.percona.com/apt/percona-release_0.1-4.$(lsb_release -sc)_all.deb
sudo dpkg -i percona-release_0.1-4.xenial_all.deb
sudo apt -y update
sudo apt -y upgrade
@dotmanila
dotmanila / zfs-bootstrap-ubuntu-16.04.sh
Last active November 8, 2017 22:08
ZFS bootstrap Ubuntu 16.04 with default ZFS version, uses xvdb for single vdev and PXC 5.7.19 using MySQL sandbox.
#!/bin/bash
DISK=xvdb
USER=ubuntu
IP=$(ip -4 ad sh scope global | grep 'scope global' | awk '{print $2}' | cut -d'/' -f1 | head -n1)
KERNEL=$(uname -r)
wget https://repo.percona.com/apt/percona-release_0.1-4.$(lsb_release -sc)_all.deb
sudo dpkg -i percona-release_0.1-4.xenial_all.deb
sudo apt -y update
@dotmanila
dotmanila / zfs-encryption.sh
Created November 1, 2017 16:35
ZFS on Linux Encrypted Crash/Exchange Error
#!/bin/bash
DISK=xvdb
BACKUPVOL=xvdc
USER=ubuntu
KERNEL=$(uname -r)
wget https://repo.percona.com/apt/percona-release_0.1-4.$(lsb_release -sc)_all.deb
sudo dpkg -i percona-release_0.1-4.xenial_all.deb
sudo apt -y update
@dotmanila
dotmanila / dsync-benchmark.txt
Created September 28, 2017 14:32
O_DSYNC Benchmark on GCE with Percona Server
env SANDBOX_BINARY=/home/jervin/mysql make_sandbox 5.7.190 -- \
--upper_directory=/mysql-ext4/msb --my_clause=innodb_buffer_pool_size=38G \
--my_clause=innodb_log_file_size=536870912 --my_clause=innodb_flush_method=O_DIRECT \
--my_clause=bind-address=0.0.0.0 --my_clause=skip_name_resolve=1 \
--my_clause=thread_cache_size=48 --my_clause=performance_schema=off \
--my_clause=max_allowed_packet=33554432 --my_clause=innodb_page_cleaners=8 \
--my_clause=innodb_lru_scan_depth=2048 --my_clause=innodb_io_capacity=5000 \
--my_clause=innodb_io_capacity_max=10000 --my_clause=innodb_flushing_avg_loops=5 \
--my_clause=innodb_flush_neighbors=2 --my_clause=innodb_buffer_pool_instances=8