使用 Ceph 管理套接字

使用管理套接字通过 UNIX 套接字文件直接与给定守护程序进行交互。

例如,套接字使您能够:

  • 在运行时列出 Ceph 配置

  • 直接在运行时设置配置值,而不依赖于监视器。 当监视器为 down时,这很有用。

  • 转储历史操作

  • 转储操作优先级队列状态

  • 不重新引导的转储操作

  • 转储性能计数器

此外,在对与 Ceph 监视器或 OSD 相关的问题进行故障诊断时,使用套接字很有用。

不管如何,如果守护程序未在运行,那么尝试使用管理套接字时将返回以下错误:

Error 111: Connection Refused
重要信息: 仅当守护程序正在运行时,管理套接字才可用。 当您正确关闭守护程序时,将除去管理套接字。 但是,如果守护程序意外终止,那么管理套接字可能会持久存在。

先决条件

  • 正在运行IBM Storage Ceph簇。

  • 对节点的根级别访问权。

过程

  1. 登录到 Cephadm shell:

    示例

    [root@host01 ~]# cephadm shell
  2. 要使用套接字:

    语法

    ceph daemon MONITOR_ID COMMAND

    替换:

    • 守护程序的 MONITOR_ID

    • COMMAND 与要运行的命令一起使用。 使用 help 列出给定守护程序的可用命令。

      要查看 Ceph 监视器的状态:

      示例

      [ceph: root@host01 /]# ceph daemon mon.host01 help
      {
          "add_bootstrap_peer_hint": "add peer address as potential bootstrap peer for cluster bringup",
          "add_bootstrap_peer_hintv": "add peer address vector as potential bootstrap peer for cluster bringup",
          "compact": "cause compaction of monitor's leveldb/rocksdb storage",
          "config diff": "dump diff of current config and default config",
          "config diff get": "dump diff get <field>: dump diff of current and default config setting <field>",
          "config get": "config get <field>: get the config value",
          "config help": "get config setting schema and descriptions",
          "config set": "config set <field> <val> [<val> ...]: set a config variable",
          "config show": "dump current config settings",
          "config unset": "config unset <field>: unset a config variable",
          "connection scores dump": "show the scores used in connectivity-based elections",
          "connection scores reset": "reset the scores used in connectivity-based elections",
          "counter dump": "dump all labeled and non-labeled counters and their values",
          "counter schema": "dump all labeled and non-labeled counters schemas",
          "dump_historic_ops": "show recent ops",
          "dump_historic_slow_ops": "show recent slow ops",
          "dump_mempools": "get mempool stats",
          "get_command_descriptions": "list available commands",
          "git_version": "get git sha1",
          "heap": "show heap usage info (available only if compiled with tcmalloc)",
          "help": "list available commands",
          "injectargs": "inject configuration arguments into running daemon",
          "log dump": "dump recent log entries to log file",
          "log flush": "flush log entries to log file",
          "log reopen": "reopen log file",
          "mon_status": "report status of monitors",
          "ops": "show the ops currently in flight",
          "perf dump": "dump non-labeled counters and their values",
          "perf histogram dump": "dump perf histogram values",
          "perf histogram schema": "dump perf histogram schema",
          "perf reset": "perf reset <name>: perf reset all or one perfcounter name",
          "perf schema": "dump non-labeled counters schemas",
          "quorum enter": "force monitor back into quorum",
          "quorum exit": "force monitor out of the quorum",
          "sessions": "list existing sessions",
          "smart": "Query health metrics for underlying device",
          "sync_force": "force sync of and clear monitor store",
          "version": "get ceph version"
      }

      示例

      [ceph: root@host01 /]# ceph daemon mon.host01 mon_status
      
      {
          "name": "host01",
          "rank": 0,
          "state": "leader",
          "election_epoch": 120,
          "quorum": [
              0,
              1,
              2
          ],
          "quorum_age": 206358,
          "features": {
              "required_con": "2449958747317026820",
              "required_mon": [
                  "kraken",
                  "luminous",
                  "mimic",
                  "osdmap-prune",
                  "nautilus",
                  "octopus",
                  "pacific",
                  "elector-pinging"
              ],
              "quorum_con": "4540138297136906239",
              "quorum_mon": [
                  "kraken",
                  "luminous",
                  "mimic",
                  "osdmap-prune",
                  "nautilus",
                  "octopus",
                  "pacific",
                  "elector-pinging"
              ]
          },
          "outside_quorum": [],
          "extra_probe_peers": [],
          "sync_provider": [],
          "monmap": {
              "epoch": 3,
              "fsid": "81a4597a-b711-11eb-8cb8-001a4a000740",
              "modified": "2021-05-18T05:50:17.782128Z",
              "created": "2021-05-17T13:13:13.383313Z",
              "min_mon_release": 16,
              "min_mon_release_name": "pacific",
              "election_strategy": 1,
              "disallowed_leaders: ": "",
              "stretch_mode": false,
              "features": {
                  "persistent": [
                      "kraken",
                      "luminous",
                      "mimic",
                      "osdmap-prune",
                      "nautilus",
                      "octopus",
                      "pacific",
                      "elector-pinging"
                  ],
                  "optional": []
              },
              "mons": [
                  {
                      "rank": 0,
                      "name": "host01",
                      "public_addrs": {
                          "addrvec": [
                              {
                                  "type": "v2",
                                  "addr": "10.74.249.41:3300",
                                  "nonce": 0
                              },
                              {
                                  "type": "v1",
                                  "addr": "10.74.249.41:6789",
                                  "nonce": 0
                              }
                          ]
                      },
                      "addr": "10.74.249.41:6789/0",
                      "public_addr": "10.74.249.41:6789/0",
                      "priority": 0,
                      "weight": 0,
                      "crush_location": "{}"
                  },
                  {
                      "rank": 1,
                      "name": "host02",
                      "public_addrs": {
                          "addrvec": [
                              {
                                  "type": "v2",
                                  "addr": "10.74.249.55:3300",
                                  "nonce": 0
                              },
                              {
                                  "type": "v1",
                                  "addr": "10.74.249.55:6789",
                                  "nonce": 0
                              }
                          ]
                      },
                      "addr": "10.74.249.55:6789/0",
                      "public_addr": "10.74.249.55:6789/0",
                      "priority": 0,
                      "weight": 0,
                      "crush_location": "{}"
                  },
                  {
                      "rank": 2,
                      "name": "host03",
                      "public_addrs": {
                          "addrvec": [
                              {
                                  "type": "v2",
                                  "addr": "10.74.249.49:3300",
                                  "nonce": 0
                              },
                              {
                                  "type": "v1",
                                  "addr": "10.74.249.49:6789",
                                  "nonce": 0
                              }
                          ]
                      },
                      "addr": "10.74.249.49:6789/0",
                      "public_addr": "10.74.249.49:6789/0",
                      "priority": 0,
                      "weight": 0,
                      "crush_location": "{}"
                  }
              ]
          },
          "feature_map": {
              "mon": [
                  {
                      "features": "0x3f01cfb9fffdffff",
                      "release": "luminous",
                      "num": 1
                  }
              ],
              "osd": [
                  {
                      "features": "0x3f01cfb9fffdffff",
                      "release": "luminous",
                      "num": 3
                  }
              ]
          },
          "stretch_mode": false
      }
  3. 或者,通过使用 Ceph 守护程序的套接字文件来指定该守护程序:

    语法

    ceph daemon /var/run/ceph/SOCKET_FILE COMMAND
  4. 要查看特定主机上名为 osd.0 的 Ceph OSD 的状态:

    示例

    [ceph: root@host01 /]# ceph daemon /var/run/ceph/ceph-osd.0.asok status
    {
        "cluster_fsid": "9029b252-1668-11ee-9399-001a4a000429",
        "osd_fsid": "1de9b064-b7a5-4c54-9395-02ccda637d21",
        "whoami": 0,
        "state": "active",
        "oldest_map": 1,
        "newest_map": 58,
        "num_pgs": 33
    }
    注: 您可以将 help 而不是 status 用于可用于特定守护程序的各种选项。
  5. 列出 Ceph 进程的所有套接字文件:

    示例

    [ceph: root@host01 /]# ls /var/run/ceph