Articles
Technical writing and lab investigations
An archive of articles and hands-on labs by Krzysztof Książek: backups and recovery, replication and high availability, and sharding. Lab write-ups describe environments built and run by the author; they are not customer engagements.
- MySQL Lab
MySQL backup lab, part 9 – the harness that records evidence
Twelve scenarios that record their own evidence to JSONL, a failure policy that stops rather than continues, a generated run report, and offline tests that check the lab's own documentation against its roles.
- MySQL Lab
MySQL backup lab, part 8 – restore into a new cluster and attach it as a replica
Restore the backup into a separate cluster, attach it as a replica of the live source, let it catch up, and compare every row. The scenario that settles recoverability — walked through as code.
- MySQL Lab
MySQL backup lab, part 7 – point-in-time recovery to a timestamp and a GTID
The binlog server that streams to object storage, recovery aimed at a clock reading and at an exact transaction, a date format that cost an afternoon, and the trap of replaying a history your database already abandoned.
- MySQL Lab
MySQL backup lab, part 6 – restoring in place, and what it costs
An in-place restore stops the cluster, replaces the data directory and rebuilds the replica. A canary proves it replaced state rather than merging into it — and shows what that trade throws away.
- MySQL Lab
MySQL backup lab, part 5 – scheduled backups and retention
Backups that run with nobody watching, and the half nobody tests: that keep: N deletes the oldest backups and their data, measured against the objects left in the bucket.
- MySQL Lab
MySQL backup lab, part 4 – running backups: full, from the replica, incremental
What the operator does when a backup becomes a Kubernetes object, how sourcePod moves the work off the primary, what an incremental actually contains, and how to confirm the bytes reached object storage.
- MySQL Lab
MySQL backup lab, part 3 – data, and proof the lab is worth testing
Half a gigabyte of sysbench with exact known dimensions, an ANALYZE TABLE nobody expects, and a verify playbook that asserts the cluster state instead of printing numbers for a human to glance at.
- MySQL Lab
MySQL backup lab, part 2 – deploying MySQL by hand
The Percona operator, in-cluster MinIO, and a PerconaServerMySQL custom resource read field by field — including the flags that say out loud this topology is unsafe, and the backup block everything later depends on.
- MySQL Lab
MySQL backup lab, part 1 – the kind cluster underneath it
Three Kubernetes nodes as Docker containers, Ansible used as a task runner against localhost, and a kubeconfig that cannot reach anything but the lab. Part 1 of a nine-part walkthrough of a MySQL backup verification lab.
- MySQL Lab
MySQL – test your backup by restoring it as a replica
A green MySQL backup job is not recoverability. Restore the backup as a replica, then walk through all twelve lab scenarios — full, incremental, scheduled, PITR, and by-hand kubectl — with measured evidence.
- MySQL Lab
MySQL – a replication lab with failover, backups, and scale-out on Kubernetes
A source–replica MySQL cluster on a laptop: GTID replication managed by the Percona Operator, Orchestrator failover, XtraBackup to MinIO, a restore that proves itself with a canary table, and scale-out from two members to three.
- ClickHouse Lab
ClickHouse – a replicated cluster on your laptop with kind and Ansible
A two-replica ClickHouse cluster, a three-node Keeper ensemble, a million NYC taxi trips, and Prometheus alerts that page Slack – all of it on a single Docker host, built and torn down with one command.
- MySQL
MySQL – How to encrypt backups?
Data has to be protected, this is quite clear. We protect the data by implementing firewalls, defining user privileges, roles, setting up an encryption of the data at rest and in transit. What is important to keep in mind is that the backups also have to be protected. If you create a logical backup of
- MySQL
MySQL – How to backup the database?
In one of the previous blog posts we have discussed what are the types of backup that you can use with MySQL. We have taken a look at the different backup methods. What we haven’t done is to show how to backup MySQL. This blog will focus solely on the backup process. Again, we are
- MySQL
MySQL Architecture – Sharding – How to approach sharding?
In the previous blog post we have started to look at the sharding in MySQL. We have discussed why someone may want to pursue sharding and when it’s a good time for that. In this blog post we will talk about different approaches to sharding. What are the different methods in which you can shard
- MySQL
MySQL – What are backup solutions for MySQL?
Most of you are probably aware of the simple fact that the database backups are quite useful. If it happens that someone forgets a WHERE clause in an UPDATE query, backups may be the way to recover your business. Let’s just assume that we do not need to explain “why?” we should take backups, let’s
- MySQL
MySQL Architecture – Sharding – Why shard MySQL database?
With this blog post we would like to start a small series that will focus on sharding in MySQL. If you wonder, should you shard your data? At which point it is a necessity? What are the approaches to sharding the data? How to build the sharded environment? How to design it to minimize the
- Galera
Galera – Limitations of Galera Cluster compared to standalone MySQL
Galera is a quite useful piece of technology that allows us to build highly available database clusters. This is one of the reasons why we are hearing questions about it a lot during our MySQL consulting activities. If you wonder what it is, we have an introductory post that explains basic concepts and features of
- Galera
How to deploy a two-node Galera cluster?
Galera cluster, be it MariaDB Cluster, Percona XtraDB Cluster or Galera Cluster from Codership uses quorum calculations to make sure the data consistency is safe in case of a split-brain and that the majority of the nodes will continue to operate while nodes that are in the minority will stop executing changes. We have discussed
- MySQL
MySQL – How to rename a database?
In one of the recent blog posts we have discussed how to rename a table in MySQL. Another common question is: how to rename a database? Let’s say we have one database with one table in it: mysql> use sbtest; Reading table information for completion of table and column names You can turn off this
- Vitess
Vitess – How to use vtexplain tool in Vitess?
Vitess attempts to be as transparent for the user as possible. As you may imagine, for a platform that supports sharding, this is not the easiest thing to do. There are quite a few factors you should consider when planning the execution of the queries. Indexes, sharding design, how to aggregate cross-shard data and so
- MySQL
MySQL – How to rename a table?
In this short blog post we will take a look at how to rename a table in MySQL. Sounds fairly simple, but we’ll try to dig a little deeper under the surface. How to rename a table in MySQL? As for the table, the solution is very simple: mysql> USE sbtest; Reading table information for
- Vitess
Vitess – Sharding example using Sysbench-TPCC schema
In previous blog posts we have looked at how to migrate TPCC-like schema that has been created using SysBench. Now, we have it in our Vitess cluster and we would like to take it a next step further and see how it can be sharded. Analysing the schema and queries The first step that we
- MySQL
How to create a database in MySQL?
This is another short blog where we try to answer questions commonly asked (at least per Google) by MySQL users. Today we will take a look at the following question: how to create a database in MySQL? What is a database in MySQL? First of all, the question is – what is a database in
- Vitess
Vitess – How to migrate into Vitess? External vttablet
In the previous blog in our Vitess series we have explained how to migrate your data into Vitess cluster using logical backup and then keep it in sync for the period of testing using asynchronous replication. Let’s try something similar but a bit different this time. We are going to use a nice feature of
- MySQL
MySQL – How to change the root password?
One of the most common questions according to Google is how to change the root password in MySQL. This blog is an attempt to answer this question. We will try to consider different scenarios that you may encounter in real life – how to change passwords in general, if you know it and, which is
- Vitess
Vitess – How to migrate into Vitess? Replication
In the previous couple of blogs we have been looking at the basic scaling options in Vitess. We have added replicas, sharded our data, created custom shards and many more. In this blog we would like to start a new series, learning more about how the application interacts with Vitess, how to identify performance issues,
- Galera
Galera – How To Avoid SST?
State transfer – SST or IST Let’s start by discussing what SST is and why we may want to avoid it if possible? We are not going into details regarding different types of state transfer methods in Galera. What should suffice to say is that there are two types – Incremental State Transfer (IST) and
- MySQL
MySQL – How to configure clone plugin for SSL?
As we have mentioned in one of our previous blog posts, clone plugin is a nice addition to MySQL as it allows users to easily provision nodes with data while not even leaving MySQL CLI. In the previous blog we have explained how to provision a new node to join the MySQL replication cluster. We
- MySQL
MySQL – How to install and use clone plugin?
For ages MySQL was lacking an ability to provision new instances with data, at least for the community builds. Well, technically there always was mysqldump but let’s forget about using it on any kind of scale. It’s too slow to be used in most of the real world scenarios. Finally, Oracle added a ‘clone’ plugin
- Vitess
Vitess – New patch release (v12.0.1) with Apache Log4j patch
Today’s blog is a short but quite important one. As you might be aware, a new vulnerability has been identified in Apache Log4j, a Java library intended to create error logs in the applications. It has been assigned CVE CVE-2021-44228. The issue itself is quite serious, remote code execution through properly crafted log messages with
- Galera
Galera – How to calculate the quorum?
As we have discussed in one of previous blogs, Galera uses a concept of quorum to determine if a given node is a part of the cluster and can proceed with handling the traffic or is it partitioned and should cease any operations. We have briefly touched how the quorum is calculated but we haven’t
- Galera
Galera – How to add a Galera node to the cluster?
Galera Cluster is a very useful flavour of MySQL with its strengths in High Availability and easiness of provisioning new nodes and keeping the existing nodes in sync. We have a couple of blog posts covering different features of the Galera cluster. Quite common question we hear is: how to add a new Galera node
- Galera
MySQL Architecture – What to use? MySQL replication or Galera Cluster?
In the past we have written blogs discussing MySQL asynchronous replication and providing basic insights into Galera Cluster. MySQL replication is a well-known, battle-tested solution but also Galera Cluster is a mature, well-tested product. We are quite frequently asked: which one should I choose? Would Galera Cluster work better for me than MySQL replication? This
- MySQL
How to create a user in MySQL?
One of the most commonly asked, MySQL-related questions according to Google, is: “How to create a user?” We would like to answer this question in this short blog post. So, how to do it? Of course, there are many software tools that can make it easier for you, for example MySQL Workbench, we will focus
- Vitess
Vitess – How to upgrade Vitess Cluster?
Quite recently we have seen the release of a new Vitess version (v12.0.0) and this may lead to some questions – how to upgrade your Vitess installation when you use the Kubernetes and Vitess operator? In this blog post we would like to show the upgrade process of a simple Vitess cluster. There are several
- MySQL
MySQL Architecture – When to use MySQL replication?
While working with customers, performing MySQL consulting and discussing architecture, we quite frequently are being asked a very important question. Which MySQL flavour we should use? What are the pros and cons of using MySQL replication, Galera Cluster or InnoDB Cluster? This is definitely a complex question but we thought we could prepare a couple
- Galera
Galera Cluster – Understanding the network latency impact
As we have discussed in one of our previous blog posts, Galera is sensitive to network latency. This discussion also comes up quite often in our MySQL consulting engagements. We have thought that it might be interesting to take a look at this in more detail and show you what kind of impact it has.
- Vitess
Vitess – Merging the shards
In the last blog we have split one shard into several smaller ones, to accommodate a significant increase of load on one of the accounts. In this blog we are going to pretend that this condition no longer exists and we want to bring the cluster back to its original shape. If you would like
- Vitess
Vitess – Sharding the shard
In the last blog we ended up with three shards for our newsbtest keyspace. This is great but let’s assume that we quickly have noticed that our problem has not disappeared. One of the shards is generating the majority of the load and it impacts the whole application. How can we deal with such issue?
- Galera
Galera Cluster – what is it?
MySQL comes in different shapes and sizes. Asynchronous replication, semisynchronous replication, NDB Cluster, Galera Cluster, InnoDB Cluster. We are not even mentioning MariaDB as a separate entity. One of the common questions we hear when delivering MySQL consulting is: what should I use? What are the differences between X and Y? This blog post is
- Vitess
Vitess – Shard the keyspace
Let’s say that we are running out of the write capacity in my primary database. In more simple words, our application executes such a number of writes per second that the database is not able to deal with them. It can be the replication (even multithreaded) that becomes the bottleneck, it can be just a
- Vitess
Vitess – New keyspace and xtrabackup
Last time we ended up with scaling the ‘sbtest’ keyspace up and down. We have also discussed how we can monitor the state of the replication between primary vttablet and replicas. Let’s continue by adding another keyspace to the mix. If you would like to follow our steps you can clone this repository: vitesstests Adding
- Vitess
Vitess – Scaling keyspace up and down
We left our cluster while sysbench was loading the data into the Vitess. This process may take a bit of time, let’s start this blog by discussing what we can do to monitor the status of the process. If you would like to follow our steps you can clone this repository: vitesstests Monitoring the replication
- Vitess
Intro to Vitess
Database landscape changed quite rapidly in the last couple of years. In the past the typical setup that we have seen was the database cluster. It could have been a standard, asynchronous replication-based cluster. It could have been a more cluster-aware solution like Galera. We are mentioning here solutions related to MySQL but this trend
- Vitess
Vitess – deploying a cluster
Step-by-step guide to deploying a Vitess cluster on a clean Kubernetes environment.