# server：实例摘要、参数与授权检查

> 查看完整版本与兼容模式、非默认及待重启（pending_restart）参数、授权剩余天数及绑定 MAC/连接上限。

---

LLMS 索引： [llms.txt](/kbdiag-docs/zh/llms.txt)

---

聚合实例摘要（`server`）、非默认与 `pending_restart` 参数（`server params`）以及授权有效期与绑定信息（`server license`）。只读检查：不修改参数、不执行 reload 或重启。

## 用法

```bash
kbdiag server
kbdiag server params
kbdiag server license
kbdiag server --json
```

## 子命令与参数

| 命令 / 参数 | 说明 |
|---|---|
| `server` | 展示完整身份版本、连接余量、授权摘要及非默认参数预览 |
| `server params` | 列出所有非默认与待重启参数及其配置文件路径与行号 |
| `server license` | 展示授权剩余天数、`license.dat` 路径、绑定 MAC 与授权连接数 |
| `--json` | 输出结构化 JSON（`inst.identity`、`inst.info`、`params.changed`、`license.info`） |

## 判定与输出解读

- **`FAIL`（`exit=2`）**：`license.expired`（运行中实例可暂存，下次重启失败；主备需分别核对本机授权），或 `server` 本身命中普通用户连接耗尽（`inst.connections`）。
- **`WARN`（`exit=1`）**：`license.expiring`（30 天内到期）或 `params.pending_restart`（参数修改待重启生效，报告提供可供人工确认的回退语句）。
- **`UNKNOWN`（`exit=3`）**：探针失败或权限不足（即使可见配置行数为零，缺少超管或 `sys_read_all_settings` 权限仍标 `UNKNOWN`）。
- **隐私提示**：`license.dat` 路径与绑定 `mac` 默认原样输出（不遮蔽），外发报告前请按需脱敏。

## 实测示例（KES V9 主库节选，80 列）

```text
inst.summary  OK  (KingbaseES V009R002C016, primary, system@local,
    endpoint=/tmp/.s.KINGBASE.54321, 2026-12-03T09:40:35Z)
[INST.IDENTITY]
  ok, 1 rows
  full_version=KingbaseES V009R002C016 | server_version_num=120001 |
    database_mode=oracle | role=primary
[INST.INFO]
  ok, 1 rows
  version=V009R002C016 | connections=2 | max_connections=100 |
    usable_connections=97
...
```

```text
params  OK  (KingbaseES V009R002C016, primary, system@local,
    endpoint=/tmp/.s.KINGBASE.54321, 2026-12-03T04:05:00Z)
[PENDING RESTART]
  0
[CHANGED]
  45 parameters not at their default (sources other than default, override and
    this connection)
  ...
  archive_command = exit 0
    source=configuration file  file=kingbase.conf:236
  archive_mode = always
    source=configuration file  file=kingbase.conf:234
```

```text
[LICENSE]
  left             171 days
  file             /data/kingbase/app/KESRealPro/V009R002C016/Server/bin/../../l
    icense.dat
  product          KingbaseES
  version          V009
  validity         180
  mac              00:00:00:00:00:00
  max connections  0
  KES checks the license only when the instance starts
  note: file path and MAC shown verbatim (not redacted); scrub before sharing
```

## 关联命令

- [`kbdiag check`](/kbdiag-docs/zh/docs/reference/check/) — 一次性巡检连接数与授权等九个核心域
- [`kbdiag session`](/kbdiag-docs/zh/docs/reference/session/) — 对照 `max_connections` 查看当前会话明细
- [`kbdiag status`](/kbdiag-docs/zh/docs/reference/status/) — 检查实例运行时长、主备角色与磁盘状态
