简体   繁体   English

获取Sync Gateway心跳

[英]Get Sync Gateway heartbeat

I have few clients each with installed Couchbase Lite and Sync Gateway and every client's database is replicated to a different bucket on a server. 我有几个客户端都安装了Couchbase Lite和Sync Gateway,并且每个客户端的数据库都被复制到服务器上的不同存储桶中。

I know that from the client I can check the heartbeat of the sync using: 我知道从客户端我可以使用以下方法检查同步的心跳:

curl -X GET 'localhost:4984/db/_changes?feed=continuous&heartbeat=26000&since=0'

How do I do that from the server? 我如何从服务器上做到这一点? What is the proper way of doing so? 这样做的正确方法是什么?

Basically, I need to know if one of the Sync Gateway instances is offline and which without knowing their IPs. 基本上,我需要知道其中一个Sync Gateway实例是否处于脱机状态,而且不知道它们的IP。

On the server, I have a service(REST API) and in the Sync Gateway JSON config I have an event handler that sends updates to it: 在服务器上,我有一个服务(REST API),在Sync Gateway JSON配置中,我有一个事件处理程序,它向它发送更新:

“event_handlers”: {
    “document_changed”: [
        {
            “handler”: “webhook”,
            “url”: “http://serverip:port/events/newupdate?=clientId”
        }
    ]
}

Can I somehow add a custom event for the heartbeat? 我可以以某种方式为心跳添加自定义事件吗?

您可以创建后台进程,将更新发布到包含心跳的文档,然后使用同步网关复制该文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM