19.4.2.2 X 插件选项和系统变量
要控制 X 插件的激活,请使用以下选项:
Property | Value |
---|---|
Command-Line Format | --mysqlx[=value] |
Introduced | 5.7.12 |
Type | Enumeration |
Default Value | ON |
Valid Values | ON |
OFF FORCE FORCE_PLUS_PERMANENT |
此选项控制服务器在启动时如何加载 X 插件。仅当插件先前已在INSTALL PLUGIN注册或已在--plugin-load或--plugin-load-add加载时才可用。
该选项值应该是插件加载选项可用的值之一,如第 5.5.1 节“安装和卸载插件”中所述。例如,--mysqlx=FORCE_PLUS_PERMANENT告诉服务器加载插件,并防止在服务器运行时将其删除。
如果启用了 X 插件,它将公开几个允许对其操作进行控制的系统变量:
Property | Value |
---|---|
Command-Line Format | --mysqlx-bind-address=addr |
Introduced | 5.7.17 |
System Variable | mysqlx_bind_address |
Scope | Global |
Dynamic | No |
Type | String |
Default Value | * |
X 插件侦听 TCP/IP 连接的网络地址。此变量不是动态变量,只能在启动时进行配置。这等效于bind_address系统变量的 X 插件;有关更多信息,请参见该变量说明。
mysqlx_bind_address接受一个地址值,该地址值可以指定一个非通配符 IP 地址或主机名,或者是一种允许在多个网络接口(*
,0.0.0.0
或::
)上侦听的通配符地址格式之一。
可以将 IP 地址指定为 IPv4 或 IPv6 地址。如果该值为主机名,则 X 插件会将名称解析为 IP 地址并绑定到该地址。如果主机名解析为多个 IP 地址,则 X 插件将使用第一个 IPv4 地址(如果存在),否则使用第一个 IPv6 地址。
X 插件按以下方式处理不同类型的地址:
-
如果地址为
*
,则 X 插件会在所有服务器主机的 IPv4 接口上接受 TCP/IP 连接,如果服务器主机支持 IPv6,则在所有 IPv6 接口上都接受 TCP/IP 连接。使用此地址允许 X 插件同时进行 IPv4 和 IPv6 连接。此值为默认值。-
如果地址为
0.0.0.0
,则 X 插件将在所有服务器主机 IPv4 接口上接受 TCP/IP 连接。 -
如果地址为
::
,则 X 插件将在所有服务器主机 IPv4 和 IPv6 接口上接受 TCP/IP 连接。 -
如果该地址是 IPv4Map 的地址,则 X 插件将以 IPv4 或 IPv6 格式接受该地址的 TCP/IP 连接。例如,如果 X 插件绑定到
::ffff:127.0.0.1
,则诸如 MySQL Shell 之类的 Client 端可以使用--host=127.0.0.1
或--host=::ffff:127.0.0.1
进行连接。 -
如果该地址是“常规” IPv4 或 IPv6 地址(例如
127.0.0.1
或::1
),则 X 插件仅接受该 IPv4 或 IPv6 地址的 TCP/IP 连接。
-
如果绑定到该地址失败,则 X 插件会产生错误,并且服务器不会加载它。
Property | Value |
---|---|
Command-Line Format | --mysqlx-connect-timeout=# |
Introduced | 5.7.12 |
System Variable | mysqlx_connect_timeout |
Scope | Global |
Dynamic | Yes |
Type | Integer |
Default Value | 30 |
Minimum Value | 1 |
Maximum Value | 1000000000 |
X 插件 await 从新连接的 Client 端收到第一个数据包的秒数。这是connect_timeout的 X 插件等效项;有关更多信息,请参见该变量。
Property | Value |
---|---|
Command-Line Format | --mysqlx-idle-worker-thread-timeout=# |
Introduced | 5.7.12 |
System Variable | mysqlx_idle_worker_thread_timeout |
Scope | Global |
Dynamic | Yes |
Type | Integer |
Default Value | 60 |
Minimum Value | 0 |
Maximum Value | 3600 |
空闲工作线程终止之前经过的秒数。
Property | Value |
---|---|
Command-Line Format | --mysqlx-max-allowed-packet=# |
Introduced | 5.7.12 |
System Variable | mysqlx_max_allowed_packet |
Scope | Global |
Dynamic | Yes |
Type | Integer |
Default Value | 67108864 |
Minimum Value | 512 |
Maximum Value | 1073741824 |
X 插件可以接收的网络数据包的最大大小。这是max_allowed_packet的 X 插件等效项;有关更多信息,请参见该变量。
Property | Value |
---|---|
Command-Line Format | --mysqlx-max-connections=# |
Introduced | 5.7.12 |
System Variable | mysqlx_max_connections |
Scope | Global |
Dynamic | Yes |
Type | Integer |
Default Value | 100 |
Minimum Value | 1 |
Maximum Value | 65535 |
X 插件可接受的最大并发 Client 端连接数。这是max_connections的 X 插件等效项;有关更多信息,请参见该变量。
对于此变量的修改,如果新值小于当前连接数,则仅对新连接考虑新限制。
Property | Value |
---|---|
Command-Line Format | --mysqlx-min-worker-threads=# |
Introduced | 5.7.12 |
System Variable | mysqlx_min_worker_threads |
Scope | Global |
Dynamic | Yes |
Type | Integer |
Default Value | 2 |
Minimum Value | 1 |
Maximum Value | 100 |
X 插件用于处理 Client 端请求的最小工作线程数。
Property | Value |
---|---|
Command-Line Format | --mysqlx-port=port_num |
Introduced | 5.7.12 |
System Variable | mysqlx_port |
Scope | Global |
Dynamic | No |
Type | Integer |
Default Value | 33060 |
Minimum Value | 1 |
Maximum Value | 65535 |
X 插件侦听 TCP/IP 连接的网络端口。这是port的 X 插件等效项;有关更多信息,请参见该变量。
Property | Value |
---|---|
Command-Line Format | --mysqlx-port-open-timeout=# |
Introduced | 5.7.17 |
System Variable | mysqlx_port_open_timeout |
Scope | Global |
Dynamic | No |
Type | Integer |
Default Value | 0 |
Minimum Value | 0 |
Maximum Value | 120 |
X 插件 awaitTCP/IP 端口可用的秒数。
Property | Value |
---|---|
Command-Line Format | --mysqlx-socket=file_name |
Introduced | 5.7.15 |
System Variable | mysqlx_socket |
Scope | Global |
Dynamic | No |
Type | String |
Default Value | /tmp/mysqlx.sock |
X 插件用于连接的 Unix 套接字文件的路径。只有在 Unixos 上运行时,MySQL Server 才使用此设置。Client 端可以使用此套接字通过 X 插件连接到 MySQL Server。
默认的mysqlx_socket路径和文件名基于 MySQL 服务器主套接字文件的默认路径和文件名,并在文件名后附加了x
。主套接字文件的默认路径和文件名是/tmp/mysql.sock
,因此 X 插件套接字文件的默认路径和文件名是/tmp/mysqlx.sock
。
如果在服务器启动时使用socket系统变量为主套接字文件指定了备用路径和文件名,则这不会影响 X 插件套接字文件的默认设置。在这种情况下,如果要将两个套接字都存储在一个路径中,则还必须设置mysqlx_socket系统变量。例如在配置文件中:
socket=/home/sockets/mysqld/mysql.sock
mysqlx_socket=/home/sockets/xplugin/xplugin.sock
如果在编译时使用MYSQL_UNIX_ADDR compile 选项更改了主套接字文件的默认路径和文件名,则这确实会影响 X 插件套接字文件的默认值,该文件是通过在MYSQL_UNIX_ADDR文件名后附加x
形成的。如果要在编译时为 X 插件套接字文件设置其他默认值,请使用MYSQLX_UNIX_ADDR compile 选项。
MYSQLX_UNIX_PORT
环境变量还可用于在服务器启动时为 X 插件套接字文件设置默认值(请参见第 4.9 节“环境变量”)。如果设置此环境变量,它将覆盖已编译的MYSQLX_UNIX_ADDR值,但被mysqlx_socket值覆盖。
Property | Value |
---|---|
Command-Line Format | --mysqlx-ssl-ca=file_name |
Introduced | 5.7.12 |
System Variable | mysqlx_ssl_ca |
Scope | Global |
Dynamic | No |
Type | File name |
Default Value | NULL |
mysqlx_ssl_ca系统变量类似于ssl_ca,除了它适用于 X 插件而不是 MySQL Server 主连接接口。有关为 X 插件配置加密支持的信息,请参见第 19.4.1 节“使用带有 X 插件的加密连接”。
Property | Value |
---|---|
Command-Line Format | --mysqlx-ssl-capath=dir_name |
Introduced | 5.7.12 |
System Variable | mysqlx_ssl_capath |
Scope | Global |
Dynamic | No |
Type | Directory name |
Default Value | NULL |
mysqlx_ssl_capath系统变量类似于ssl_capath,除了它适用于 X 插件而不是 MySQL Server 主连接接口。有关为 X 插件配置加密支持的信息,请参见第 19.4.1 节“使用带有 X 插件的加密连接”。
Property | Value |
---|---|
Command-Line Format | --mysqlx-ssl-cert=file_name |
Introduced | 5.7.12 |
System Variable | mysqlx_ssl_cert |
Scope | Global |
Dynamic | No |
Type | File name |
Default Value | NULL |
mysqlx_ssl_cert系统变量类似于ssl_cert,除了它适用于 X 插件而不是 MySQL Server 主连接接口。有关为 X 插件配置加密支持的信息,请参见第 19.4.1 节“使用带有 X 插件的加密连接”。
Property | Value |
---|---|
Command-Line Format | --mysqlx-ssl-cipher=name |
Introduced | 5.7.12 |
System Variable | mysqlx_ssl_cipher |
Scope | Global |
Dynamic | No |
Type | String |
Default Value | NULL |
mysqlx_ssl_cipher系统变量类似于ssl_cipher,除了它适用于 X 插件而不是 MySQL Server 主连接接口。有关为 X 插件配置加密支持的信息,请参见第 19.4.1 节“使用带有 X 插件的加密连接”。
Property | Value |
---|---|
Command-Line Format | --mysqlx-ssl-crl=file_name |
Introduced | 5.7.12 |
System Variable | mysqlx_ssl_crl |
Scope | Global |
Dynamic | No |
Type | File name |
Default Value | NULL |
mysqlx_ssl_crl系统变量类似于ssl_crl,除了它适用于 X 插件而不是 MySQL Server 主连接接口。有关为 X 插件配置加密支持的信息,请参见第 19.4.1 节“使用带有 X 插件的加密连接”。
Property | Value |
---|---|
Command-Line Format | --mysqlx-ssl-crlpath=dir_name |
Introduced | 5.7.12 |
System Variable | mysqlx_ssl_crlpath |
Scope | Global |
Dynamic | No |
Type | Directory name |
Default Value | NULL |
mysqlx_ssl_crlpath系统变量类似于ssl_crlpath,除了它适用于 X 插件而不是 MySQL Server 主连接接口。有关为 X 插件配置加密支持的信息,请参见第 19.4.1 节“使用带有 X 插件的加密连接”。
Property | Value |
---|---|
Command-Line Format | --mysqlx-ssl-key=file_name |
Introduced | 5.7.12 |
System Variable | mysqlx_ssl_key |
Scope | Global |
Dynamic | No |
Type | File name |
Default Value | NULL |
mysqlx_ssl_key系统变量类似于ssl_key,除了它适用于 X 插件而不是 MySQL Server 主连接接口。有关为 X 插件配置加密支持的信息,请参见第 19.4.1 节“使用带有 X 插件的加密连接”。