# Best way to setup multiple weaviate databases on a single machine?

**URL:** <https://forum.weaviate.io/t/best-way-to-setup-multiple-weaviate-databases-on-a-single-machine/2119>\
**Category:** Support\
**Tags:** developer-experience\
**Created:** [April 26, 2024, 12:48pm UTC](https://forum.weaviate.io/t/best-way-to-setup-multiple-weaviate-databases-on-a-single-machine/2119 "2024-04-26T12:48:08Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![blevlabs](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/blevlabs/32/1391_2.png) [@blevlabs](https://forum.weaviate.io/u/blevlabs)\
**Post date:** [April 26, 2024, 12:48pm UTC](https://forum.weaviate.io/t/best-way-to-setup-multiple-weaviate-databases-on-a-single-machine/2119/1 "2024-04-26T12:48:08Z")

</div>

### Description

I am trying to setup **multiple weaviate instances** with docker-compose **on one machine**. I need them to **all have persistent data storage**. I was going to modify the data storage directories and the ports. Still, I was wondering if there was a more secure way to ensure I can properly run multiple databases per machine. This is necessary for a few reasons as different projects have different vectorizer requirements and require data separation in other databases.

### Server Setup Information

- Weaviate Server Version: latest
- Deployment Method: docker
- Multi Node? Number of Running Nodes: 1
- Client Language and Version: python

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [April 26, 2024, 1:12pm UTC](https://forum.weaviate.io/t/best-way-to-setup-multiple-weaviate-databases-on-a-single-machine/2119/2 "2024-04-26T13:12:06Z")

</div>

hi @blevlabs !

Welcome to our community! 🤗

You can do that by:

1 - mapping different ports for each docker compose weaviate instance  
2 - running all instances under a reverse proxy (like traefik), and mapping each server using a subdomain.

Let me know if this helps 🙂

---

<div class="post-metadata">

**Author:** ![blevlabs](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/blevlabs/32/1391_2.png) [@blevlabs](https://forum.weaviate.io/u/blevlabs)\
**Post date:** [April 26, 2024, 1:15pm UTC](https://forum.weaviate.io/t/best-way-to-setup-multiple-weaviate-databases-on-a-single-machine/2119/3 "2024-04-26T13:15:00Z")

</div>

I see, so I would just need something like this (configured with different ports and file paths for saving:  
(8080-\>8081)  
(50051-\>50052)  
(/var/lib/weaviate-\>/var/lib/weaviate\_creator)

```auto
---
version: '3.4'
services:
  weaviate:
    command:
    - --host
    - 0.0.0.0
    - --port
    - '8081'
    - --scheme
    - http
    image: cr.weaviate.io/semitechnologies/weaviate:1.24.10
    ports:
    - 8081:8081
    - 50052:50052
    volumes:
    - weaviate_data:/var/lib/weaviate_creator
    restart: on-failure:0
    environment:
      TRANSFORMERS_INFERENCE_API: 'http://t2v-transformers:8081'
      IMAGE_INFERENCE_API: 'http://i2v-neural:8081'
      QUERY_DEFAULTS_LIMIT: 25
      AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true'
      PERSISTENCE_DATA_PATH: '/var/lib/weaviate_creator'
      DEFAULT_VECTORIZER_MODULE: 'text2vec-transformers'
      ENABLE_MODULES: 'text2vec-transformers,img2vec-neural'
      CLUSTER_HOSTNAME: 'node1'
  t2v-transformers:
    image: cr.weaviate.io/semitechnologies/transformers-inference:mixedbread-ai-mxbai-embed-large-v1
    environment:
      ENABLE_CUDA: '1'
      NVIDIA_VISIBLE_DEVICES: 'all'
    deploy:
      resources:
        reservations:
          devices:
          - capabilities: 
            - 'gpu'
  i2v-neural:
    image: cr.weaviate.io/semitechnologies/img2vec-pytorch:resnet50
    environment:
      ENABLE_CUDA: '1'
      NVIDIA_VISIBLE_DEVICES: 'all'
    deploy:
      resources:
        reservations:
          devices:
          - capabilities: 
            - 'gpu'
volumes:
  weaviate_data:
...

```

---

<div class="post-metadata">

**Author:** ![blevlabs](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/blevlabs/32/1391_2.png) [@blevlabs](https://forum.weaviate.io/u/blevlabs)\
**Post date:** [April 26, 2024, 1:24pm UTC](https://forum.weaviate.io/t/best-way-to-setup-multiple-weaviate-databases-on-a-single-machine/2119/4 "2024-04-26T13:24:44Z")

</div>

Actually, strange. Even after changing the ports it still goes to 8080:

```auto
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)

```

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [April 26, 2024, 5:46pm UTC](https://forum.weaviate.io/t/best-way-to-setup-multiple-weaviate-databases-on-a-single-machine/2119/5 "2024-04-26T17:46:23Z")

</div>

The first port is the one that needs to be changed.

So

8081:8080

Will map the port 8081 from you host machine to the port 8080 of your container.

Also, you can run your models on a separate docker compose, and create a network only for those container.

So every container that will use those models can also be added to that network.

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [April 26, 2024, 5:48pm UTC](https://forum.weaviate.io/t/best-way-to-setup-multiple-weaviate-databases-on-a-single-machine/2119/6 "2024-04-26T17:48:10Z")

</div>

Regarding the log, no problems.

This only indicates that the container is listening in port 8080.

When changing the ports in the docker compose you are only changing the map between host port and container port.

---

<div class="post-metadata">

**Author:** ![blevlabs](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/blevlabs/32/1391_2.png) [@blevlabs](https://forum.weaviate.io/u/blevlabs)\
**Post date:** [April 26, 2024, 6:41pm UTC](https://forum.weaviate.io/t/best-way-to-setup-multiple-weaviate-databases-on-a-single-machine/2119/7 "2024-04-26T18:41:20Z")

</div>

I see, so what would happen if I need to host multiple of the same weaviate database on the same machine? How can I ensure the same container URLs do not cross over between instances?

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [April 29, 2024, 4:59pm UTC](https://forum.weaviate.io/t/best-way-to-setup-multiple-weaviate-databases-on-a-single-machine/2119/8 "2024-04-29T16:59:25Z")

</div>

hi! Not sure I understood 🤔

You can use the same machine to host **different** weaviate servers.

On that case, each server will listen on different ports for http and grpc. With that you can have multiple Weaviate instances running.

Docker isolates each service on it’s own network, so the only part that could overlap would be if you map the same port on your host to a container.

Let me know if this clarifies 🙂

THanks!

---

<div class="post-metadata">

**Author:** ![Variable](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/variable/32/1897_2.png) [@Variable](https://forum.weaviate.io/u/Variable)\
**Post date:** [July 8, 2024, 2:01am UTC](https://forum.weaviate.io/t/best-way-to-setup-multiple-weaviate-databases-on-a-single-machine/2119/9 "2024-07-08T02:01:55Z")

</div>

Hi @DudaNogueira ,

I’m trying to do something similar - I’m trying to start multiple independent local instances for different purposes, so each of them should not intervene others.

Do I need to start multiple docker containers and explicitly connect each of the clients in the code? Or calling weaviate.connect\_to\_local still works without explicit configuration?

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [July 8, 2024, 5:34pm UTC](https://forum.weaviate.io/t/best-way-to-setup-multiple-weaviate-databases-on-a-single-machine/2119/10 "2024-07-08T17:34:34Z")

</div>

hi!

weaviate.connect\_to\_local will only work for the localhost cluster that has the exposed http port at 8080 and the grpc port at 50051.

So for the others, you will need to explicitly define its ports, considering each one will be mapped to different ports.

> **[Custom connections | Weaviate - Vector Database](https://weaviate.io/developers/weaviate/connections/connect-custom)**
>
> The Python Client v4 and the TypeScript Client v3 provide helper methods for common connection types. They also provide custom methods for when you need additional connection configuration.

Let me know if this helps!
