# How licensing works (/licensing/how-it-works)



Every KubeMQ server checks its own license, on Docker and Kubernetes. Without a valid license it does not start, and when a license ends it stops. Your data is never deleted. A license belongs to its installation: the Kubernetes cluster, or on Docker the data volume, so keep the volume.

## Online and offline licenses [#online-and-offline-licenses]

| Kind    | Which licenses                              | Talks to KubeMQ                                                                                                                      | Ends                                                                                                                            |
| ------- | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------- |
| Online  | The evaluation, trial keys and license keys | Contacts `license.kubemq.io` at first start and while running, and sends usage reports ([Data sent to KubeMQ](/licensing/data-sent)) | At the evaluation, trial or contract end. `kmq license` (kmq is the KubeMQ command-line tool) shows the time under `RUNS UNTIL` |
| Offline | An offline license file                     | Never                                                                                                                                | On the file's end date                                                                                                          |

If both are set, the file wins ([Core & Licensing](/configure/reference/core#license)).

## When the server cannot reach KubeMQ [#when-the-server-cannot-reach-kubemq]

A server with an online license keeps running while it cannot reach KubeMQ, until the time `kmq license` shows under RUNS UNTIL. Restore the connection before then.

Meanwhile the server logs a warning ([Troubleshooting](/licensing/troubleshooting#grace-countdown)) and `kmq license` shows the state `grace`. An online license's first start must reach KubeMQ.

<Mermaid
  chart="graph LR
  subgraph NoConnection[&#x22;Server cannot reach KubeMQ&#x22;]
    Connected[&#x22;Connected&#x22;] --> Lost[&#x22;Connection lost&#x22;]
    Lost --> Warnings[&#x22;Running with warnings<br/>state grace&#x22;]
    Warnings --> StopsA[&#x22;Stops at RUNS UNTIL<br/>data kept&#x22;]
    Warnings -. &#x22;connection restored&#x22; .-> Connected
  end

  subgraph LicenseEnds[&#x22;License ends&#x22;]
    ContractEnd[&#x22;Contract or trial end&#x22;] --> NoRenewals[&#x22;No more renewals&#x22;]
    NoRenewals --> StopsB[&#x22;Stops at RUNS UNTIL<br/>data kept&#x22;]
  end

  class Connected,Warnings broker
  class Lost,ContractEnd,NoRenewals external
  class StopsA,StopsB data"
/>

## When a license ends [#when-a-license-ends]

An online license stops renewing at the contract or trial end, and the server stops at RUNS UNTIL. An evaluation ends 14 days after it started.

An offline license file stops the server on its end date. Renew it first: [Install air-gapped](/deploy/install/air-gapped#renew-before-it-expires).

At a stop the server refuses new connections, lets current work finish (5 minutes by default, [Core & Licensing](/configure/reference/core#license)) and exits with code 3. Cluster servers stop at different times. Restarts fail the same way until the license is fixed (`CrashLoopBackOff` on Kubernetes).

Messages, accounts and settings stay on the volume. Add a trial key or license key with your install page's **Add your license** step and the server starts on the same data; a new evaluation cannot.

Buying before a trial key ends converts the same key; running servers pick up the new plan without a restart.

## Revocation [#revocation]

KubeMQ revokes a license only by deliberate action. Missed payments, network silence and extra installations never revoke one. Offline license files cannot be revoked. Notice periods are in the licensing policy ([Plans compared](/licensing#terms-and-policies)). A cluster larger than its license stops by itself ([Troubleshooting](/licensing/troubleshooting#cluster-over-cap)).

## Check license status [#check-license-status]

`kmq license` shows one row per server ([Troubleshooting](/licensing/troubleshooting#check-the-license-status) has the command for each platform); `--details` gives the full record for support.

| Column             | Meaning                                                                                   |
| ------------------ | ----------------------------------------------------------------------------------------- |
| `SERVER`           | The Docker container, or one Kubernetes pod                                               |
| `STATE`            | The license state (next table)                                                            |
| `PLAN`             | `evaluation`, `trial` or your plan                                                        |
| `SERVERS LICENSED` | How many servers the license allows                                                       |
| `EXPIRES`          | When the license itself ends                                                              |
| `DAYS LEFT`        | Whole days until `EXPIRES`                                                                |
| `RUNS UNTIL`       | When this server stops if nothing changes. It moves later while the server reaches KubeMQ |
| `VERSION`          | The KubeMQ version the server runs                                                        |
| `CHECKED`          | When this status was read                                                                 |
| `PROBLEM`          | A link to the Troubleshooting entry for the current problem                               |

| State                                    | Do this                                                          |
| ---------------------------------------- | ---------------------------------------------------------------- |
| `active`                                 | Nothing to do.                                                   |
| `evaluation`                             | Add a license before the evaluation ends.                        |
| `expiring` (14 days or fewer to the end) | Renew or buy.                                                    |
| `grace`                                  | Restore the connection to `license.kubemq.io` before RUNS UNTIL. |
| `stopping` and `refused`                 | Follow the `PROBLEM` link.                                       |
| `unknown`                                | Check again in a minute.                                         |

Monitor with `kmq license -o json` on a schedule. Codes 1 to 8 are kmq's general errors ([kmq CLI](/operate/kmq-cli#exit-codes)).

| Exit code      | Meaning                                                                                                                                     | Do this                                                                                   |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| `0`            | Every server is fine                                                                                                                        | Nothing                                                                                   |
| `9`            | Needs attention: `expiring`, `grace`, more servers or installations than licensed, failing usage reports, or a server that has not reported | Warn                                                                                      |
| `10`           | A server stopped or was refused                                                                                                             | Alert                                                                                     |
| `11`           | Status not available: kmq prints `license status not available: <reason>`                                                                   | Alert, then follow [Troubleshooting](/licensing/troubleshooting#check-the-license-status) |
| `5`, on Docker | Cannot connect: a server the license stopped cannot answer                                                                                  | Alert as server down                                                                      |
| Any other      | The check itself failed                                                                                                                     | Treat as a failed check                                                                   |



On Docker this status needs no sign-in and never includes the key or an identifier; an administrator can turn that off ([Core & Licensing](/configure/reference/core#license)).

## Related [#related]

* [Plans compared](/licensing)
* [Data sent to KubeMQ](/licensing/data-sent)
* [Troubleshooting](/licensing/troubleshooting)
