Subversion Repositories bacoAlunos

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1464 jmachado 1
 
2
 
3
 
4
SET GLOBAL relay_log_info_repository = 'TABLE';
5
6
depois alterar no my.conf na parte do mysqld para isto
7
8
 
9
master-info-repository=TABLE
10
 
11
#####################################
12
13
SERVER EXEMPLO: 172.20.100.141
14
SLAVE EXEMPLO: 172.20.100.20
15
 
16
17
NO MASTER QUE VAI SER REPLICADO
18
 
19
 
20
21
 
22
#comentar a linha assim:
23
 
24
25
#procurar a linha server-id e colocar assim:
26
server-id               = 1
27
 
28
#definir o log file e a base de dados que poderá ser replicada:
29
log_bin                 = /var/log/mysql/mysql-bin.log
30
 
31
32
#Como temos trasaction ISOLATION READ_COMMITED
33
#adicionat a linha
34
 
35
binlog_format=row
36
37
 
38
/etc/init.d/mysql restart
39
 
40
#AGORA ENTRAMOS NO MYSQL
41
mysql -u root
42
 
43
#GARANTIR DIREITOS DE REPLICACAO AO SLAVE
44
GRANT REPLICATION SLAVE ON *.* TO 'baco'@'172.20.100.20' IDENTIFIED BY 'baco1232008estg';
45
 
46
FLUSH PRIVILEGES;
47
48
 
49
#FAZER DUMP DA BASE DE DADOS
50
 
51
 
52
Reading table information for completion of table and column names
53
 
54
55
Database changed
56
mysql> FLUSH TABLES WITH READ LOCK;
57
 
58
59
60
61
 
62
 
63
 
64
+------------------+----------+--------------+------------------+
65
| mysql-bin.000001 |      107 | pae          |                  |
66
+------------------+----------+--------------+------------------+
67
1 row in set (0.00 sec)
68
69
mysql> UNLOCK TABLES;
70
71
 
72
mysqldump -u root -p --opt pae > pae-para-slave.sql
73
 
74
#NO MYSQL
75
UNLOCK TABLES;
76
 
77
78
#COPIAR O FICHEIRO PARA O SLAVE 172.20.100.20
79
#SE FOR EM LINUX FAZER ASSIM EXEMPLO que copia para a pasta onde estamos que é o ".":
80
 
81
82
#entrar no mysql do salve
83
create database pae;
84
 
85
#sair
86
quit
87
 
88
#carregar base de dados
89
mysql -uroot -pbaco1232008estg pae < pae-para-slave.sql
90
 
91
92
93
 
94
 
95
 
96
 
97
 
98
sudo service mysql restart
99
The next step is to enable the replication from within the MySQL shell.
100
101
Open up the the MySQL shell once again and type in the following details, replacing the values to match your information:
102
103
 
104
START SLAVE;
105
 
106

107
Generated by GNU Enscript 1.6.5.2.
108