I'm currently writing a book for PragProg called Building Distributed Services with Go (though it mostly applies to other languages too) that's walks you through building a distributed database from scratch. You can sign up on this mailing list to know when it's available: https://travisjeffery.us4.list-manage.com/subscribe?u=1e3ff7...
Yeah---each chapter begins with background on the chapter's topic, some theory, covers how and where you'd use what's we're talking about in the chapter and then we use it to build a part of the project we're building throughout the book. For example, in the consensus chapter we talk about what problems it solves and how you can use it in your projects,and then we implement Raft in the service for leader election and replication.
This one, it covers all the aspects deeper. The next book, if you want to go deeper, can be an upcoming 4th edition of Principles of Distributed Database Systems https://www.springer.com/gp/book/9783030262525
Designing Data-Intensive Applications https://dataintensive.net/
Streaming Systems http://shop.oreilly.com/product/0636920073994.do
and this one.