Build and Download Keyhole
Build from GitHub
Golang has to be installed before you can build. The commands below show how to clone from GitHub and build a Keyhole executable:
I provide a build.sh script to build Keyhole on macOS or Linux. Simply run the script:
I encourage you to use the script to build. It’s easier for me to debug based on the included version number if a reported bug ever comes to me.
Cross Platform Builds
To my surprise, it was not as easy as I thought for many users to build Keyhole executables. How about Windows executable? So, I improved the script to build for three different platforms, and they are macOS, Linux, and Windows, respectively. The command is:
The outputs are created under the dist directory.
Build on Windows
Below is the command to build Keyhole v1.0.5 from a Windows command terminal.
The above command will output an executable, keyhole, in the current directory. The version number is stored in a file, named version.
Download Executables
I used to make Keyhole executables available to download from GitHub. After I retired my Jenkins, I began using Docker Hub for my CI pipeline and no more executables were available from GiHub.
Use Docker to Download
If you have Docker installed, the latest Keyhole executables can be downloaded from Docker Hub using the scripts/download-from-docker.sh script. The script only has a few lines, see below:
Docker on Windows
Nothing is straightforward on Windows if it can’t be double-clicked. To download from a Windows computer, it’s not as simple as I first thought. First of all, after installing the Docker engine, switch to Linux containers mode. The switching to Linux containers may fail if your hypervisor doesn’t support it. Once you pass the Docker installation and configuration, creating a Keyhole instance before copying the file. Below is an example of the commands I ran:
The above commands can be summarized as 1) remove the existing Keyhole image, 2) create a new instance of Keyhole, 3) use the instance id to copy a file, and 4) remove the instance. If you don’t understand the above commands, call for professional help.
What's Next?
The build and download steps are simple enough if one can overcome the prerequisites such as installing Golang and/or Docker. Short blogs about the uses of Keyhole come next following this post. Keyhole was actively developed and thus made previous posts somewhat outdated. Check out Survey Your Mongo Land and Maobi - Reports Generator for Keyhole next to begin evaluating MongoDB performance using Keyhole.
Comments
docker rmi -f simagix/keyhole
$id = docker create simagix/keyhole | select -Last 1
docker cp ${id}:/dist/keyhole-win-x64.exe C:\MongoDB\keyhole.exe
$Env:PATH += $(pwd)