This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin | |
export ORCHESTRATOR_API="$1" | |
OC=orchestrator-client | |
PSQL='mysql --defaults-file=/etc/proxysql/user.cnf -P6032 -h127.1' | |
VER=$(date +%s) | |
$OC -c raft-leader > /dev/null 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create ext4 RAID | |
sudo mdadm --create --verbose /dev/md0 --level=10 --raid-devices=4 \ | |
--name=mysql /dev/sdb /dev/sdc /dev/sdd /dev/sde | |
sudo mkdir /mysql-ext4 | |
sudo mkfs.ext4 /dev/md0 | |
sudo mount -o rw,relatime /dev/md0 /mysql-ext4 | |
sudo mkdir /mysql-ext4/msb | |
sudo chown revin.revin /mysql-ext4/msb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import json | |
import sys | |
import pymysql.cursors | |
from pymysqlreplication import BinLogStreamReader | |
from pymysqlreplication.row_event import ( | |
DeleteRowsEvent, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from datetime import datetime | |
from optparse import OptionParser | |
import json | |
import namedtupled | |
import operator | |
import os | |
import pymysql.cursors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
OC=/usr/bin/orchestrator-client | |
IPADDR=$(/sbin/ip ad sh dev eth0 scope global | grep -oE "inet\s(.*)\/" | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}") | |
RAFTLEADER=$($OC -c raft-leader | cut -d: -f1) | |
if [ "x${IPADDR}" != "x${RAFTLEADER}" ]; then | |
exit 0 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from SimpleHTTPServer import SimpleHTTPRequestHandler | |
import BaseHTTPServer | |
import optparse | |
import time | |
import socket | |
import simplejson | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
multi_source_repl: | |
query: "SELECT service_state, COUNT(service_state) AS service_state_count FROM performance_schema.replication_connection_status GROUP BY service_state;" | |
metrics: | |
- service_state: | |
usage: "LABEL" | |
description: "Replication thread state name" | |
- service_state_count: | |
usage: "COUNTER" | |
description: "Count by service state name" | |
multi_source_repl_delay: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"annotations": { | |
"list": [ | |
{ | |
"builtIn": 1, | |
"datasource": "-- Grafana --", | |
"enable": true, | |
"hide": true, | |
"iconColor": "rgba(0, 211, 255, 1)", | |
"name": "Annotations & Alerts", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# LightDM greeter uses display :2 so we have ti login first | |
sudo x11vnc -auth /var/run/lightdm/root/:2 -forever -shared -rfbauth /home/revin/.vnc/passwd \ | |
-rfbport 5900 -xkb -norc -noxrecord -noxdamage -nomodtweak -desktop :2 -display :2 | |
# Once logged in, we can connect to the desktop | |
sudo x11vnc -auth /var/run/lightdm/root/:0 -forever -shared -rfbauth /home/revin/.vnc/passwd \ | |
-rfbport 5900 -xkb -norc -noxrecord -noxdamage -nomodtweak -desktop :0 -display :0 |
NewerOlder