Coder Social home page Coder Social logo

Comments (8)

xiaofan-luan avatar xiaofan-luan commented on July 28, 2024

https://milvus.io/docs/quickstart.md

We have the document here. but we'd better give directly code example on how to connect with cluster with SSL and how to set username password.

from milvus-docs.

nchanmala avatar nchanmala commented on July 28, 2024

Added token=username:password to below script example:
from pymilvus import connections

_HOST = '127.0.0.1'
_PORT = '19530'

print(f"\nCreate connection...")
connections.connect(host=_HOST, port=_PORT, token="username:password" secure=True, client_pem_path="cert/client.pem",
client_key_path="cert/client.key",
ca_pem_path="cert/ca.pem", server_name="localhost")
print(f"\nList connections:")
print(connections.list_connections())

Otherwise, you will get error below:

Create connection...
grpc RpcError: [__internal_register], <_InactiveRpcError: StatusCode.UNAUTHENTICATED, missing authorization in header>, <Time:{'RPC start': '2024-04-16 13:48:28.405191', 'gRPC error': '2024-04-16 13:48:28.407480'}>
Traceback (most recent call last):
File "/opt/tools/ssl1.py", line 8, in
connections.connect(host=_HOST, port=_PORT, secure=True, server_pem_path="/opt/tools/configs/cert/server.pem", server_name=“hostname.domain”)
File "/usr/local/lib/python3.9/site-packages/pymilvus/orm/connections.py", line 420, in connect
connect_milvus(**kwargs, user=user, password=password, token=token, db_name=db_name)
File "/usr/local/lib/python3.9/site-packages/pymilvus/orm/connections.py", line 371, in connect_milvus
gh._wait_for_channel_ready(timeout=timeout)
File "/usr/local/lib/python3.9/site-packages/pymilvus/client/grpc_handler.py", line 151, in _wait_for_channel_ready
raise e from e
File "/usr/local/lib/python3.9/site-packages/pymilvus/client/grpc_handler.py", line 144, in _wait_for_channel_ready
self._setup_identifier_interceptor(self._user, timeout=timeout)
File "/usr/local/lib/python3.9/site-packages/pymilvus/client/grpc_handler.py", line 262, in _setup_identifier_interceptor
self._identifier = self.__internal_register(user, host, timeout=timeout)
File "/usr/local/lib/python3.9/site-packages/pymilvus/decorators.py", line 161, in handler
raise e from e
File "/usr/local/lib/python3.9/site-packages/pymilvus/decorators.py", line 143, in handler
return func(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/pymilvus/decorators.py", line 182, in handler
return func(self, *args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/pymilvus/decorators.py", line 91, in handler
raise e from e
File "/usr/local/lib/python3.9/site-packages/pymilvus/decorators.py", line 87, in handler
return func(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/pymilvus/decorators.py", line 220, in handler
raise e from e
File "/usr/local/lib/python3.9/site-packages/pymilvus/decorators.py", line 212, in handler
return func(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/pymilvus/client/grpc_handler.py", line 1935, in __internal_register
response = self._stub.Connect(request=req)
File "/usr/local/lib64/python3.9/site-packages/grpc/_interceptor.py", line 277, in call
response, ignored_call = self._with_call(
File "/usr/local/lib64/python3.9/site-packages/grpc/_interceptor.py", line 332, in _with_call
return call.result(), call
File "/usr/local/lib64/python3.9/site-packages/grpc/_channel.py", line 437, in result
raise self
File "/usr/local/lib64/python3.9/site-packages/grpc/_interceptor.py", line 315, in continuation
response, call = self._thunk(new_method).with_call(
File "/usr/local/lib64/python3.9/site-packages/grpc/_channel.py", line 1177, in with_call
return _end_unary_response_blocking(state, call, True, None)
File "/usr/local/lib64/python3.9/site-packages/grpc/_channel.py", line 1003, in _end_unary_response_blocking
raise _InactiveRpcError(state) # pytype: disable=not-instantiable
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNAUTHENTICATED
details = "missing authorization in header"
debug_error_string = "UNKNOWN:Error received from peer {created_time:"2024-04-16T13:48:28.406502408-04:00", grpc_status:16, grpc_message:"missing authorization in header"}"

from milvus-docs.

xiaofan-luan avatar xiaofan-luan commented on July 28, 2024

yes the main reason is you enabled authentication in server side.
that requires "token="username:password""

from milvus-docs.

xiaofan-luan avatar xiaofan-luan commented on July 28, 2024
image

from milvus-docs.

xiaofan-luan avatar xiaofan-luan commented on July 28, 2024

we will give more example about it.

from milvus-docs.

nchanmala avatar nchanmala commented on July 28, 2024

I was trying to share what I ran into: your example script on https://milvus.io/docs/tls.md does not have token in the script.
from pymilvus import connections

_HOST = '127.0.0.1'
_PORT = '19530'

print(f"\nCreate connection...")
connections.connect(host=_HOST, port=_PORT, secure=True, client_pem_path="cert/client.pem",
client_key_path="cert/client.key",
ca_pem_path="cert/ca.pem", server_name="localhost")
print(f"\nList connections:")
print(connections.list_connections())

from milvus-docs.

xiaofan-luan avatar xiaofan-luan commented on July 28, 2024

yeh I agreed. because tls and authentication are two different features, but we can improve

from milvus-docs.

nchanmala avatar nchanmala commented on July 28, 2024

yeh I agreed. because tls and authentication are two different features, but we can improve

thanks !! Awesome!!

from milvus-docs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.