Optimizing MySQL and PHP |
|
2024-11-26 |
|
|
26 |
|
|
Replication can be used to distribute the load across multiple machines, particularly in a SELECT-heavy environment: this also reduces (or eliminates) lock contention on the master server when writing data.
Master Server Configuration
[mysqld]
log-bin
server-id=1
Slave User
GRANT REPLICATION SLAVE ON . TO repl@"%" IDENTIFIED BY 'foobar';
Slave Server Configuration
[mysqld]
set-variable = max_connections=200
log-bin
master-host=192.168.0.1
master-user=repl
master-password=foobar
master-port=3306
server-id=2