You are browsing documentation for an outdated version. See the latest documentation here.
kong.cluster
Cluster-level utilities.
kong.cluster.get_id()
Returns the unique ID for this Kong cluster. If Kong is running in DB-less mode without a cluster ID explicitly defined, then this method returns nil
.
For hybrid mode, all control planes and data planes belonging to the same cluster return the same cluster ID. For traditional database-based deployments, all Kong nodes pointing to the same database also return the same cluster ID.
Returns
string|nil
: The v4 UUID used by this cluster as its ID.string|nil
: An error message.
Usage
local id, err = kong.cluster.get_id()
if err then
-- handle error
end
if not id then
-- no cluster ID is available
end
-- use id here