To automate everything, even the smallest things (scripts), is a lesson I continuously learn while doing programming.
Let’s take MySQL and setting up replication for example. For years I would rely on googling and then copy and pasting the same few SQL commands to configure the master, slave and start the replication. Forward to around now, while crafting the Percona Docker Container I finally decided to encapsulate the process into 2 simple to use and remember commands.
Now, I can just exec into my MySQL container and type:
replication_master_sql
To get the SQL to execute on the master, tailored for the particular configuration. Once I execute this SQL on the master, I finish the whole “process” and start the replication with something like:
start_replication mysql-bin.000001 107
Where the last two arguments are the binlog position of where to start the replication.
When I first used this in production, the experience was like night and day compared to looking up the correct queries and then modifying them according to my setup. Thus—automate everything. It pays of every time you need it afterwards.