Slave Only Read from Tabel
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 20/100
Research direction
Start by reading HyperDB's $wpdb->add_database() and $wpdb->add_callback() entry points, then trace how table names are used when selecting a connection. Done means establishing whether read-only routing can be limited to wpoa_posts and wpoa_postmeta or exclude other tables, and documenting a working configuration or the limitation.
Written by the indexing model from the issue text.
Description
Hello,
I want to use my slave server only for 2 tables. But can't find a suitable guide and this code doesn't seem to work, can anyone help?
Is it possible to also specifically exclude tables?
Ok I will use only Read Modus on wpoa_posts and wpoa_postmeta on a Mysql 8 Slave for more Performance, the table posts and postmeta are very big size.
thanks in advance
Manu
`$wpdb->add_database( array(
'host' => '127.0.0.1:3380',
'user' => 'blog_user',
'password' => 'pass',
'name' => 'sport',
'dataset' => 'testme',
'write' => 0,
'read' => 1,
) );
$wpdb->add_callback( 'my_db_callback' );
function my_db_callback( $query, $wpdb ) {
if ( preg_match("/wpoa_post%/", $wpdb->table) ) {
return 'testme';
}
}`
- Dominant language
- PHP
- Stars
- 150
- Forks
- 28
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Automattic/HyperDB
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Automattic/HyperDB#191 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
Automattic/HyperDB#160 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
Automattic/HyperDB#142 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 15/100
Automattic/HyperDB#141 · 2 comments · 2 reactions ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
Automattic/HyperDB#139 ·
All issues in Automattic/HyperDB
Similar issues
-
priority: p3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
googleapis/librarian#7636 ·
-
0. Needs triage bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nextcloud/fulltextsearch#1011 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
phpstan/phpstan-doctrine#794 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Automattic/static-site-importer#1767 ·