# Installing and Updating an Extension

Valkey supports Redis-compatible modules to extend core database functionality with custom data types, specialized algorithms, and advanced operations. These modules are compiled as shared object (.so) files and must be loaded at server startup. Examples include RedisBloom, RedisJSON, and RedisTimeSeries all of which are supported in Valkey just as in Redis.

In Elestio-hosted Valkey instances or any Docker Compose based setup, modules can be mounted and loaded via configuration in <span class="s1">**docker-compose.yml**</span>. This guide outlines how to install, load, and manage Valkey modules using Docker Compose, including verification steps, update methods, and best practices.

## **Installing and Enabling Valkey Modules**

Modules in Valkey must be loaded at server startup using the <span class="s4">--loadmodule</span> directive. These are <span class="s4">.so</span> binaries typically mounted into the container from the host file system. The process is nearly identical to Redis module integration.

##### **Update docker-compose.yml**

To use a module such as <span class="s1">**RedisBloom**</span> in a Valkey Docker setup, mount the module file and add the <span class="s4">--loadmodule</span> directive to the container command.

```yaml
services:
  valkey:
    image: valkey/valkey:latest
    volumes:
      - ./modules/redisbloom.so:/data/redisbloom.so
    command: ["valkey-server", "--loadmodule", "/data/redisbloom.so"]
    ports:
      - "6379:6379"
```

**Explanation:**

- <span class="s1">./modules/redisbloom.so</span> is the local path on your host machine.
- <span class="s1">/data/redisbloom.so</span> is the path where the module will be accessible inside the container.

Ensure that the <span class="s2">.so</span> file exists locally before running the container.

##### **Restart the Valkey Service**

After updating the Docker Compose configuration, apply changes by restarting the container:

```bash
docker-compose down
docker-compose up -d
```

This reloads Valkey and ensures the module is initialized during startup.

##### **Verify the Module is Loaded**

Once Valkey is running, connect to the containerized service:

```bash
docker-compose exec valkey valkey-cli -a <yourPassword>
```

Run the following command to check for loaded modules:

```bash
MODULE LIST
```

**Expected output (for RedisBloom):**

```bash
1) 1) "name"
   2) "bf"
   3) "ver"
   4) (integer) 20207
```

This confirms that the module (in this case, <span class="s1">bf</span> for Bloom filters) has been loaded successfully.

## **Checking Module Availability &amp; Compatibility**

Valkey modules must match the container’s runtime architecture and the Valkey version. Many Redis modules work out-of-the-box with Valkey, but always check official documentation or test in a controlled environment first.

To inspect module metadata and compatibility:

```bash
INFO MODULES
```

To confirm the current Valkey version and platform:

```bash
docker-compose exec valkey valkey-server --version
```

If a module fails to load, check container logs for detailed error output:

```bash
docker-compose logs valkey
```

Most load failures are caused by missing binaries, unsupported formats, or incorrect file paths.

## **Updating or Unloading Modules**

Valkey does <span class="s2">**not**</span> support dynamic unloading of modules while the server is running. To update or remove a module, the server must be stopped and restarted with the revised configuration.

Stop the container:

```
docker-compose down
```

Edit <span class="s1">**docker-compose.yml**</span> as needed:

- Update the <span class="s1">.so</span> path to reference the new module version.
- Remove the <span class="s1">--loadmodule</span> line to disable the module entirely.

Start the container again:

```
docker-compose up -d
```

Always test updated modules in staging before deploying to production environments.

## **Troubleshooting Common Module Issues**

<table border="1" id="bkmrk-issue-cause-resoluti" style="width: 100%; height: 262.766px; border-collapse: collapse; border-color: rgb(0, 0, 0);"><thead><tr style="height: 29.7969px;"><th style="width: 24.2299%; height: 29.7969px; border-color: rgb(0, 0, 0);">**Issue**

</th><th style="width: 30.9245%; height: 29.7969px; border-color: rgb(0, 0, 0);">**Cause**

</th><th style="width: 44.7265%; height: 29.7969px; border-color: rgb(0, 0, 0);">**Resolution**

</th></tr></thead><tbody><tr style="height: 46.5938px;"><td style="width: 24.2299%; height: 46.5938px; border-color: rgb(0, 0, 0);">Valkey fails to start

</td><td style="width: 30.9245%; height: 46.5938px; border-color: rgb(0, 0, 0);">Invalid module path or incompatible binary

</td><td style="width: 44.7265%; height: 46.5938px; border-color: rgb(0, 0, 0);">Check <span class="s1">docker-compose logs valkey</span> and verify path and architecture

</td></tr><tr style="height: 46.5938px;"><td style="width: 24.2299%; height: 46.5938px; border-color: rgb(0, 0, 0);">MODULE command not recognized

</td><td style="width: 30.9245%; height: 46.5938px; border-color: rgb(0, 0, 0);">Image does not include module support

</td><td style="width: 44.7265%; height: 46.5938px; border-color: rgb(0, 0, 0);"><span class="s1">Use an image like </span>valkey/valkey:latest<span class="s1"> or </span>valkey/valkey:alpine

</td></tr><tr style="height: 46.5938px;"><td style="width: 24.2299%; height: 46.5938px; border-color: rgb(0, 0, 0);">“Can’t open .so file” error

</td><td style="width: 30.9245%; height: 46.5938px; border-color: rgb(0, 0, 0);">Volume not mounted or file permission denied

</td><td style="width: 44.7265%; height: 46.5938px; border-color: rgb(0, 0, 0);">Confirm that the <span class="s1">.so</span> file exists and has readable permissions

</td></tr><tr style="height: 46.5938px;"><td style="width: 24.2299%; height: 46.5938px; border-color: rgb(0, 0, 0);">Module not listed in MODULE LIST

</td><td style="width: 30.9245%; height: 46.5938px; border-color: rgb(0, 0, 0);">Silent module load failure

</td><td style="width: 44.7265%; height: 46.5938px; border-color: rgb(0, 0, 0);">Review container logs and validate command syntax

</td></tr><tr style="height: 46.5938px;"><td style="width: 24.2299%; height: 46.5938px; border-color: rgb(0, 0, 0);">Module commands not recognized

</td><td style="width: 30.9245%; height: 46.5938px; border-color: rgb(0, 0, 0);">Module did not load correctly

</td><td style="width: 44.7265%; height: 46.5938px; border-color: rgb(0, 0, 0);">Ensure Valkey version and module binary compatibility

</td></tr></tbody></table>

## **Security Considerations**

Modules execute <span class="s2">**native code**</span> within the Valkey process and inherit its permissions. As such, only load <span class="s2">**trusted**</span> <span class="s3">.so</span> files compiled from official or reviewed source code. Avoid uploading or using third-party binaries without auditing.

In Elestio-managed or containerized environments, use Docker’s file and user isolation to reduce risk:

- Set <span class="s2">**read-only**</span> permissions on mounted <span class="s3">.so</span> files.
- Use <span class="s2">**non-root users**</span> inside containers when possible.
- Monitor module behavior with <span class="s2">**SLOWLOG**</span>, <span class="s2">**INFO**</span>, and command auditing.

Improperly configured or malicious modules can cause crashes, memory leaks, or worse. Treat modules as <span class="s2">**privileged extensions**</span> and keep them versioned and tested across environments.