Recently Google announced, that the second generation of Cloud SQL left the beta state and it is available. I decided to take a look, because last time when I checked it, it looked good, but I couldn’t take it seriously because of the nonexistent SLA.
I just created the Budapest MySQL Meetup group. I hope there will be interest for that, the first event is under organising. Check it if you are near Budapest!
Earlier this week we had a discussion with fellow DBAs about our mysql prompts, and at the end of the day it showed up, that a lot of us hit the same problem.
The problem is, that when you set up your mysql prompt then ‘\h’ will be resolved to ‘localhost’ when you connect locally – instead the name of your host as you expect it. It always bugs me, and once I spent a good afternoon figuring out how to workaround this.
Well, the workaround is not a big deal, because you can insert any text into your mysql prompt, and after you realise that you can do it, then it is easy: just put the hostname into your prompt with your chosen provisioning tool and that will do.
For example in my puppet installations I use the following setting in the template file from I generate the /etc/my.cnf file:
prompt = "\u@<%= @fqdn %> (\h) [\d]> "
It says: “username@hostname (connected_host) [database_name]” which is really informative. Let me show you this on live servers!
[email@example.com /home/banyek]# mysql -s firstname.lastname@example.org (localhost) [(none)]> \q [email@example.com /home/banyek]# mysql -s -h db-dev.xyz.kinja-ops.com firstname.lastname@example.org (db-dev.xyz.kinja-ops.com) [(none)]> \q [email@example.com /home/banyek]#
You can see that looking at this prompt I am able to say that which username I used, which host I am running the mysql command, what server will I run my commands and in which database I am.
There is also one more thing I want to show you, and that is colorising!
This is not my idea, so here’s the link the superuser article where I’ve read about that, but the idea is simple, use the ANSI escape sequences to colorise your mysql prompt. This could not be done inside a ‘prompt’ setting, but you can to this as creating an alias and echo the whole mysql command line out – where you can use the terminal control sequences.
For example here is an alias which you could check out:
$ alias colormysql=$(echo -e 'mysql --prompt="\x1B[31m\\u\x1B[34m@\x1B[32m\\h\x1B[0m:\x1B[36m\\d>\x1B[0m "')
But I am not really sure if this is generally a good idea. What do you think about that?
I was on the quest of searching the Holy Grail of Go programming, and I found something, which I doubt that it is, but close enough – for the first sight.
I have several problems with GO, first, that I write my code on an OSX box, and I’ll run the programs on Linux hosts, so I have to solve the cross compilation; my second problem with Go, that I don’t really like the “There is a GO project folder, and all the GO projects are relying under” approach. It makes githubbing painful.
The first problem of mine is easily achievable since GO 1.5: we only need a GOOS environment variable and we can compile to different OS-es (see more at Dave Cheney: http://dave.cheney.net/2015/08/22/cross-compilation-with-go-1-5) easily.
The second problem is easily solvable too, just we have to start using the GOPATH variable for every GO project we have.
I don’t really wanted to use any external dependencies, so I decided to use ‘Makefile’ – it was proven good for decades. (I don’t know if this applies on bigger projects, but the ones I wrote it is fairly good.)
Let’s check out the makefile of the binlogstreamer!
If you type ‘make’ in the checked out project folder, it will download all the dependencies and build the application there. You can run that locally, test it, etc. If you change the code, then you can compile it again, etc.
On my OSX host, I can build for our linux boxes as well I just type ‘make linux’ and I’ll have the binary which I can run on our servers. I can put the binary to the puppet repository, and git push it.
After I made my changes in the code, and I’d like to push to git, then I just run ‘make clean’ which removes all the binaries, and all dependencies, and leaves just the code there. I can commit and push it when I want.
So far this approach worked to me. Do you have any better?
Saturday I was in my favourite grocery store, standing in the line, browsing the net on my phone. I read Vadim Tkachenko‘s blog post about Measuring Percona Server Docker CPU/network overhead and his findings were the opposite than mine – he didn’t found any measurable difference. Reading his post, he did found huge impact in networking which I didn’t checked, so I was re-run my checks again, but now with paying attention for network configuration.
I won’t lingering this more: he’s correct, I was wrong. After I start to use the host’s network directly – the performance degradation went away.
Yay, for Vladim!
Back in October I have write about possible ways of running multiple MySQL instances on the same hardware. As the months passing by, the project of splitting our database schemas into standalone instances is closing in, so I started to check the different ways.
EDIT: This post is outdated, here is the follow up.
This one really was a pain in the ass for long time.
Jenkins is great, not only for building projects, but I start the most of the ops related tasks here. All the projects have their own workspace, I can browse the previous outputs, see if a task failed or not, and I can easily share the results at the en of the task.
I had only one problem with that: the long running tasks weren’t shown on console output until they finished. I tried to solve that, but it was only annoying, not a showstopper, so I let that go, because it didn’t look like an easy win, and I didn’t want to spend too much time on that.
I am always fascinated about the cleanliness of UNIX . One tool only should do one thing, but it has to be the best in that way. The operating system itself will glue all the modules together and give you a complex feel of a system, you don’t have to take care of huge, bloated software, don’t have to deal with mysterious bugs, which are appearing random. Just small bricks of clever software, and the rest is on you.
With MySQL it is relatively easy to create point in time restores. All you need is a recent(ish) backup, and a bunch of saved binary logs. You can restore the backup you have, and when it is completed, you can use mysqlbinlog utility to apply your saved binary logs to the desired state of your database.