当前位置: 首页 > news >正文

milvus创建一个用户管理多个库

 

1.创建用户

export CLUSTER_ENDPOINT="http://localhost:19530"
export TOKEN="root:Milvus"curl --request POST \
--url "${CLUSTER_ENDPOINT}/v2/vectordb/users/create" \
--header "Authorization: Bearer ${TOKEN}" \
--header "Content-Type: application/json" \
-d '{"userName": "hxl","password": "hxl123456"
}'

 

2.创建角色

export CLUSTER_ENDPOINT="http://localhost:19530"
export TOKEN="root:Milvus"
curl --request POST \
--url "${CLUSTER_ENDPOINT}/v2/vectordb/roles/create" \
--header "Authorization: Bearer ${TOKEN}" \
--header "Content-Type: application/json" \
-d '{"roleName": "role_bigdata"
}'

 

3.角色赋予权限组

库1 CollectionAdmin

export CLUSTER_ENDPOINT="http://localhost:19530"
export TOKEN="root:Milvus"
curl --request POST \
--url "${CLUSTER_ENDPOINT}/v2/vectordb/roles/grant_privilege_v2" \
--header "Authorization: Bearer ${TOKEN}" \
--header "Content-Type: application/json" \
-d '{"roleName": "role_bigdata","privilege": "CollectionAdmin","collectionName": "*","dbName":"db_test01"
}'

 

库2 CollectionAdmin

curl --request POST \
--url "${CLUSTER_ENDPOINT}/v2/vectordb/roles/grant_privilege_v2" \
--header "Authorization: Bearer ${TOKEN}" \
--header "Content-Type: application/json" \
-d '{"roleName": "role_bigdata","privilege": "CollectionAdmin","collectionName": "*","dbName":"db_test02"
}'

 

库1 DatabaseAdmin

export CLUSTER_ENDPOINT="http://localhost:19530"
export TOKEN="root:Milvus"
curl --request POST \
--url "${CLUSTER_ENDPOINT}/v2/vectordb/roles/grant_privilege_v2" \
--header "Authorization: Bearer ${TOKEN}" \
--header "Content-Type: application/json" \
-d '{"roleName": "role_bigdata","privilege": "DatabaseAdmin","collectionName": "*","dbName":"db_test01"
}'

 

库2 DatabaseAdmin

curl --request POST \
--url "${CLUSTER_ENDPOINT}/v2/vectordb/roles/grant_privilege_v2" \
--header "Authorization: Bearer ${TOKEN}" \
--header "Content-Type: application/json" \
-d '{"roleName": "role_bigdata","privilege": "DatabaseAdmin","collectionName": "*","dbName":"db_test02"
}'

 

集群只读权限

ClusterReadOnly

curl --request POST \
--url "${CLUSTER_ENDPOINT}/v2/vectordb/roles/grant_privilege_v2" \
--header "Authorization: Bearer ${TOKEN}" \
--header "Content-Type: application/json" \
-d '{"roleName": "role_bigdata","privilege": "ClusterReadOnly","collectionName": "*","dbName":"*"
}'

 

4.查看role具有那些权限

curl --request POST \
--url "${CLUSTER_ENDPOINT}/v2/vectordb/roles/describe" \
--header "Authorization: Bearer ${TOKEN}" \
--header "Content-Type: application/json" \
-d '{"roleName": "role_bigdata"
}'

 

这里没有列出具体到那个库的权限

[root@localhost milvus]# curl --request POST \
> --url "${CLUSTER_ENDPOINT}/v2/vectordb/roles/describe" \
> --header "Authorization: Bearer ${TOKEN}" \
> --header "Content-Type: application/json" \
> -d '{
>     "roleName": "role_bigdata"
> }'
{"code":0,"data":[{"dbName":"*","grantor":"root","objectName":"*","objectType":"Global","privilege":"ClusterReadOnly"}]} 

 

4.角色赋予用户

export CLUSTER_ENDPOINT="http://localhost:19530"
export TOKEN="root:Milvus"curl --request POST \
--url "${CLUSTER_ENDPOINT}/v2/vectordb/users/grant_role" \
--header "Authorization: Bearer ${TOKEN}" \
--header "Content-Type: application/json" \
-d '{"roleName": "role_bigdata","userName": "hxl"
}'

 

http://www.wxhsa.cn/company.asp?id=6414

相关文章:

  • 为什么ceph新添加的硬盘会自动变为osd
  • Zabbix Proxy 技术实践与运维思考
  • OF SF CF ZF 的判断方式以及例子
  • 2025年30个CRM系统盘点:哪款CRM系统适合你的企业? - SaaS软件
  • TSN Qav测试实践
  • adobe illustrator中生成连续直角线段
  • 多重分形去趋势交叉相关性分析
  • 智启燃气新未来丨众智鸿图精彩亮相2025燃气运营与安全研讨会 - 教程
  • 燕千云ITR平台引领服务流管理革命,构建企业客户服务智慧生态
  • WPF 容器尺寸行为总结
  • 在adobe illustrator中如何插入大于、小于号
  • 三分钟了解流量卡的选择
  • SARIMA算法
  • 【IEEE出版|EI检索稳定】第四届云计算、大数据应用与软件工程国际学术会议(CBASE 2025)
  • Gitee推出革命性MCP Server:AI深度参与开发全流程 开启智能协作新时代
  • 用机器语言实现循环
  • 取证 - voasem
  • django对接drf-spectacular替代swagger
  • 可画
  • Symbol VBRK: Invalid data type u SAP 事务成功新号码获取到 但是提交后提示失败如何处理
  • Oracle 19c asm单机OPatch补丁报错checkSystemCommandAvailable failed.
  • three.js中怎么加载 .gltf/glb格式 文件
  • ollama如何安装使用
  • 【SPIE独立出版|连续多年EI稳定检索】第七届地球科学与遥感测绘国际学术会议(GRSM 2025)
  • 手把手教你实现C++高性能内存池,相比 malloc 性能提升7倍!
  • LDPC 码 BP 算法性能研究
  • 内外网文件传输方式有哪些:从传统方案到专业系统的全面解析!
  • 实用指南:DeerFlow 实践:华为IPD流程的评审智能体设计
  • py之补环境代理脚本
  • Python psutil模块