mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
node_groups filter reference section (stub)
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@329461 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
a548c04bef
commit
f006e05501
2 changed files with 115 additions and 4 deletions
|
@ -1822,11 +1822,11 @@ if ($res) {
|
|||
</para>
|
||||
<para>
|
||||
MySQL Replication supports partitioning as filters that allow you to
|
||||
create slaves that replicate all or specific databases of the master, or tables.
|
||||
create slaves that replicate all or specific databases of the master, or tables.
|
||||
It is then in the responsibility of the application
|
||||
to choose a slave according to the filter rules. You can either use the
|
||||
mysqlnd_ms <literal>node_groups</literal> filter to manually support this,
|
||||
or use the experimental table filter.
|
||||
mysqlnd_ms <literal><link linkend="ini.mysqlnd-ms-plugin-config-v2.filter-node-groups">node_groups</link></literal>
|
||||
filter to manually support this, or use the experimental table filter.
|
||||
</para>
|
||||
<para>
|
||||
Manual partitioning or sharding is supported through the
|
||||
|
@ -1924,7 +1924,7 @@ select($mysqli, "slave_1", "/*Partition_A*/");
|
|||
</para>
|
||||
<para>
|
||||
By default, the plugin will use all configured master and slave servers for
|
||||
query execution. But if a query begins with a SQL hint like
|
||||
query execution. But if a query begins with a SQL hint like
|
||||
<literal>/*node_group*/</literal>, the plugin will only consider the servers
|
||||
listed in the <literal>node_group</literal> for query execution. Thus,
|
||||
<literal>SELECT</literal> queries prefixed with <literal>/*Partition_A*/</literal>
|
||||
|
|
|
@ -1479,6 +1479,117 @@ function pick_server($connected, $query, $masters, $slaves, $last_used_connectio
|
|||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
<varlistentry xml:id="ini.mysqlnd-ms-plugin-config-v2.filter-node-groups">
|
||||
<term>
|
||||
Filter: <parameter>node_groups</parameter>
|
||||
<type>object</type>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
The <literal>node_groups</literal> filter lets you group cluster nodes
|
||||
and query selected groups, for example, to support data partitioning.
|
||||
Data partitioning can be required for manual sharding, primary copy based
|
||||
clusters running multiple masters, or to avoid hot spots in update everywhere
|
||||
clusters that have no built-in partitioning. The filter is a multi filter
|
||||
which returns zero, one or multiple of its input servers. Thus, it
|
||||
must be followed by other filters to reduce the number of candidates
|
||||
down to one for statement execution.
|
||||
</para>
|
||||
<informaltable>
|
||||
<tgroup cols="3">
|
||||
<colspec colwidth="1*"/>
|
||||
<colspec colwidth="7*"/>
|
||||
<colspec colwidth="2*"/>
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Keyword</entry>
|
||||
<entry>Description</entry>
|
||||
<entry>Version</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>
|
||||
<literal>user defined node group name</literal>
|
||||
</entry>
|
||||
<entry>
|
||||
<para>
|
||||
One or more node groups must be defined. A node group can have an
|
||||
arbitrary user defined name. The name is used in combination with
|
||||
a SQL hint to restrict query execution to the nodes listed for the
|
||||
node group. To run a query on any of the servers of a node group,
|
||||
the query must begin with the SQL hint
|
||||
<literal>/*user defined node group name*/</literal>.
|
||||
Please note, no white space is allowed around
|
||||
<literal>user defined node group name</literal>. Because
|
||||
<literal>user defined node group name</literal> is used as-is
|
||||
as part of a SQL hint, you should choose the name that is compliant
|
||||
with the SQL language.
|
||||
</para>
|
||||
<para>
|
||||
Each node group entry must contain a list of <literal>master</literal>
|
||||
servers. Additional <literal>slave</literal> servers are allowed.
|
||||
The list of master and slave servers must reference corresponding
|
||||
entries in the
|
||||
<link linkend="ini.mysqlnd-ms-plugin-config-v2.master">global master</link>
|
||||
respectively <link linkend="ini.mysqlnd-ms-plugin-config-v2.slave">slave</link>
|
||||
server list.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Manual partitioning</title>
|
||||
<programlisting role="ini">
|
||||
<![CDATA[
|
||||
{
|
||||
"myapp": {
|
||||
"master": {
|
||||
"master_0": {
|
||||
"host": "localhost",
|
||||
"socket": "\/tmp\/mysql.sock"
|
||||
}
|
||||
},
|
||||
"slave": {
|
||||
"slave_0": {
|
||||
"host": "192.168.2.28",
|
||||
"port": 3306
|
||||
},
|
||||
"slave_1": {
|
||||
"host": "127.0.0.1",
|
||||
"port": 3311
|
||||
}
|
||||
},
|
||||
"filters": {
|
||||
"node_groups": {
|
||||
"Partition_A" : {
|
||||
"master": ["master_0"],
|
||||
"slave": ["slave_0"]
|
||||
}
|
||||
},
|
||||
"roundrobin": []
|
||||
}
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
Please note, if a filter chain
|
||||
generates an empty slave list and the PHP configuration directive
|
||||
<literal>mysqlnd_ms.multi_master=0</literal> is used, the plugin may
|
||||
emit a warning.
|
||||
</para>
|
||||
</entry>
|
||||
<entry>Since 1.5.0.</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry xml:id="ini.mysqlnd-ms-plugin-config-v2.filter-qos">
|
||||
<term>
|
||||
Filter: <parameter>quality_of_service</parameter>
|
||||
|
|
Loading…
Reference in a new issue