Skip to content

Building, Testing, and Running

Kinan Bab edited this page Apr 26, 2023 · 1 revision

If using the docker container, open a terminal inside it and navigate to /home/k9db. Otherwise, naviagte to <k9DB_DIR> on your system.

You can build K9db using bazel.

# This may take anywhere from 5-50 minutes, depending on your system.
bazel build :k9db

To run all tests, run bazel test ...

K9db's main entry point is its mysql proxy, which acts as a MySQL server. You can run this using:

bazel run :k9db --config opt

You can pass multiple command line flags to K9db to configure it.

bazel run :k9db -- --db_path=[/tmp] \
                   --db_name=[k9db] \
                   --hostname=[127.0.0.1:10001] \
                   --logtostderr=([0]|1)

You can stop K9db at any time by using ctrl+c. K9db will always try to shutdown cleanly and wait for any open clients to disconnect before shutting down. You can start K9db again using the above command at any point, and it will reload the database state as it was prior to shutdown. To destroy the database, you will need to remove it from the filesystem after shutting K9db down.

ctrl+c               # shutdown K9db.
rm -rf /tmp/k9db_*   # clear all databases in default location
bazel run :k9db      # fresh start with an empty database.

By default, bazel build and runs in debug mode which is suitable for getting started with K9db. For optimal performance while reproducing our experiments, you will need to run using optimized mode.

bazel run :k9db --config opt