Skip to content

Instantly share code, notes, and snippets.

View fipar's full-sized avatar

Fernando Ipar fipar

View GitHub Profile
@fipar
fipar / gist:570d4dbad37c51ad523c
Created June 27, 2015 21:54
simple-todo meteor app using tokumx, on mac.

These are instructions on getting the simple-todo test app from the meteor tutorial (link below) running on a Mac and using TokuMX instead of MongoDB. It was written in response to this request: https://www.percona.com/blog/2015/05/08/mongodb-percona-tokumxse-experimental-build-rc5-available/#comment-10864682

Prerequsites:

@fipar
fipar / general_log.sql
Created July 15, 2015 17:07
export mysql.general_log into a text file with general log format
select 'Tcp port: 3306 Unix socket: /tmp/mysql.sock\nTime Id Command Argument'
union
select concat(date_format(event_time, '%y%m%d %H:%i:%S'), ' ', thread_id, ' ', command_type, '\t', argument)
from general_log
into outfile '/tmp/test'
fields terminated by ''
#!/bin/bash
sysbench \
--test=/usr/share/doc/sysbench/tests/db/insert.lua \
--mysql-host=127.0.0.1 \
--mysql-port=3306 \
--mysql-user=sysbench \
--mysql-password=sysbench \
--mysql-db=sysbench \
--mysql-table-engine=innodb \
--oltp-test-mode=complex \
@fipar
fipar / fac.sh
Last active November 25, 2015 13:08
fac()
{
[ $1 -eq 0 ] && echo 1 && return
seq $1 |tr '\n' '*'|sed 's/*$//g' | bc
}
@fipar
fipar / math_csv_import.R
Last active January 21, 2016 20:47
Importing a csv file with math expressions into R, evaluating them into the results
# To get from:
# telecaster:data_collection_scripts fernandoipar$ cat /tmp/test.csv
# 1*1,0,1
# 1*2,0,2
# 2+4,1*1024*1024,2*1024*1024*1024
# to:
# > t
# V1 V2 V3
# 1 1 0 1
# 2 2 0 2
for test in oltp update_index update_non_index; do
mkdir $test; pushd $test
for i in 50000 25000 10000 5000 2500 1000
#for i in 10
do
sysbench --mysql-engine-trx=yes --test=/usr/share/doc/sysbench/tests/db/oltp.lua --oltp_tables_count=32 --mysql-user=sb --mysql-password=sbs3cret --mysql_table_engine=tokudb --num-threads=16 --oltp-table-size=${i}000 --rand-type=pareto --rand-init=on --report-interval=10 --mysql-host=sbhost --mysql-db=sbtest --max-time=7200 --max-requests=0 prepare
sysbench --mysql-engine-trx=yes --test=/usr/share/doc/sysbench/tests/db/oltp.lua --oltp_tables_count=32 --mysql-user=sb --mysql-password=sbs3cret --mysql_table_engine=tokudb --num-threads=16 --oltp-table-size=${i}000 --rand-type=pareto --rand-init=on --report-interval=10 --mysql-host=sbhost --mysql-db=sbtest --max-time=7200 --max-requests=0 run | tee -a toku.${i}.${test}.ssd.txt
sysbench --mysql-engine-trx=yes --test=/usr/share/doc/sysbench/tests/db/oltp.lua --oltp_tables_count=32 --mysql-user=sb --mysql-password=sbs3cret --mysql_ta
@fipar
fipar / mongodb.json
Last active November 10, 2020 05:44
Basic Grafana dashboard for MongoDB metrics (data source: https://github.com/dcu/mongodb_exporter)
{
"id": 1,
"title": "MongoDB",
"originalTitle": "MongoDB",
"tags": [],
"style": "dark",
"timezone": "browser",
"editable": true,
"hideControls": false,
"sharedCrosshair": false,
@fipar
fipar / knit.sh
Created April 11, 2016 22:08
knit Rmd into md and html
#!/bin/bash
usage()
{
cat <<EOF>&2
usage: $0 <name>
knits ${name}.Rmd into ${name}.md and ${name}.html
EOF
exit
}
@fipar
fipar / collect.sh
Created September 26, 2016 21:01
Collect basic cpu/mem/network/io info from host for 30 secs
test -x pt-diskstats || {
wget http://www.percona.com/get/pt-diskstats
chmod +x pt-diskstats
}
reqs=""
which netstat || reqs="netstat $reqs"
which vmstat || reqs="vmstat $reqs"
which top || reqs="top $reqs"
rpm -qa > /tmp/rpms.$$
grep perl-Time-HiRes /tmp/rpms.$$ || reqs="perl-Time-HiRes $reqs"