Note: this isn't recommended for production deployments. However, this is useful for development where you don't wish to install the client dependencies on your machine, or have an incompatible OS.
Running perfrunner with docker-compose allows the perfrunner repo to be mounted as a volume, so live changes you make inside the repo, on your host machine, will be reflected in the container. Anything outside the repo (for example, system packages), will not be mirrored between container and host. This gives you a self-contained development environment.
- Recent version of docker
- Docker compose should be integrated, if not, check compose migration
First create a local testing network. This provides isolation and you only have to do it once:
docker network create local-perf-testing
Keep the name the same, perfrunner docker compose is setup to find a network with this name. Then, to build, install perfrunner requirements, and gain a shell in the container:
make docker-compose CONTAINER_PASSWORD=${password}
Where ${password} is the same as that supplied in the credentials section of your spec file.
Simply disconnect with exit
when done.
Other useful commands include:
-
Exec back into the container:
docker exec -it perfrunner /bin/bash
-
Kill the perfrunner container:
docker kill perfrunner
-
Restart the perfrunner container:
docker start perfrunner
Follow the instructions from the documentations on how to install a couchbase server locally using docker. Remember to add --network local-perf-testing
in your docker run command when starting the couchbase server.
By installing and enabling the SSH server on the server nodes, you ensure that Perfrunner can securely interact with the Couchbase cluster, execute commands, and perform data operations seamlessly throughout the performance testing phases.
Install SSH Server:
apt-get update
apt-get install -y openssh-server
Once installed, start the SSH service using service ssh start
. These commands ensure that the SSH server is installed and running within the container, allowing secure remote connections.
Set Password:
Use the passwd
command to set a password for the SSH server. This command prompts you to enter and confirm the new password.
Configure SSH:
Use your preferred editor to open the SSH configuration file located at /etc/ssh/sshd_config
. Within the SSH configuration file, locate the PermitRootLogin line and uncomment it if it exists or add it if it's not present. Set the value to yes to allow root login via SSH. Save and exit the editor.
Restart SSH Service:
Finally, restart the SSH service using service ssh restart
to apply the changes made to the SSH server configuration.
To run a perfrunner test in a container, you can run commands as normal, eg:
env/bin/perfrunner -c clusters/cluster_spec.spec -t tests/comp_bucket_20M.test
Note: Make sure the cluster specified by -c
is free and there are no any running jobs at the moment using the cluster.
To prepare a local cluster spec for testing, copy any example cluster available in clusters/
directory and name it say clusters/local.spec
. Modify the following two sections, clusters
and clients
as in the example below:
[clusters]
local =
<server-ip>:kv
[clients]
hosts =
localhost
The client hosts should be localhost
or 127.0.0.1
. The server IP can be obtained by inspecting your Couchbase server docker container and look for IPAddress. For instance, if my server container name is couchbase
:
docker inspect couchbase | grep IPAddress -
To generate docker images available at docker hub, run the following commands:
-
Make sure the image is built for
linux/amd64
. This is what we use for our client machines. You can skip this step if running onlinux/amd64
platform or building for local testing.export DOCKER_DEFAULT_PLATFORM=linux/amd64
-
Optionaly also specify
PYTHON_VERSIONS
andPYENV_VERSION
build arguments (with--build-arg
) to specify which Python versions and Pyenv version to install in the image. -
Build perfrunner image:
docker build --target perfrunner docker/
-
Tag the image appropriately
docker tag <generated-image-tag> perflab/perfrunner
The generated image tag will be displaed at the end of the previous build step.
This will tag the new image as @latest
. You can use your personal hub to build experimental builds. Or simply:
make docker