【Milvus】Milvus 的图形用户界面:Attu

本文时对 Attu(Milvus 的图形用户界面)的详细介绍。从零开始,聚焦 Attu 的功能、安装、配置、使用方法、适用场景和注意事项。


1. Attu 概述

Attu 是由 Zilliz 开发并开源的 Milvus 图形用户界面(GUI) 工具,专为管理 Milvus 向量数据库设计。它提供直观的界面,简化数据库操作,降低运维成本。Attu 支持 Milvus 2.x 版本(包括 Milvus 2.5.10),适用于本地部署(Milvus Standalone)、Kubernetes 集群(Milvus Distributed)以及 Zilliz Cloud。以下是 Attu 的核心特点:

  • 直观界面:通过图形化操作管理数据库、集合、分区、向量索引等,减少命令行操作的复杂性。
  • 多功能支持:支持数据导入、查询、向量搜索、系统监控等,适合开发者和运维人员。
  • 开源项目:托管于 GitHub(zilliztech/attu),支持社区贡献和插件开发。
  • 跨平台:提供 Docker、桌面应用(Windows、Mac、Linux)和 Kubernetes Helm 部署方式。
  • 快速迭代:每周更新,持续添加新功能(如集群统计、用户角色管理等)。

2. Attu 的核心功能

Attu 通过以下功能简化 Milvus 的管理与操作:

2.1 数据库与集合管理

  • 数据库管理:查看、创建和删除数据库,显示数据库列表及其详细信息。
  • 集合管理
    • 创建、加载、释放和删除集合。
    • 查看集合 Schema(字段、向量维度、索引类型等)。
    • 支持动态 Schema,管理未预定义的字段(存储在 $meta 中)。
  • 分区管理:创建、查看和删除分区,管理数据分片。

2.2 数据操作

  • 数据导入
    • 通过 GUI 上传 JSON 或 CSV 文件,批量导入数据。
    • 支持向指定集合或分区插入向量和标量数据。
  • 数据查询
    • 使用过滤条件(如 id != 0color > 10 && color < 20)查询数据。
    • 支持动态字段过滤,查看导入的实体(ID、向量、元数据等)。
  • 数据删除
    • 选择实体并通过 GUI 删除,支持批量操作。
  • 批量操作
    • 执行 CRUD(创建、读取、更新、删除)操作,无需编写脚本。

2.3 向量搜索

  • 向量搜索界面
    • 输入查询向量(如从 CSV 文件复制),选择集合和字段,执行相似性搜索。
    • 支持多种度量(如 IP 内积、L2 欧氏距离)。
    • 显示搜索结果,包括实体 ID、相似性得分和动态字段。
  • 可视化
    • 生成随机测试查询,快速验证搜索结果。
    • 表格形式展示结果,便于分析数据关系。

2.4 索引管理

  • 创建索引
    • 一键创建向量索引(如 HNSWIVF_FLAT),配置参数(如 MefConstruction)。
  • 查看索引
    • 显示索引类型、参数和构建状态。

2.5 系统监控

  • 系统拓扑(System View)
    • 显示 Milvus 实例的拓扑结构,包括协调节点(Coordinator)和数据节点。
    • 点击节点查看详细信息(如 CPU、内存、磁盘使用情况),每 10 秒动态刷新。
    • 支持按指标排序(如 CPU 使用率),便于排查高负载节点。
  • 集群统计
    • 查看加载的集合数量、总实体数等(部分功能在 v2.5.x 中标记为 TBD,待开发)。
  • 依赖状态
    • 监控元存储(etcd)、消息队列和对象存储的状态。

2.6 用户与权限管理

  • 用户管理
    • 创建、删除用户,分配角色。
  • 角色管理
    • 配置权限,控制对集合、数据的访问。
  • 适用场景
    • 企业级应用中管理多用户访问权限。

2.7 插件系统

  • 可扩展性
    • Vector Search 和 System View 页面为插件,支持用户开发自定义插件。
    • 插件代码存储在 plugins 目录,参考现有插件即可开发。
  • 配置
    • 通过配置文件添加插件,扩展 Attu 功能。

3. 安装 Attu

Attu 支持多种安装方式,以下基于 Milvus 2.5.10 和文档(,)详细说明。

3.1 使用 Docker 安装

  • 步骤
    1. 确保 Milvus 2.x 已运行(默认端口 19530)。
    2. 运行 Attu 容器:
      docker run -p 8000:3000 \
        -e HOST_URL=http://{attu_ip}:8000 \
        -e MILVUS_URL={milvus_ip}:19530 \
        zilliz/attu:v2.5
      
    3. 打开浏览器,访问 http://{attu_ip}:8000
  • 注意
    • 确保 Attu 容器可访问 Milvus 的 IP 地址。
    • 可通过 -e ATTU_LOG_LEVEL=info 设置日志级别。
    • 支持 TLS 配置,需挂载证书文件(如 -v /your-tls-file-path:/app/tls)。

3.2 使用 Helm Chart 安装(Kubernetes)

  • 步骤
    1. 添加 Milvus Helm 仓库:
      helm repo add milvus https://milvus-io.github.io/milvus-helm/
      helm repo update
      
    2. 安装 Milvus 和 Attu:
      helm install my-release milvus/milvus --set attu.enabled=true
      
    3. 检查 Attu 服务:
      kubectl get svc my-release-milvus-attu
      
    4. 配置 Ingress 或端口转发:
      kubectl port-forward service/my-release-milvus-attu 3000
      
      访问 http://localhost:3000/connect
  • 服务模式
    • ClusterIP(默认):内部访问。
    • Ingress:推荐生产环境,需配置 DNS(如 milvus-attu.local)。
    • LoadBalancer:云环境外部访问。
    • NodePort:测试环境。
  • 注意
    • 确保 Kubernetes 集群已集成 Ingress 控制器或 LoadBalancer。
    • Attu 仅支持 Milvus 2.x。

3.3 使用桌面应用安装

  • 步骤
    1. 访问 GitHub Releases 页面(https://github.com/zilliztech/attu/releases),下载适合操作系统的安装包(Windows、Mac、Linux)。
    2. 安装并运行 Attu。
    3. 输入 Milvus 地址(如 http://localhost:19530)连接。
  • Mac M 芯片注意
    • 若提示 attu.app is damaged,运行:
      sudo xattr -rd com.apple.quarantine /Applications/attu.app
      
  • 局限性
    • 部分 Zilliz Cloud 功能可能不支持。

3.4 本地构建(开发者)

  • 步骤
    1. 克隆 Attu 仓库:
      git clone https://github.com/zilliztech/attu.git
      
    2. 安装服务端依赖:
      cd server
      yarn install
      yarn start
      
    3. 安装客户端依赖:
      cd client
      yarn install
      yarn start
      
    4. 访问 http://localhost:3000
  • 用途
    • 测试最新功能、贡献代码或调试 PR。

4. 配置 Attu

连接 Milvus 后,需配置以下参数:

  • Milvus 地址
    • 格式:http://{milvus_ip}:19530(Standalone)或 Zilliz Cloud 的 URI。
    • 示例:http://localhost:19530
  • 认证
    • 默认用户名:root,密码:Milvus(可通过 COMMON_SECURITY_DEFAULTROOTPASSWORD 修改)。
    • 支持 token 认证(Zilliz Cloud)。
  • 可选设置
    • 一致性级别(StrongSessionBoundedEventually)。
    • TLS 证书路径(若启用安全连接)。
  • 界面导航
    • Overview:显示加载的集合、实体总数。
    • Collection:列出所有集合,管理 Schema 和分区。
    • Vector Search:执行向量相似性搜索。
    • System View:监控系统拓扑和节点状态。

5. 使用 Attu:示例流程

以下是以 Milvus 2.5.10 为例,使用 Attu 管理向量数据库的典型流程(基于,)。

5.1 创建集合

  1. 登录 Attu,连接 Milvus(http://localhost:19530)。
  2. Collection 页面,点击 Create Collection
  3. 配置 Schema:
    • 字段:idInt64,主键)、vectorFloatVector,维度 384,IP 度量)。
    • 启用 enable_dynamic_field=True
  4. 创建集合 demo_collection

5.2 导入数据

  1. 点击集合 demo_collection,进入 Data Query 标签。
  2. 点击 Import Data,上传 CSV 文件(如 example_vectors.csv)。
  3. 验证导入:
    • 设置过滤条件(如 id != 0),点击 Apply FilterQuery
    • 查看实体列表,包括 ID、向量和动态字段。

5.3 执行向量搜索

  1. 进入 Vector Search 页面。
  2. 复制查询向量(从 CSV 或点击 Generate Random Data)。
  3. 选择集合 demo_collection 和字段 vector,点击 Search
  4. 查看结果:表格显示 ID、相似性得分和元数据。

5.4 监控系统

  1. 进入 System View 页面。
  2. 查看拓扑图,点击节点检查 CPU、内存等指标。
  3. 按需排序节点,定位高负载节点。

6. 代码示例:结合 Attu 和 Milvus

以下示例展示如何通过 Python 创建集合并使用 Attu 进行管理(基于)。

from pymilvus import MilvusClient
import numpy as np

# 连接 Milvus
client = MilvusClient(uri="http://localhost:19530")

# 创建集合
collection_name = "attu_tutorial"
if client.has_collection(collection_name):
    client.drop_collection(collection_name)

client.create_collection(
    collection_name=collection_name,
    dimension=384,
    metric_type="IP",
    consistency_level="Strong",
    enable_dynamic_field=True
)

# 插入数据
docs = [
    "Artificial intelligence was founded in 1956.",
    "Alan Turing was the first to research AI.",
    "Turing was born in London."
]
vectors = [np.random.rand(384).astype(np.float32) for _ in range(len(docs))]
data = [{"id": i, "vector": vec, "text": doc} for i, (vec, doc) in enumerate(zip(vectors, docs))]
client.insert(collection_name=collection_name, data=data)

# 创建索引
client.create_index(
    collection_name=collection_name,
    field_name="vector",
    index_params={"index_type": "HNSW", "metric_type": "IP", "params": {"M": 16, "efConstruction": 200}}
)

# 加载集合
client.load_collection(collection_name=collection_name)

print(f"Collection {collection_name} created and loaded with {len(data)} entities.")

使用 Attu 操作

  1. 打开 Attu(http://localhost:8000),连接 Milvus。
  2. Collection 页面查看 attu_tutorial,确认 Schema(id: Int64, vector: FloatVector(384), 动态字段 text)。
  3. Data Query 标签,查询数据(过滤 id >= 0),查看 3 条实体。
  4. Vector Search 页面,输入随机向量(384 维),执行搜索,查看相似性结果。

7. 适用场景

Attu 在以下场景中表现优异:

  • 开发与调试
    • 快速创建集合、导入数据、验证向量搜索,适合算法开发。
  • 运维管理
    • 监控 Milvus 集群状态,排查性能瓶颈。
  • 数据探索
    • 可视化向量数据和 Schema,分析数据关系,适用于 RAG、推荐系统。
  • 多用户环境
    • 配置用户和角色,管理企业级权限。
  • 跨平台部署
    • 支持本地、云端(Zilliz Cloud)和 Kubernetes,适应不同架构。

8. 注意事项

  • 版本兼容性
    • Attu 仅支持 Milvus 2.x(2.5.10 需 Attu v2.3.1 或更高,)。
    • 部分功能在 Zilliz Cloud 上可能受限。
  • 依赖要求
    • 确保 Milvus 服务可访问(默认 19530 端口)。
    • Docker 部署需正确映射端口(8000:3000)。
  • 性能考虑
    • 大规模数据导入建议分批操作,避免 GUI 卡顿。
    • System View 刷新频率(10 秒)可能影响实时性。
  • 局限性
    • 部分功能(如集群统计)在 v2.5.x 中未完全实现(标记为 TBD,)。
    • Milvus Lite 不支持用户和角色管理,Attu 相关功能可能失效()。
  • 错误排查
    • 连接失败:检查 Milvus IP、端口和防火墙。
    • Mac 安装问题:参考 xattr 命令()。
    • 提交 GitHub Issue(zilliztech/attu)获取社区支持。

9. Attu vs. 其他工具

Milvus 还提供其他管理工具,以下是与 Attu 的对比(基于,):

工具类型特点适用场景
AttuGUI直观界面,支持集合管理、向量搜索、系统监控,插件化扩展开发、运维、数据探索
Milvus Web UI内置 GUI专注于系统观测,显示组件统计、依赖状态,界面简单系统监控、配置检查
Birdwatcher调试工具连接 etcd,检查系统状态,支持动态配置,命令行操作高级调试、配置调整
Milvus CLI命令行简单直接,支持数据导入导出、向量距离计算,适合脚本自动化批量操作、自动化任务

Attu 的优势:综合性强,适合非命令行用户,GUI 降低学习曲线。


10. 总结

Attu 是 Milvus 2.5.10 的高效开源 GUI 工具,通过直观界面简化数据库管理、数据操作、向量搜索和系统监控。它支持 Docker、Helm 和桌面应用部署,适用于本地和云端环境。核心功能包括集合管理、数据导入查询、向量搜索、索引创建和系统拓扑监控,特别适合开发、运维和数据探索场景。Attu 的插件系统和社区支持使其具有良好扩展性。

### Milvus ATTU Configuration and Usage Milvus, as an advanced vector database system, supports various configurations to optimize performance based on specific use cases. The term ATTU is not directly mentioned within the provided references; however, assuming ATTU refers to a particular aspect of configuring or using Milvus such as Authentication, Authorization, Tenant management, and User management (ATTU), here’s how these aspects can be addressed. #### Authentication and Authorization For secure access control over data stored in Milvus, implementing robust authentication mechanisms ensures only authorized users interact with the service. This involves setting up credentials that validate user identity before granting permission levels according to predefined policies[^1]. ```bash # Example command to enable root account login via CLI milvusctl admin create-user --password=your_password ``` Once authenticated, authorization rules define what actions each role can perform within the environment. Roles like `admin`, `user` have distinct permissions affecting their ability to manage collections, insert vectors, etc. #### Tenant Management Tenant isolation allows multiple groups or departments inside organizations to operate independently while sharing underlying resources efficiently without interfering with one another's operations. In environments where multi-tenancy support exists, administrators configure separate namespaces for different tenants ensuring logical separation between them[^3]. ```json { "tenant": { "name": "example_tenant", "description": "Example tenant description" } } ``` This setup facilitates better resource allocation across teams working concurrently but requiring isolated workspaces. #### User Management Managing individual accounts includes creating new ones, modifying existing details, resetting passwords, deleting inactive profiles, assigning roles, and monitoring activity logs. Effective user administration practices contribute significantly towards maintaining security standards throughout the platform lifecycle. ```sql -- SQL-like syntax used by some interfaces for managing users CREATE USER 'new_user'@'localhost' IDENTIFIED BY 'secure_password'; GRANT ALL PRIVILEGES ON *.* TO 'new_user'@'localhost'; FLUSH PRIVILEGES; ``` In summary, proper configuration around Authentication, Authorization, Tenants, and Users enhances both operational efficiency and overall safety when deploying solutions built upon Milvus infrastructure. --related questions-- 1. How does integrating HuggingFace models impact Milvus performance? 2. What are best practices for securing a Milvus deployment against unauthorized access? 3. Can you provide examples of real-world applications leveraging Agentic RAG through LlamaIndex? 4. Are there any notable differences between Milvus versions concerning ATTU features?
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

彬彬侠

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值