首页 > 解决方案 > 远程python客户端无法访问couchbase服务器

问题描述

我有一个在 linode 上运行的 couchbase 6.0 服务器,我正在使用 python SDK 将数据插入到我的 couchbase 存储桶中。当直接在 Linode 服务器上运行时,我的数据被插入。但是,当我从远程机器运行我的代码时,出现网络错误:

CouchbaseNetworkError, CouchbaseTransientError): <RC=0x2C[The remote host refused the connection.

我在 linode 上打开了 8091、8092、8093、8094 端口。

from couchbase.cluster import Cluster
from couchbase.cluster import PasswordAuthenticator

# linode ip: 1.2.3.4
cluster = Cluster('couchbase://1.2.3.4:8094')
cluster.authenticate(PasswordAuthenticator('admin', 'password'))
bucket = cluster.open_bucket('test_bucket')
bucket.upsert('1',{"foo":"bar"})

我的代码在服务器上运行couchbase://localhost时执行,但从远程计算机运行时失败。我缺少任何端口或配置吗?

标签: pythonpython-3.xnetworkingcouchbase

解决方案


客户端到节点:在任何客户端/应用程序服务器/SDK 和它们需要访问的每个集群的所有节点之间。

未加密*:8091-8096、11210、11211

加密:18091-18096†††,11207

使用端口 11210 和 11211 对我有用。资源


推荐阅读