Created
February 24, 2014 21:47
-
-
Save timglabisch/9197877 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""# ""# | |
mmmmm m m mmm mmmm # m mm mmm mmmm # | |
# # # "m m" # " #" "# # #" " #" # #" "# # | |
# # # #m# """m # # # # #"""" # # # | |
# # # "# "mmm" "#m## "mm # "#mm" ##m#" "mm FTW! | |
m" # # | |
"" " " | |
==@timglabisch============================================================= | |
* | |
default mysql setup | |
Mysql | |
default mysql setup | |
+-------------------------+ | |
| | | |
| | | |
| | | |
| Mysql | | |
| | | |
| | | |
| ^ | | |
+------------+------------+ | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
FYI | |
mysql sucks, use pecona, mariadb, galerie, .... | |
- | |
* | |
Basic Replica Setup | |
Master (MySql reads) | |
Replica delivers | |
RW Split | |
+-------------------------+ +-------------------+ | |
| | | | | |
| | | | | |
| | | | | |
| Mysql +------> Replica 1 | | |
| | | (Slave) | | |
| | | | | |
| ^ | | + | | |
+------------+------------+ +---------|---------+ | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| v | |
- | |
* | |
More Complex Stuff | |
Do whatever you want :) | |
+---------> | | |
+-------------------------+ | | <------------------+ | |
| | +----|--+ +-------+ | |
| | | + <-------------------------------+ | |
| +----------> | +-------+ | |
| Mysql | | +------> | | |
| | +-------+ | <-------------------+ | |
| | +-------+ +-----|-+ | |
| ^ +---------> | | | |
+-------------------------+ | <--------------------------------+ | |
| | + | | v | | |
| +---|---+ | <-----------------+ | |
| | +--------+ | |
| | | |
| | +---------+ | |
| | | | | |
| +----> <----------------------+ | |
| | + | +--------+ | |
| +------|--+ | | | |
+----------> | | |
| <-------+ | |
+--------+ | |
* | |
Why RW-splitting sucks? | |
* | |
Master - Master replica | |
+----------------+ +----------------+ | |
| | | | | |
| <------------+> | | |
| | | | | |
| MySql | | MySql | | |
| | | | | |
| | | | | |
| | | | | |
| ^ | | ^ | | |
+-------+--------+ +-------|--------+ | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| + | |
v v | |
* | |
default mysql setup | |
Why Master - Master sucks? | |
* | |
lets setup a basic replica | |
* | |
2 fresh MySql Servers | |
* | |
Prepare Master | |
* | |
# create database and a table | |
* | |
create database foo; | |
* | |
create table proj (id int(10) default null auto_increment, some_key varchar(255), some_value varchar(255), primary key (id) ) character set 'utf8'; | |
* | |
insert some data! | |
* | |
# take a look at the mysql configuration | |
vim /etc/mysql/my.cnf | |
* | |
server-id | |
* | |
log_bin | |
* | |
bind-address | |
* | |
# Master Status | |
show status master\G | |
* | |
# Create some User | |
GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'repl'@'%' IDENTIFIED BY 'repl'; | |
* | |
# Slave Time :) | |
* | |
# my.cnf | |
bind-address | |
readonly? :) | |
* | |
# Configure slave | |
change master to master_host='172.17.2.91', master_user='repl', master_password="repl"; | |
* | |
# starting slave mode | |
start slave; | |
stop slave; | |
* | |
# slave status | |
show slave status\G | |
* | |
# Works? | |
show databases; | |
select * from ... | |
# some DEMO inserts? | |
* | |
# take care of delays | |
* | |
Questions??? :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment