如何在生产环境中部署 Chroma 数据库(矢量数据库)

huangapple go评论130阅读模式
英文:

How to deploy chroma database (vector database) in production

问题

我正在进行一个项目,在这个项目中,我想将嵌入保存在向量数据库中。
需要一些帮助或资源来部署 Chroma 数据库以供生产使用。

英文:

I am working on a project where i want to save the embeddings in vector database.
need some help or resources to deploy chroma db for production use

答案1

得分: 1

更新 1

在 GCP 或任何其他平台上,您可以启动一个新的实例。安装 Docker 和 Docker Compose。然后运行以下 Docker Compose 文件。Chroma 数据库将启动并运行。然后,您可以访问数据库位于 external-ip:8000

# docker-compose.yml
version: '3.3'

services:
    server:
        image: ghcr.io/chroma-core/chroma:latest
        volumes:
            - index_data:/index_data
        environment:
            - CHROMA_DB_IMPL=clickhouse
            - CLICKHOUSE_HOST=clickhouse
            - CLICKHOUSE_PORT=8123
        ports:
            - 8000:8000
        depends_on:
            - clickhouse
    
    clickhouse:
        image: clickhouse/clickhouse-server:22.9-alpine
        environment:
            - ALLOW_EMPTY_PASSWORD=yes
            - CLICKHOUSE_TCP_PORT=9000
            - CLICKHOUSE_HTTP_PORT=8123
        ports:
            - '8123:8123'
            - '9000:9000'
        volumes:
            - clickhouse_data:/bitnami/clickhouse
            - backups:/backups
            - ./config/backup_disk.xml:/etc/clickhouse-server/config.d/backup_disk.xml
            - ./config/chroma_users.xml:/etc/clickhouse-server/users.d/chroma.xml

volumes:
    clickhouse_data:
        driver: local
    index_data:
        driver: local
    backups:
        driver: local

还要创建 config/chroma_users.xml 文件

<clickhouse>
    <profiles>
        <default>
            <allow_experimental_lightweight_delete>1</allow_experimental_lightweight_delete>
            <mutations_sync>1</mutations_sync>
        </default>
    </profiles>
</clickhouse>

原始回答

截止到目前,Chroma 团队仅发布了有关如何在 AWS 上部署数据库的详细信息:https://docs.trychroma.com/deployment。但它目前处于 alpha 阶段,并使用 AWS EC2 来部署数据库。

我对使用 Kubernetes 部署数据库进行了一些研究。您可以使用 Docker 镜像来创建部署:https://github.com/chroma-core/chroma/pkgs/container/chroma。这是一个选项,但我还没有测试过它。我正在进行相关工作,将会进行更新。

英文:

Update 1

On GCP or any other platform, you can start a new instance. Install docker and docker compose. Then run the following docker compose file. The Chroma db will be up and running. You can then access the db at external-ip:8000

# docker-compose.yml
version: '3.3'

services:
    server:
        image: ghcr.io/chroma-core/chroma:latest
        volumes:
            - index_data:/index_data
        environment:
            - CHROMA_DB_IMPL=clickhouse
            - CLICKHOUSE_HOST=clickhouse
            - CLICKHOUSE_PORT=8123
        ports:
            - 8000:8000
        depends_on:
            - clickhouse
    
    clickhouse:
        image: clickhouse/clickhouse-server:22.9-alpine
        environment:
            - ALLOW_EMPTY_PASSWORD=yes
            - CLICKHOUSE_TCP_PORT=9000
            - CLICKHOUSE_HTTP_PORT=8123
        ports:
            - '8123:8123'
            - '9000:9000'
        volumes:
            - clickhouse_data:/bitnami/clickhouse
            - backups:/backups
            - ./config/backup_disk.xml:/etc/clickhouse-server/config.d/backup_disk.xml
            - ./config/chroma_users.xml:/etc/clickhouse-server/users.d/chroma.xml

volumes:
    clickhouse_data:
        driver: local
    index_data:
        driver: local
    backups:
        driver: local

also create config/chroma_users.xml file

<clickhouse>
    <profiles>
        <default>
            <allow_experimental_lightweight_delete>1</allow_experimental_lightweight_delete>
            <mutations_sync>1</mutations_sync>
        </default>
    </profiles>
</clickhouse>

Original answer

As of right now, chroma team has only published details about how to deploy db on AWS https://docs.trychroma.com/deployment. But it is in alpha and uses AWS EC2 to deploy the db.

I did some research on deploying the db with Kubernetes. You can use the docker image to create the deployment https://github.com/chroma-core/chroma/pkgs/container/chroma. It is one option, but I haven't tested it out yet. I am working on it, will update.

huangapple
  • 本文由 发表于 2023年6月19日 17:59:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/76505538.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定