This blog, now Powered by WordPress + TiDB

In case you missed my tweet, I’ve joined PingCAP! We are building an open-source horizontally scalable, MySQL-compatible database named TiDB.  TiDB is designed for hybrid transaction and analytics processing (HTAP) workloads.

I am a strong believer of drinking your own champagne, aka dogfooding. So I’ve switched my blog from using MySQL to using TiDB.  This gives me an opportunity to test out new features through the eyes of an end-user.

Ti, from Titanium. Rhymes with Pie.

My Blog Topology

I wanted to build something that let me tinker with TiDB, quickly try switching in new versions of binaries, and learn how each component works in more detail.  So this is not quite a production deployment, but more of a developer experimentation setup.

This is what I arrived at:

  • 1x t2.micro instance running Amazon Linux 2 with Apache, PHP, and WordPress.
    1x t2.micro instance running Amzon Linux 2 with single instances of pdtidb and tikv.

TiDB Deployment Script

#!/bin/bash
wget http://download.pingcap.org/tidb-latest-linux-amd64.tar.gz
sha256sum -c tidb-latest-linux-amd64.sha256
tar -xzf tidb-latest-linux-amd64.tar.gz
cat << EOF > /tmp/tidb.conf
ec2-user soft nofile 1000000
ec2-user hard nofile 1000000
ec2-user soft core unlimited
ec2-user soft stack 10240
EOF
sudo cp /tmp/tidb.conf /etc/security/limits.d/
sudo sysctl -w net.core.somaxconn=32768
sudo sysctl -w vm.swappiness=0
sudo sysctl -w net.ipv4.tcp_syncookies=0
sudo sysctl -w fs.file-max=1000000
# I usually keep these running in a screen
# so I can watch logs and learn.

cd tidb-latest-linux-amd64 screen -dm ./bin/pd-server \
--data-dir=pd --log-file=pd.log
screen -dm ./bin/tikv-server \
--pd="127.0.0.1:2379" --data-dir=tikv \
--log-file=tikv.log
screen -dm ./bin/tidb-server \
--store=tikv --path="127.0.0.1:2379" \
--log-file=tidb.log
# Install MySQL command line client
sudo yum install -y mysql
cat << EOF > ~/.my.cnf
[client]
user=root
host=127.0.0.1
port=4000
EOF

Caveat

I would not recommend using this deploy script for production.  The recommended method of Ansible is far more robust and has handy features like providing support for rolling upgrades.  We are also currently working on providing a Kubernetes deployment.  Stay tuned 🙂


That’s it for now

I’m looking forward to getting back into blogging on tocker.ca again. I have ideas on writing posts on differences between TiDB to MySQL, how to do an effective proof-of-concept, and AWS deployment recommendations.

I’m also open to suggestions 🙂