Question

how can i setup and install vector database ?

I am developing application using spring ai and want to deploy vector database on digital ocean ? how can i setup and install vector database ?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

KFSys
Site Moderator
Site Moderator badge
November 19, 2024

Here is my take on how to approach,

Update Your System

Once you’re connected to your Droplet, update your system packages to ensure everything is current:

sudo apt update && sudo apt upgrade -y

Install Docker

Most vector databases are containerized, making Docker the simplest way to set them up.

  1. Install Docker using the following commands:
sudo apt install apt-transport-https ca-certificates curl software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update
sudo apt install docker-ce -y
  1. Enable and start Docker so that it runs on boot:
sudo systemctl enable docker
sudo systemctl start docker

Some vector databases come with a docker-compose.yml file for easier deployment.

sudo curl -L "https://github.com/docker/compose/releases/download/$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep tag_name | cut -d '"' -f 4)/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

Deploy a Vector Database

There are several popular vector databases to choose from. Below are the installation steps for Qdrant, but similar steps can be used for Weaviate or Pinecone.

Example: Installing Qdrant

  1. Pull the Qdrant Docker Image:

    sudo docker pull qdrant/qdrant
    
  2. Run the Container:

    Use the following command to run Qdrant on port 6333:

    sudo docker run -d -p 6333:6333 qdrant/qdrant
    

    This will run Qdrant and make it accessible on port 6333 of your droplet’s IP address.

Example: Installing Weaviate (with Docker Compose)

  1. Create a Directory for Weaviate:

    mkdir weaviate && cd weaviate
    
  2. Create a Docker Compose File:

    Create a docker-compose.yml file with the following content:

    version: '3.4'
    
    services:
      weaviate:
        image: semitechnologies/weaviate:latest
        ports:
          - "8080:8080"
        environment:
          QUERY_DEFAULTS_LIMIT: '100'
          AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true'
          PERSISTENCE_DATA_PATH: './data'
    
  3. Run Weaviate:

    sudo docker-compose up -d
    

    This will bring up Weaviate and make it accessible on port 8080.

Access and Test Your Vector Database

After installing the vector database, you can access it via its REST API. For Qdrant, for example, you can visit:

http://your_droplet_ip:6333

You can also use tools like curl or Postman to interact with the API.

To secure your vector database:

  1. Use a Firewall: Set up a firewall to allow only trusted IPs to access the database.

    sudo ufw allow OpenSSH
    sudo ufw allow 6333/tcp  # Adjust based on your vector database port
    sudo ufw enable
    
  2. Add Authentication: Some vector databases support API keys or tokens for additional security.

  3. Use HTTPS: If you’re accessing the database over the internet, consider using a reverse proxy like Nginx to add SSL.

Bobby Iliev
Site Moderator
Site Moderator badge
November 19, 2024

Hey there!

With a DigitalOcean Droplet you will have root access and you can install any services that you need to. The flexibility of a Droplet means you can fully customize your setup to match your application’s needs.

Do you have a specific vector database in mind?

On another note, DigitalOcean provides a Managed OpenSearch service, which supports k-NN (k-Nearest Neighbors) vector search natively. This is a managed solution, so it takes care of the heavy lifting like backups, scaling, and maintenance for you.

You can explore k-NN vector search capabilities in OpenSearch by checking out this helpful article:

Enhancing Search Capabilities with k-NN Vector Search in OpenSearch

To get started with Managed OpenSearch, head over here:

DigitalOcean Managed OpenSearch

Let me know how it goes, and feel free to share more details about your use case if you’d like further advice!

- Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.