qdrant集群安装测试

qdrant安装方式很多,这篇文章先测试docker安装方式,也是最简单安装方式
规划为三节点机器
10.10.10.1
10.10.10.2
10.10.10.3
安装目录统一为/qdrant
1。安装docker
可以使用一键安装或者分布安装,这里直接一键安装,三台机器分别都需要安装

curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

启动docker,并查看状态

sudo service docker start
systemctl status docker.service

设置docker开机自己启动

systemctl enable docker.service

2.下载qdrant镜像
直接按照官网操作就可以,每台节点操作相同
查看docker状态

sudo docker info

拉取镜像

docker pull qdrant/qdrant

3.配置第一台
然后再第一台创建好qdrant目录

mkdir /qdrant
cd /qdrant

进入目录创建配置文件和数据文件持久化目录

mkdir -p $(pwd)/path/to/

配置配置文件,配置集群参数

vi $(pwd)/path/to/config_001.yaml
cluster:
  # Use `enabled: true` to run Qdrant in distributed deployment mode
  enabled: true
  # Configuration of the inter-cluster communication
  p2p:
    # Port for internal communication between peers
    port: 6335

  # Configuration related to distributed consensus algorithm
  consensus:
    # How frequently peers should ping each other.
    # Setting this parameter to lower value will allow consensus
    # to detect disconnected node earlier, but too frequent
    # tick period may create significant network and CPU overhead.
    # We encourage you NOT to change this parameter unless you know what you are doing.
    tick_period_ms: 100

编写启动文件

vi qdrant01_start.sh
#!/bin/bash

nohup docker run -p 6333:6333 -p 6335:6335 -v $(pwd)/path/to/data:/qdrant/storage -v $(pwd)/path/to/config_001.yaml:/qdrant/config/production.yaml qdrant/qdrant ./qdrant --uri 'http://10.10.10.1:6335' &

#映射数据目录和配置文件
#$(pwd)/path/to/data -- /qdrant/storage   数据目录
#$(pwd)/path/to/config_001.yaml:/qdrant/config/production.yaml   配置文件production.yaml为配置覆盖文件

–uri 注册第一个启动节点,----bootstrap 添加其他节点到主节点,官网都有接受。
第一个节点启动成功后可以查看状态

curl GET 'http://10.10.10.1:6333/cluster' --header 'Content-Type: application/json'

{"result":{"status":"enabled","peer_id":4393184929800590349,"peers":{"4393184929800590349":{"uri":"http://10.10.10.1:6335/"}},"raft_info":{"term":2,"commit":6,"pending_operations":0,"leader":4393184929800590349,"role":"Leader","is_voter":true},"consensus_thread_status":{"consensus_thread_status":"working","last_update":"2023-04-20T09:07:34.062335053Z"},"message_send_failures":{}},"status":"ok","time":9.78e-6}

可看到集群信息成功

4 第二台操作
步骤雷同,只有部分命令和文件名需要调整,直接写操作
目录准备

mkdir /qdrant
cd /qdrant
mkdir -p $(pwd)/path/to/

配置文件准备

vi $(pwd)/path/to/config_002.yaml
cluster:
  # Use `enabled: true` to run Qdrant in distributed deployment mode
  enabled: true
  # Configuration of the inter-cluster communication
  p2p:
    # Port for internal communication between peers
    port: 6335

  # Configuration related to distributed consensus algorithm
  consensus:
    # How frequently peers should ping each other.
    # Setting this parameter to lower value will allow consensus
    # to detect disconnected node earlier, but too frequent
    # tick period may create significant network and CPU overhead.
    # We encourage you NOT to change this parameter unless you know what you are doing.
    tick_period_ms: 100

启动文件准备

vi qdrant02_start.sh
#!/bin/bash

nohup docker run -p 6333:6333 -p 6335:6335 -v $(pwd)/path/to/data:/qdrant/storage -v $(pwd)/path/to/config_002.yaml:/qdrant/config/production.yaml qdrant/qdrant ./qdrant --bootstrap 'http://10.10.10.1:6335' &

这里为–bootstrap ‘http://10.10.10.1:6335’ ,注册到第一个节点,就是主节点

  1. 第3台操作
    与第二台基本一样
    步骤雷同,只有部分命令和文件名需要调整,直接写操作
    目录准备
mkdir /qdrant
cd /qdrant
mkdir -p $(pwd)/path/to/

配置文件准备

vi $(pwd)/path/to/config_003.yaml
cluster:
  # Use `enabled: true` to run Qdrant in distributed deployment mode
  enabled: true
  # Configuration of the inter-cluster communication
  p2p:
    # Port for internal communication between peers
    port: 6335

  # Configuration related to distributed consensus algorithm
  consensus:
    # How frequently peers should ping each other.
    # Setting this parameter to lower value will allow consensus
    # to detect disconnected node earlier, but too frequent
    # tick period may create significant network and CPU overhead.
    # We encourage you NOT to change this parameter unless you know what you are doing.
    tick_period_ms: 100

启动文件准备

vi qdrant02_start.sh
#!/bin/bash

nohup docker run -p 6333:6333 -p 6335:6335 -v $(pwd)/path/to/data:/qdrant/storage -v $(pwd)/path/to/config_003.yaml:/qdrant/config/production.yaml qdrant/qdrant ./qdrant --bootstrap 'http://10.10.10.1:6335' &

这里为–bootstrap ‘http://10.10.10.1:6335’ ,注册到第一个节点,就是主节点

最后查看集群信息

curl GET 'http://10.10.10.1:6333/cluster' --header 'Content-Type: application/json'

{"result":{"status":"enabled","peer_id":4393184929800590349,"peers":{"4393184929800590349":{"uri":"http://10.10.10.1:6335/"},"16109703143349695036":{"uri":"http://10.10.10.2:6335/"},"1298605932473601859":{"uri":"http://10.10.10.3:6335/"}},"raft_info":{"term":2,"commit":6,"pending_operations":0,"leader":4393184929800590349,"role":"Leader","is_voter":true},"consensus_thread_status":{"consensus_thread_status":"working","last_update":"2023-04-20T09:07:34.062335053Z"},"message_send_failures":{}},"status":"ok","time":9.78e-6}

可以看到目前集群状态正常 一共三个节点

源码安装与刀客类似 ,只是在安装单节点时候按照官网源码方式安装,后面改配置文件即可,
在创建集合时候可以指定分片数量和副本数量

PUT /collections/{collection_name}

{
    "vectors": {
      "size": 300,
      "distance": "Cosine"
    },
    "shard_number": 6,
    "replication_factor": 2,
}

shard_number为分片数量,replication_factor为副本数量,三节点建议分片为6,副本为2

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值