Welcome Guest, Not a member yet? Register   Sign In
MySQL - master - slave
#1

What about master slave support in one of next versions?
Reply
#2

(This post was last modified: 01-25-2016, 11:01 PM by sv3tli0.)

The relation master - slave is MYSQL setup/configuration task, its not work for the framework..

MYSQL 5.5 Replication Docs > http://dev.mysql.com/doc/refman/5.5/en/replication.html
Best VPS Hosting : Digital Ocean
Reply
#3

How you can say this?
How will use I in Codeigniter select from slave?
Reply
#4

What do you understand under Mysql Master - Slave ?

If its a Replication MYSQL service handles this relation.

If its some kind of duplication with 2 instances you need to specify 2nd DB connection inside your app..
Best VPS Hosting : Digital Ocean
Reply
#5

You can install mysqlnd extension and mysqlnd_ms plugin. It will transparently query slave(s) when needed so no code change is required in your app or CI.

More info here: http://php.net/manual/en/book.mysqlnd-ms.php
Reply
#6

(This post was last modified: 02-08-2016, 06:50 PM by consigliere.)

What about that?
(01-30-2016, 08:08 PM)siburny Wrote: You can install mysqlnd extension and mysqlnd_ms plugin. It will transparently query slave(s) when needed so no code change is required in your app or CI.

More info here: http://php.net/manual/en/book.mysqlnd-ms.php
yes I know that but in CI active record there is no option to add comments in query? Is there any option for this?

(01-29-2016, 11:33 PM)sv3tli0 Wrote: What do you understand under Mysql Master - Slave ?

If its a Replication MYSQL service handles this relation.

If its some kind of duplication with 2 instances you need to specify 2nd DB connection inside your app..

you just do not get it
Reply
#7

If you need to build your query with Query Builder for some reason, just use $this->db->get_compiled_select() (/_insert()/_update()/_delete()) to get the SQL generated by Query Builder, then pass it to $this->db->query() with your comments. For example:

PHP Code:
$this->db->select('something')->from('somewhere');
$sql $this->db->get_compiled_select();
$this->db->query(sprintf("/*%s*/{$sql}"MYSQLND_MS_MASTER_SWITCH)); 

If that doesn't work for some reason, you can try passing it to simple_query() instead of query().
Reply
#8

(02-09-2016, 07:33 AM)mwhitney Wrote: If you need to build your query with Query Builder for some reason, just use $this->db->get_compiled_select() (/_insert()/_update()/_delete()) to get the SQL generated by Query Builder, then pass it to $this->db->query() with your comments. For example:

PHP Code:
$this->db->select('something')->from('somewhere');
$sql $this->db->get_compiled_select();
$this->db->query(sprintf("/*%s*/{$sql}"MYSQLND_MS_MASTER_SWITCH)); 

If that doesn't work for some reason, you can try passing it to simple_query() instead of query().

I will try in this way, thanks Smile
Reply




Theme © iAndrew 2016 - Forum software by © MyBB