First Case:
-------------------------------------------------------------------------------
My Local Machine:
OS Name: Microsoft Windows Server 2012 Datacenter
OS Version: 6.2.9200 N/A Build 9200
OS Manufacturer: Microsoft Corporation
OS Configuration: Standalone Server
Using:
Python 3.8.10 (tags/v3.8.10:3d8993a, May 3 2021, 11:48:03) [MSC v.1928 64 bit
-------------------------------------------------------------------------------
Running the example code from:
https://docs.couchbase.com/python-sdk/current/hello-world/start-using-sdk.html#{version-server}@server:manage:manage-security/manage-users-and-roles.adoc
When i run python3 couch-py.py (the code from above link)
From my localhost usingâŚ
cluster = Cluster(âcouchbase://localhostâ, ClusterOptions(
PasswordAuthenticator(âAdministratorâ, âpasswordâ)))
I get the following:
Upsert CAS:
<Key=âairline_8091â, RC=0x407[LCB_ERR_KVENGINE_INVALID_PACKET (1031)], Operational Error, Results=1, C Source=(src/multiresult.c,332), Context={âstatus_codeâ: 4, âopaqueâ: 0, âcasâ: 0, âkeyâ: âairline_8091â, âbucketâ: âtravel-sampleâ, âcollectionâ: âairlineâ, âscopeâ: âinventoryâ, âcontextâ: âRequest must include keyâ, ârefâ: ââ, âendpointâ: âlocalhost:11210â, âtypeâ: âKVErrorContextâ}, Tracing Output={âairline_8091â: {âdebug_infoâ: {âFILEâ: âsrc/callbacks.câ, âFUNCâ: âdur_chain2â, âLINEâ: 743}}}>Get Result:
<Key=âairline_8091â, RC=0x407[LCB_ERR_KVENGINE_INVALID_PACKET (1031)], Operational Error, Results=1, C Source=(src/multiresult.c,332), Context={âstatus_codeâ: 4, âopaqueâ: 1, âcasâ: 0, âkeyâ: âairline_8091â, âbucketâ: âtravel-sampleâ, âcollectionâ: âairlineâ, âscopeâ: âinventoryâ, âcontextâ: âRequest must include keyâ, ârefâ: ââ, âendpointâ: âlocalhost:11210â, âtypeâ: âKVErrorContextâ}, Tracing Output={âairline_8091â: {âdebug_infoâ: {âFILEâ: âsrc/callbacks.câ, âFUNCâ: âvalue_callbackâ, âLINEâ: 848}}}>Lookup Result:
<RC=0x191[LCB_ERR_PLANNING_FAILURE (401)], HTTP Request failed. Examine âobjextraâ for full result, Results=1, C Source=(src/pycbc_http.c,203), OBJ=ViewResult<rc=0x191[LCB_ERR_PLANNING_FAILURE (401)], value={ârequestIDâ: â833b0154-d803-4f9a-bc81-95044421de85â, âclientContextIDâ: âc308bb5c9fcc1f65â, âerrorsâ: [{âcodeâ: 4000, âmsgâ: âNo index available on keyspacedefault
:travel-sample
.inventory
.airline
that matches your query. Use CREATE PRIMARY INDEX ONdefault
:travel-sample
.inventory
.airline
to create a primary index, or check that your expected index is online.â}], âstatusâ: âfatalâ}, http_status=0, tracing_context=0, tracing_output=None>, Context={âfirst_error_codeâ: 4000, âhttp_response_codeâ: 404, âfirst_error_messageâ: âNo index available on keyspacedefault
:travel-sample
.inventory
.airline
that matches your query. Use CREATE PRIMARY INDEX ONdefault
:travel-sample
.inventory
.airline
to create a primary index, or check that your expected index is online.â, âstatementâ: âSELECT VALUE name FROMtravel-sample
.inventory.airline WHERE callsign = $1â, âclient_context_idâ: âc308bb5c9fcc1f65â, âquery_paramsâ: ââ, âhttp_response_bodyâ: ââ, âendpointâ: âlocalhost:8093â, âtypeâ: âQueryErrorContextâ}, Tracing Output={":nokey:0": null}>
The results you should expect should be follows:
Upsert CAS:
1598469741559152640Get Result:
{âtypeâ: âairlineâ, âidâ: 8091, âcallsignâ: âCBSâ, âiataâ: None, âicaoâ: None, ânameâ: âCouchbase Airwaysâ}Lookup Result:
Couchbase Airways
Second Case:
-------------------------------------------------------------------------------
Outside Machine
OS Name: Microsoft Windows 10 Pro
OS Version: 10.0.19043 N/A Build 19043
OS Manufacturer: Microsoft Corporation
OS Configuration: Standalone Workstation
Using:
Python 3.7.8 (tags/v3.7.8:4b47a5b6ba, Jun 28 2020, 08:53:46) [MSC v.1916 64 bit (AMD64)]
-------------------------------------------------------------------------------
When i run python3 couch-py.py (same code from above link) from an outside machine
cluster = Cluster(âcouchbase://52.133.163.121â, ClusterOptions(
PasswordAuthenticator(âAdministratorâ, âpasswordâ)))
I get the following results:
Traceback (most recent call last):
File âC:\Users\blitz\Projects\Python\Couchbase\couch-py.pyâ, line 12, in
PasswordAuthenticator(âAdministratorâ, âpasswordâ)))
File âC:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\couchbase\cluster.pyâ, line 573, in init
**self._clusteropts
File âC:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\couchbase_core\client.pyâ, line 160, in init
self._do_ctor_connect()
File âC:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\couchbase\cluster.pyâ, line 597, in _do_ctor_connect
super(Cluster, self)._do_ctor_connect(*args, **kwargs)
File âC:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\couchbase_core\client.pyâ, line 169, in _do_ctor_connect
self._connect()
couchbase.exceptions.TimeoutException: <RC=0xC9[LCB_ERR_TIMEOUT (201)], There was a problem while trying to send/receive your request over the network. This may be a result of a bad network or a misconfigured client or server, C Source=(src/bucket.c,1229)>
What am I doing wrong? How do I connect from outside machine using python? (Is there a working example, like a getting started or a tutorial for python connectivity�