Archive for the ‘DBA’ Category

InfluxDB: Bash script to launch and configure two nodes

I’ve just created a quick bash script because I”m working a little with InfluxDB at the moment. InfluxDB is a time series database written in GO. The script will setup two influxdb nodes, setup some users and download and load some sample data. It’s developed on a Mac but should work in Linux (not tested […]

Bash: Count the number of databases in a gzip compressed mysqldump

A simple bash one-liner! ?View Code BASHgunzip -c /path/to/backup/mysqldump.sql.gz | grep -E "^CREATE DATABASE" | wc -l Breaking this down.. This prints the contents of a gzip compressed mysqldump to the terminal ?View Code BASHgunzip -c /path/to/backup/mysqldump.sql.gz Grep for lines that start with CREATE DATABASES… ?View Code BASHgrep -E "^CREATE DATABASE" Count the number of […]

MariaDB: subquery causes table scan

I got asked today to look at some slow queries on a MariaDB 10 instance. Here are the anonymized results of the investigation I did into this and how I solved the issue… There were a bunch of queries, expected to run very fast, that were taking 10-15 seconds to execute. The queries were all […]

emo: Launch an elasticsearch cluster

I’m getting a bit more into elasticsearch and I’ve started up a github project to contain some of work. This project will be similar to mmo: Python library for MongoDB and can be found at emo. The project will again be in python and will basically be a bunch of methods for exploring and managing […]

Delete all but the most recent files in Bash

I’ve been reviewing a few things I do and decided I need to be a bit smarter about managing backups. I currently purge by date only. Which is fine if everything is working and checked regularly. I wouldn’t want to return from a two week holiday to find my backups had been failing, nobody checked […]