Reasons for Master-slave configuration:
Master (the primary database) is responsible for the load of the write operation, which means that everything written is done on master, while the read operation is distributed to slave (from the database). This can greatly improve the efficiency of reading. In the general Internet application, after some data survey concluded that the ratio of read/write is about 10:1, that is, a large number of data manipulation is focused on the operation of Reading, which is why we have multiple slave reasons. But why separate reading and writing? Developers familiar with the DB know that the write operation involves the lock problem, whether it is a row lock or a table lock or block lock, is a comparison to reduce the efficiency of the system to do things. Our separation is to focus the write operation on one node, while the read operation of its other n nodes, from another aspect effectively improve the efficiency of reading, ensure the high availability of the system.
$config = Array ();
Main Library Configuration
$config [' db '] [' master '] [' host '] = ' localhost ';
$config [' db '] [' master '] [' username '] = ' root ';
$config [' db '] [' master '] [' password '] = ' root ';
$config [' db '] [' master '] [' port '] = ' 3306 ';
$config [' db '] [' master '] [' database '] = ' weiqing ';
$config [' db '] [' master '] [' charset '] = ' UTF8 ';
$config [' db '] [' master '] [' pconnect '] = 0;
$config [' db '] [' master '] [' tablepre '] = ' ims_ ';
Configure the master-slave library configuration from the library should be consistent
$config [' db '] [' slave_status '] = false; Whether to turn on master configuration
$config [' db '] [' slave '] [' 1 '] [' host '] = ';
$config [' db '] [' slave '] [' 1 '] [' username '] = ';
$config [' db '] [' slave '] [' 1 '] [' password '] = ';
$config [' db '] [' slave '] [' 1 '] [' port '] = ' 3307 ';
$config [' db '] [' slave '] [' 1 '] [' database '] = ';
$config [' db '] [' slave '] [' 1 '] [' charset '] = ' UTF8 ';
$config [' db '] [' slave '] [' 1 '] [' pconnect '] = 0;
$config [' db '] [' slave '] [' 1 '] [' tablepre '] = ' ims_ ';
$config [' db '] [' slave '] [' 1 '] [' weight '] = 0;
$config [' db '] [' common '] [' slave_except_table '] = Array (' core_sessions ');
--------------------------CONFIG COOKIE---------------------------//
$config [' Cookie '] [' pre '] = ' c432_ ';
$config [' Cookie '] [' domain '] = ';
$config [' Cookie '] [' path '] = '/';
--------------------------CONFIG SETTING---------------------------//
$config [' Setting '] [' charset '] = ' utf-8 ';
$config [' Setting '] [' cache '] = ' memcache ';
$config [' Setting '] [' timezone '] = ' Asia/shanghai ';
$config [' Setting '] [' memory_limit '] = ' 256M ';
$config [' Setting '] [' filemode '] = 0644;
$config [' Setting '] [' authkey '] = ' 4c2c9fd4 ';
$config [' Setting '] [' founder '] = ' 1 ';
$config [' Setting '] [' development '] = 1;
$config [' Setting '] [' referrer '] = 0;
$config [' Setting '] [' https '] = 0;
--------------------------CONFIG UPLOAD---------------------------//
$config [' Upload '] [' image '] [' extentions '] = array (' gif ', ' jpg ', ' jpeg ', ' png ');
$config [' Upload '] [' image '] [' limit '] = 5000;
$config [' Upload '] [' attachdir '] = ' attachment ';
$config [' Upload '] [' Audio '] [' extentions '] = Array (' MP3 ');
$config [' Upload '] [' Audio '] [' limit '] = 5000;
--------------------------CONFIG MEMCACHE---------------------------//
$config [' Setting '] [' memcache '] [' server '] = ' 127.0.0.1 ';
$config [' Setting '] [' memcache '] [' port '] = 11211;
$config [' Setting '] [' memcache '] [' pconnect '] = 1;
$config [' Setting '] [' memcache '] [' timeout '] = 30;
$config [' Setting '] [' memcache '] [' session '] = 1;
$config [' Setting '] [' memcache '] [' sql '] = 1;
--------------------------CONFIG PROXY---------------------------//
$config [' Setting '] [' Proxy '] [' host '] = ';
$config [' Setting '] [' Proxy '] [' auth '] = ';
Points Deduction
$config [' Setting '] [' Redis '] [' server '] = ';
$config [' Setting '] [' Redis '] [' port '] = 6379;
$config [' Setting '] [' Redis '] [' pconnect '] = 0;
$config [' Setting '] [' Redis '] [' requirepass '] = ';
$config [' Setting '] [' Redis '] [' timeout '] = 30;
Micro-master Configuration