Couchbase 与 Azure Linux 虚拟机

Couchbase with Azure Linux VM

我在 Azure 上安装了 ubuntu 服务器 VM 我安装了 couchbase 社区版现在我需要使用 dotnet SDK 访问 couchbase 但代码显示 未找到或无法访问存储桶 错误。 即使我尝试配置 public dns 并在集群创建期间将其作为 ip 提供,但它仍然提供相同的信息。 甚至我在主机文件中添加了 public dns,如下所示 127.0.0.1 public DNS SDK 日志包括以下 2 个语句 尝试在端点“name.eastus.cloudapp.azure.com”上引导失败。 (e80489ed) 连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立连接失败,因为连接的主机没有响应。

SDK医生日志:

09:51:20.331 INFO ▶ Parsing connection string `couchbases://hsotname.eastus.cloudapp.azure.com/travel-sample`
09:51:20.334 INFO ▶ Connection string was parsed as a potential DNS SRV record
09:51:31.316 INFO ▶ Connection string specifies to use secured connections
09:51:31.316 INFO ▶ Connection string identifies the following CCCP endpoints:
09:51:31.316 INFO ▶   1. hsotname.eastus.cloudapp.azure.com:11207
09:51:31.316 INFO ▶ Connection string identifies the following HTTP endpoints:
09:51:31.316 INFO ▶   1. hsotname.eastus.cloudapp.azure.com:18091
09:51:31.316 INFO ▶ Connection string specifies bucket `travel-sample`
09:51:31.316 WARN ▶ No certificate authority file specified (--tls-ca), skipping server certificate verification for this run.
09:51:42.453 WARN ▶ Your connection string specifies only a single host.  You should consider adding additional static nodes from your cluster to this list to improve your applications fault-tolerance
09:51:42.462 INFO ▶ Performing DNS lookup for host `hsotname.eastus.cloudapp.azure.com`
09:51:42.462 INFO ▶ Bootstrap host `hsotname.eastus.cloudapp.azure.com` refers to a server with the address `13.82.80.55`
09:51:42.462 INFO ▶ Attempting to connect to cluster via CCCP
09:51:42.463 INFO ▶ Attempting to fetch config via cccp from `hsotname.eastus.cloudapp.azure.com:11207`
09:51:44.474 ERRO ▶ Failed to fetch configuration via cccp from `hsotname.eastus.cloudapp.azure.com:11207` (error: dial tcp 13.82.80.55:11207: i/o timeout)
09:51:44.474 INFO ▶ Attempting to connect to cluster via HTTP (Terse)
09:51:44.474 INFO ▶ Attempting to fetch terse config via http from `hsotname.eastus.cloudapp.azure.com:18091`
09:51:46.480 ERRO ▶ Failed to fetch terse configuration via http from `hsotname.eastus.cloudapp.azure.com:18091` (error: Get "http://hsotname.eastus.cloudapp.azure.com:18091/pools/default/b/travel-sample": context deadline exceeded (Client.Timeout exceeded while awaiting headers))
09:51:46.480 INFO ▶ Attempting to connect to cluster via HTTP (Full)
09:51:46.480 INFO ▶ Failed to connect via HTTP (Full), as it is not yet supported by the doctor
09:51:46.481 INFO ▶ Selected the following network type:
09:51:46.481 ERRO ▶ All endpoints specified by your connection string were unreachable, further cluster diagnostics are not possible
09:51:46.481 INFO ▶ Diagnostics completed

Summary:
←[33m[WARN]←[0m No certificate authority file specified (--tls-ca), skipping server certificate verification for this run.
←[33m[WARN]←[0m Your connection string specifies only a single host.  You should consider adding additional static nodes from your cluster to this list to improve your applications fault-tolerance
←[31m[ERRO]←[0m Failed to fetch configuration via cccp from `hsotname.eastus.cloudapp.azure.com:11207` (error: dial tcp 13.82.80.55:11207: i/o timeout)
←[31m[ERRO]←[0m Failed to fetch terse configuration via http from `hsotname.eastus.cloudapp.azure.com:18091` (error: Get "http://hsotname.eastus.cloudapp.azure.com:18091/pools/default/b/travel-sample": context deadline exceeded (Client.Timeout exceeded while awaiting headers))
←[31m[ERRO]←[0m All endpoints specified by your connection string were unreachable, further cluster diagnostics are not possible

Found multiple issues, see listing above.

我添加了 18091 和 11207 端口作为入站规则。 我的 ufw 状态不活跃 上面提到的2个端口没有监听

couchbaseadm@couchbasedbserver:~$ sudo lsof -i -P -n | grep LISTEN

systemd-r   926 systemd-resolve   13u  IPv4   18715      0t0  TCP 127.0.0.53:53 (LISTEN)
sshd       1103            root    3u  IPv4   21086      0t0  TCP *:22 (LISTEN)
sshd       1103            root    4u  IPv6   21088      0t0  TCP *:22 (LISTEN)
beam.smp   6323       couchbase   17u  IPv4 3937812      0t0  TCP 127.0.0.1:21200 (LISTEN)
epmd       6354       couchbase    3u  IPv4 3937267      0t0  TCP *:4369 (LISTEN)
epmd       6354       couchbase    4u  IPv6 3937268      0t0  TCP *:4369 (LISTEN)
beam.smp   6465       couchbase   34u  IPv4 3943391      0t0  TCP *:21100 (LISTEN)
beam.smp   6465       couchbase   48u  IPv4 3938657      0t0  TCP *:8091 (LISTEN)
beam.smp   6514       couchbase   17u  IPv4 3938608      0t0  TCP 127.0.0.1:21300 (LISTEN)
beam.smp   6514       couchbase   27u  IPv4 3938628      0t0  TCP *:8092 (LISTEN)
prometheu  6563       couchbase    9u  IPv4 3938650      0t0  TCP 127.0.0.1:9123 (LISTEN)
goxdcr     6583       couchbase   11u  IPv4 3938705      0t0  TCP 127.0.0.1:9998 (LISTEN)
memcached  6592       couchbase    5u  IPv4 3938689      0t0  TCP 127.0.0.1:11280 (LISTEN)
memcached  6592       couchbase   12u  IPv4 3937931      0t0  TCP *:11210 (LISTEN)
memcached  6592       couchbase   13u  IPv4 3937932      0t0  TCP *:11209 (LISTEN)
memcached  6592       couchbase   14u  IPv6 3937933      0t0  TCP *:11210 (LISTEN)
memcached  6592       couchbase   15u  IPv6 3937934      0t0  TCP *:11209 (LISTEN)
indexer    6741       couchbase   16u  IPv4 3944492      0t0  TCP *:9101 (LISTEN)
indexer    6741       couchbase   19u  IPv4 3944066      0t0  TCP *:9100 (LISTEN)
indexer    6741       couchbase   20u  IPv4 3944500      0t0  TCP *:9102 (LISTEN)
indexer    6741       couchbase   69u  IPv4 3946013      0t0  TCP *:9105 (LISTEN)
projector  6762       couchbase    9u  IPv4 3944075      0t0  TCP *:9999 (LISTEN)
cbq-engin  6782       couchbase    7u  IPv6 3944534      0t0  TCP *:8093 (LISTEN)
cbq-engin  6782       couchbase    8u  IPv4 3944535      0t0  TCP *:8093 (LISTEN)
cbft       6799       couchbase    8u  IPv4 3944112      0t0  TCP *:9130 (LISTEN)
cbft       6799       couchbase    9u  IPv4 3944149      0t0  TCP *:8094 (LISTEN)
sync_gate 11950    sync_gateway    8u  IPv4 4119414      0t0  TCP 127.0.0.1:4985 (LISTEN)
sync_gate 11950    sync_gateway    9u  IPv6 4119422      0t0  TCP *:4984 (LISTEN)

这是堆栈跟踪:

StackTrace " at Couchbase.Core.ClusterContext.d__58.MoveNext()\r\n
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n
at System.Threading.Tasks.ValueTask1.get_Result()\r\n at System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable1.ConfiguredValueTaskAwaiter.GetResult()\r\n
at Couchbase.Cluster.<>c__DisplayClass30_0.<b__0>d.MoveNext()\r\n
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n
at System.Threading.Tasks.ValueTask1.get_Result()\r\n at System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable1.ConfiguredValueTaskAwaiter.GetResult()\r\n

Dotnet SDK 日志

2022-02-09T17:28:46.3409884+05:30  [DBG] Waiting for 00:00:02.5000000 before polling. (c8639b24)
2022-02-09T17:28:48.8643285+05:30  [DBG] Done waiting, polling... (93018145)
2022-02-09T17:28:48.8649060+05:30  [DBG] Waiting for 00:00:02.5000000 before polling. (c8639b24)
2022-02-09T17:28:51.3664735+05:30  [DBG] Done waiting, polling... (93018145)
2022-02-09T17:28:51.3667541+05:30  [DBG] Waiting for 00:00:02.5000000 before polling. (c8639b24)
2022-02-09T17:28:53.8811651+05:30  [DBG] Done waiting, polling... (93018145)
2022-02-09T17:28:53.8814100+05:30  [DBG] Waiting for 00:00:02.5000000 before polling. (c8639b24)
2022-02-09T17:28:56.3823825+05:30  [DBG] Done waiting, polling... (93018145)
2022-02-09T17:28:56.3826183+05:30  [DBG] Waiting for 00:00:02.5000000 before polling. (c8639b24)
2022-02-09T17:28:58.8964320+05:30  [DBG] Done waiting, polling... (93018145)
2022-02-09T17:28:58.8967224+05:30  [DBG] Waiting for 00:00:02.5000000 before polling. (c8639b24)
2022-02-09T17:29:01.4007664+05:30  [DBG] Done waiting, polling... (93018145)
2022-02-09T17:29:01.4010274+05:30  [DBG] Waiting for 00:00:02.5000000 before polling. (c8639b24)
2022-02-09T17:29:01.7019750+05:30  [INF] Error trying to retrieve DNS SRV entries. (addddf06)
DnsClient.DnsResponseException: Query 12389 => _couchbases._tcp.hsotname.eastus.cloudapp.azure.com IN SRV on 192.168.8.1:53 timed out or is a transient error.
 ---> System.OperationCanceledException: The operation was canceled.
   at System.Threading.Tasks.TaskExtensions.WithCancellation[T](Task`1 task, CancellationToken cancellationToken, Action onCancel)
   at DnsClient.LookupClient.ResolveQueryAsync(IReadOnlyList`1 servers, DnsQuerySettings settings, DnsMessageHandler handler, DnsRequestMessage request, LookupClientAudit audit, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at DnsClient.LookupClient.ResolveQueryAsync(IReadOnlyList`1 servers, DnsQuerySettings settings, DnsMessageHandler handler, DnsRequestMessage request, LookupClientAudit audit, CancellationToken cancellationToken)
   at DnsClient.LookupClient.QueryInternalAsync(DnsQuestion question, DnsQuerySettings queryOptions, IReadOnlyCollection`1 servers, CancellationToken cancellationToken)
   at Couchbase.DnsClientDnsResolver.GetDnsSrvEntriesAsync(Uri bootstrapUri, CancellationToken cancellationToken)
   at Couchbase.Core.ClusterContext.BootstrapGlobalAsync()
2022-02-09T17:29:01.7034867+05:30  [DBG] Bootstrapping with node "hsotname.eastus.cloudapp.azure.com" (98ca0e33)
2022-02-09T17:29:03.9124149+05:30  [DBG] Done waiting, polling... (93018145)
2022-02-09T17:29:03.9127285+05:30  [DBG] Waiting for 00:00:02.5000000 before polling. (c8639b24)
2022-02-09T17:29:06.4201295+05:30  [DBG] Done waiting, polling... (93018145)
2022-02-09T17:29:06.4205385+05:30  [DBG] Waiting for 00:00:02.5000000 before polling. (c8639b24)
2022-02-09T17:29:08.9317820+05:30  [DBG] Done waiting, polling... (93018145)
2022-02-09T17:29:08.9320832+05:30  [DBG] Waiting for 00:00:02.5000000 before polling. (c8639b24)
2022-02-09T17:29:11.4459313+05:30  [DBG] Done waiting, polling... (93018145)
2022-02-09T17:29:11.4463142+05:30  [DBG] Waiting for 00:00:02.5000000 before polling. (c8639b24)
2022-02-09T17:29:12.1488979+05:30  [DBG] Attempted bootstrapping on endpoint "hsotname.eastus.cloudapp.azure.com" has failed. (e80489ed)
System.Net.Sockets.SocketException (10060): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
   at Couchbase.Core.IO.Connections.ConnectionFactory.CreateAndConnectAsync(HostEndpointWithPort hostEndpoint, CancellationToken cancellationToken)
   at Couchbase.Core.IO.Connections.ConnectionPoolBase.CreateConnectionAsync(CancellationToken cancellationToken)
   at Couchbase.Core.IO.Connections.DataFlow.DataFlowConnectionPool.<>c__DisplayClass30_0.<<AddConnectionsAsync>g__StartConnection|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Couchbase.Core.IO.Connections.DataFlow.DataFlowConnectionPool.AddConnectionsAsync(Int32 count, CancellationToken cancellationToken)
   at Couchbase.Core.IO.Connections.DataFlow.DataFlowConnectionPool.InitializeAsync(CancellationToken cancellationToken)
   at Couchbase.Core.ClusterNode.InitializeAsync()
   at Couchbase.Core.DI.ClusterNodeFactory.CreateAndConnectAsync(HostEndpointWithPort endPoint, BucketType bucketType, NodeAdapter nodeAdapter, CancellationToken cancellationToken)
   at Couchbase.Core.ClusterContext.BootstrapGlobalAsync()
2022-02-09T17:29:33.3259787+05:30  [DBG] Done waiting, polling... (93018145)
2022-02-09T17:29:33.3262710+05:30  [DBG] Waiting for 00:00:02.5000000 before polling. (c8639b24)
2022-02-09T17:29:35.8341848+05:30  [DBG] Done waiting, polling... (93018145)
2022-02-09T17:29:35.8343993+05:30  [DBG] Waiting for 00:00:02.5000000 before polling. (c8639b24)
2022-02-09T17:29:36.9552318+05:30  [DBG] Setting TCP Keep-Alives using SocketOptions - enable keep-alives True, time 00:01:00, interval 00:00:01. (d66a37aa)
2022-02-09T17:29:36.9596725+05:30  [DBG] Setting TCP Keep-Alives using SocketOptions - enable keep-alives True, time 00:01:00, interval 00:00:01. (d66a37aa)
2022-02-09T17:29:37.0170984+05:30  [INF] Cannot bootstrap bucket "travel-sample" as Couchbase. (1ecb21a9)
System.IO.IOException: The operation is not allowed on non-connected sockets.
   at System.Net.Sockets.NetworkStream..ctor(Socket socket, FileAccess access, Boolean ownsSocket)
   at Couchbase.Core.IO.Connections.ConnectionFactory.CreateAndConnectAsync(HostEndpointWithPort hostEndpoint, CancellationToken cancellationToken)
   at Couchbase.Core.IO.Connections.ConnectionPoolBase.CreateConnectionAsync(CancellationToken cancellationToken)
   at Couchbase.Core.IO.Connections.DataFlow.DataFlowConnectionPool.<>c__DisplayClass30_0.<<AddConnectionsAsync>g__StartConnection|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Couchbase.Core.IO.Connections.DataFlow.DataFlowConnectionPool.AddConnectionsAsync(Int32 count, CancellationToken cancellationToken)
   at Couchbase.Core.IO.Connections.DataFlow.DataFlowConnectionPool.InitializeAsync(CancellationToken cancellationToken)
   at Couchbase.Core.ClusterNode.InitializeAsync()
   at Couchbase.Core.DI.ClusterNodeFactory.CreateAndConnectAsync(HostEndpointWithPort endPoint, BucketType bucketType, NodeAdapter nodeAdapter, CancellationToken cancellationToken)
   at Couchbase.Core.ClusterContext.CreateAndBootStrapBucketAsync(String name, HostEndpointWithPort endpoint, BucketType type)
   at Couchbase.Core.ClusterContext.GetOrCreateBucketAsync(String name)
2022-02-09T17:29:38.3360012+05:30  [DBG] Done waiting, polling... (93018145)
2022-02-09T17:29:38.3361875+05:30  [DBG] Waiting for 00:00:02.5000000 before polling. (c8639b24)
2022-02-09T17:29:40.3244490+05:30  [DBG] Setting TCP Keep-Alives using SocketOptions - enable keep-alives True, time 00:01:00, interval 00:00:01. (d66a37aa)
2022-02-09T17:29:40.3507801+05:30  [DBG] Setting TCP Keep-Alives using SocketOptions - enable keep-alives True, time 00:01:00, interval 00:00:01. (d66a37aa)
2022-02-09T17:29:40.3525230+05:30  [INF] Cannot bootstrap bucket "travel-sample" as Memcached. (1ecb21a9)
System.IO.IOException: The operation is not allowed on non-connected sockets.
   at System.Net.Sockets.NetworkStream..ctor(Socket socket, FileAccess access, Boolean ownsSocket)
   at Couchbase.Core.IO.Connections.ConnectionFactory.CreateAndConnectAsync(HostEndpointWithPort hostEndpoint, CancellationToken cancellationToken)
   at Couchbase.Core.IO.Connections.ConnectionPoolBase.CreateConnectionAsync(CancellationToken cancellationToken)
   at Couchbase.Core.IO.Connections.DataFlow.DataFlowConnectionPool.<>c__DisplayClass30_0.<<AddConnectionsAsync>g__StartConnection|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Couchbase.Core.IO.Connections.DataFlow.DataFlowConnectionPool.AddConnectionsAsync(Int32 count, CancellationToken cancellationToken)
   at Couchbase.Core.IO.Connections.DataFlow.DataFlowConnectionPool.InitializeAsync(CancellationToken cancellationToken)
   at Couchbase.Core.ClusterNode.InitializeAsync()
   at Couchbase.Core.DI.ClusterNodeFactory.CreateAndConnectAsync(HostEndpointWithPort endPoint, BucketType bucketType, NodeAdapter nodeAdapter, CancellationToken cancellationToken)
   at Couchbase.Core.ClusterContext.CreateAndBootStrapBucketAsync(String name, HostEndpointWithPort endpoint, BucketType type)
   at Couchbase.Core.ClusterContext.GetOrCreateBucketAsync(String name)
2022-02-09T17:29:40.8385667+05:30  [DBG] Done waiting, polling... (93018145)
2022-02-09T17:29:40.8387609+05:30  [DBG] Waiting for 00:00:02.5000000 before polling. (c8639b24)
2022-02-09T17:29:43.3380840+05:30  [DBG] Done waiting, polling... (93018145)
2022-02-09T17:29:43.3382393+05:30  [DBG] Waiting for 00:00:02.5000000 before polling. (c8639b24)
2022-02-09T17:29:43.6633010+05:30  [DBG] Setting TCP Keep-Alives using SocketOptions - enable keep-alives True, time 00:01:00, interval 00:00:01. (d66a37aa)
2022-02-09T17:29:43.6842924+05:30  [DBG] Setting TCP Keep-Alives using SocketOptions - enable keep-alives True, time 00:01:00, interval 00:00:01. (d66a37aa)
2022-02-09T17:29:43.6862758+05:30  [INF] Cannot bootstrap bucket "travel-sample" as Ephemeral. (1ecb21a9)
System.IO.IOException: The operation is not allowed on non-connected sockets.
   at System.Net.Sockets.NetworkStream..ctor(Socket socket, FileAccess access, Boolean ownsSocket)
   at Couchbase.Core.IO.Connections.ConnectionFactory.CreateAndConnectAsync(HostEndpointWithPort hostEndpoint, CancellationToken cancellationToken)
   at Couchbase.Core.IO.Connections.ConnectionPoolBase.CreateConnectionAsync(CancellationToken cancellationToken)
   at Couchbase.Core.IO.Connections.DataFlow.DataFlowConnectionPool.<>c__DisplayClass30_0.<<AddConnectionsAsync>g__StartConnection|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Couchbase.Core.IO.Connections.DataFlow.DataFlowConnectionPool.AddConnectionsAsync(Int32 count, CancellationToken cancellationToken)
   at Couchbase.Core.IO.Connections.DataFlow.DataFlowConnectionPool.InitializeAsync(CancellationToken cancellationToken)
   at Couchbase.Core.ClusterNode.InitializeAsync()
   at Couchbase.Core.DI.ClusterNodeFactory.CreateAndConnectAsync(HostEndpointWithPort endPoint, BucketType bucketType, NodeAdapter nodeAdapter, CancellationToken cancellationToken)
   at Couchbase.Core.ClusterContext.CreateAndBootStrapBucketAsync(String name, HostEndpointWithPort endpoint, BucketType type)
   at Couchbase.Core.ClusterContext.GetOrCreateBucketAsync(String name)

谢谢!!

感谢您提供如此详细的信息!我怀疑眼前的问题是您正在尝试使用 TLS 进行连接,Couchbase Community Edition 不支持它(至少从 2022 年 2 月开始不支持)。端口 11207 和 18091 用于 TLS 连接;正如您在 lsof 输出中观察到的那样,服务器没有侦听这些端口。

我通过更改 couchbase 的连接字符串解决了这个问题

来自

couchbase:// 

http://