Skip to content

获取 MySQL 内存配置参数(从 /etc/my.cnf 解析)

获取 MySQL 运行时的内存相关配置参数,通过解析 /etc/my.cnf 和 SHOW VARIABLES 获得。

POST
https://your-panel.example.com:8888/database
更新于 查看 Markdown

Request bodyX-WWW-FORM-URLENCODEDrequired

  • request_timestringrequired

    Unix 时间戳。

  • request_tokenstringrequired

    按 API 概览生成的签名。

  • actionGetDbStatusrequired

    具体操作名称。

Returns

default

接口响应,业务状态见下方详细说明。

JSON
  • query_cache_sizeoptionalstring

    查询缓存大小

  • bt_query_cache_sizeoptionalstring

    面板设置的查询缓存

  • query_cache_typeoptionalstring

    查询缓存类型:ON / OFF / DEMAND

  • query_cache_supprotoptionalstring

    查询缓存支持状态

  • table_open_cacheoptionalinteger

    打开表缓存数量

  • thread_cache_sizeoptionalinteger

    线程缓存大小

  • key_buffer_sizeoptionalinteger

    MyISAM 索引缓冲(MB)

  • tmp_table_sizeoptionalinteger

    临时表大小(MB)

  • max_heap_table_sizeoptionalstring

    MEMORY 表最大大小

  • innodb_buffer_pool_sizeoptionalinteger

    InnoDB 缓冲池大小(MB)

  • innodb_log_buffer_sizeoptionalinteger

    InnoDB 日志缓冲(MB)

  • max_connectionsoptionalinteger

    最大连接数

  • sort_buffer_sizeoptionalinteger

    排序缓冲(KB)

  • read_buffer_sizeoptionalinteger

    读缓冲(KB)

  • read_rnd_buffer_sizeoptionalinteger

    随机读缓冲(KB)

  • join_buffer_sizeoptionalinteger

    JOIN 缓冲(KB)

  • thread_stackoptionalinteger

    线程栈大小(KB)

  • binlog_cache_sizeoptionalinteger

    Binlog 缓存(KB)

各操作详细说明

GetDbStatusaction=GetDbStatus获取 MySQL 内存配置参数(从 /etc/my.cnf 解析)

获取 MySQL 运行时的内存相关配置参数,通过解析 /etc/my.cnf 和 SHOW VARIABLES 获得。

  • 路由:POST /database
  • action:GetDbStatus

输入参数

参数名称 必选 类型 描述
action 是 String 固定值 GetDbStatus

输出参数

返回 mem 对象,包含以下 MySQL 配置项:

参数名称 类型 描述
query_cache_size String 查询缓存大小
bt_query_cache_size String 面板设置的查询缓存
query_cache_type String 查询缓存类型:ON / OFF / DEMAND
query_cache_supprot String 查询缓存支持状态
table_open_cache Integer 打开表缓存数量
thread_cache_size Integer 线程缓存大小
key_buffer_size Integer MyISAM 索引缓冲(MB)
tmp_table_size Integer 临时表大小(MB)
max_heap_table_size String MEMORY 表最大大小
innodb_buffer_pool_size Integer InnoDB 缓冲池大小(MB)
innodb_log_buffer_size Integer InnoDB 日志缓冲(MB)
max_connections Integer 最大连接数
sort_buffer_size Integer 排序缓冲(KB)
read_buffer_size Integer 读缓冲(KB)
read_rnd_buffer_size Integer 随机读缓冲(KB)
join_buffer_size Integer JOIN 缓冲(KB)
thread_stack Integer 线程栈大小(KB)
binlog_cache_size Integer Binlog 缓存(KB)

示例

{
    "mem": {
        "query_cache_size": "0",
        "bt_query_cache_size": "0",
        "table_open_cache": 256,
        "thread_cache_size": 32,
        "query_cache_type": "OFF",
        "key_buffer_size": 64,
        "tmp_table_size": 64,
        "max_heap_table_size": "16777216",
        "innodb_buffer_pool_size": 256,
        "innodb_log_buffer_size": 32,
        "max_connections": 500,
        "sort_buffer_size": 1024,
        "read_buffer_size": 1024,
        "read_rnd_buffer_size": 256,
        "join_buffer_size": 256,
        "thread_stack": 256,
        "binlog_cache_size": 32,
        "query_cache_supprot": "disable"
    }
}
Navigation

Type to search…

↑↓ navigate↵ selectEsc close