Subversion Repositories bacoAlunos

Compare Revisions

Ignore whitespace Rev 1463 → Rev 1464

/branches/v3/impl/src/doc/BacoV32016/linuxInstall/How To Set Up Master Slave Replication in MySQL _ DigitalOcean_files.zip
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/branches/v3/impl/src/doc/BacoV32016/linuxInstall/mysql/mysqlreplication.txt
New file
0,0 → 1,108
 
 
 
#PARA MYSQL SLAVE JA EM FUNCIONAMENTO COM BASE EM UM MASTER E FUNCIONANDO COM FICHEIROS
STOP SLAVE;
SET GLOBAL master_info_repository = 'TABLE';
SET GLOBAL relay_log_info_repository = 'TABLE';
 
depois alterar no my.conf na parte do mysqld para isto
 
[mysqld]
master-info-repository=TABLE
relay-log-info-repository=TABLE
#####################################
 
SERVER EXEMPLO: 172.20.100.141
SLAVE EXEMPLO: 172.20.100.20
 
 
NO MASTER QUE VAI SER REPLICADO
 
sudo apt-get install mysql-server mysql-client
 
sudo nano /etc/mysql/my.cnf
#comentar a linha assim:
#bind-address = 127.0.0.1
 
#procurar a linha server-id e colocar assim:
server-id = 1
 
#definir o log file e a base de dados que poderá ser replicada:
log_bin = /var/log/mysql/mysql-bin.log
binlog_do_db = pae
 
#Como temos trasaction ISOLATION READ_COMMITED
#adicionat a linha
 
binlog_format=row
 
#reiniciar tomcat
/etc/init.d/mysql restart
 
#AGORA ENTRAMOS NO MYSQL
mysql -u root
 
#GARANTIR DIREITOS DE REPLICACAO AO SLAVE
GRANT REPLICATION SLAVE ON *.* TO 'baco'@'172.20.100.20' IDENTIFIED BY 'baco1232008estg';
 
FLUSH PRIVILEGES;
 
 
#FAZER DUMP DA BASE DE DADOS
 
mysql> \u pae
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
 
Database changed
mysql> FLUSH TABLES WITH READ LOCK;
Query OK, 0 rows affected (0.00 sec)
 
 
 
mysql> SHOW MASTER STATUS;
+------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000001 | 107 | pae | |
+------------------+----------+--------------+------------------+
1 row in set (0.00 sec)
 
mysql> UNLOCK TABLES;
 
ENTRAR EM NOVO TERMNAL SEM MECHER NESTE
mysqldump -u root -p --opt pae > pae-para-slave.sql
 
#NO MYSQL
UNLOCK TABLES;
QUIT;
 
#COPIAR O FICHEIRO PARA O SLAVE 172.20.100.20
#SE FOR EM LINUX FAZER ASSIM EXEMPLO que copia para a pasta onde estamos que é o ".":
scp jmachado@pae.ipportalegre.pt:/home/jmachado/pae-para-slave.sql .
 
#entrar no mysql do salve
create database pae;
 
#sair
quit
 
#carregar base de dados
mysql -uroot -pbaco1232008estg pae < pae-para-slave.sql
 
 
 
 
 
elay-log = /var/log/mysql/mysql-relay-bin.log
log_bin = /var/log/mysql/mysql-bin.log
binlog_do_db = newdatabase
sudo service mysql restart
The next step is to enable the replication from within the MySQL shell.
 
Open up the the MySQL shell once again and type in the following details, replacing the values to match your information:
 
CHANGE MASTER TO MASTER_HOST='172.20.100.141',MASTER_USER='baco', MASTER_PASSWORD='baco1232008estg', MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS= 107;
START SLAVE;
SHOW SLAVE STATUS
/branches/v3/impl/src/web/user/home/todos.jsp
34,117 → 34,120
{
%>
 
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="panel panel-primary">
<div class="panel-heading"><bean:message key="intranet.todo"/></div>
<div class="panel-body">
 
<div class="panel panel-primary">
<div class="panel-heading"><bean:message key="intranet.todo"/></div>
<div class="panel-body">
 
 
 
 
<%
for (IToDoCat toDoCat : todos)
{
String imgClose;
String imgOpen;
String style;
String img;
String styleClass;
// Duarte Santos
if (toDoCat.getDescription().equals(ModuleEnum.TodoAnnouncements.getMessageKey()) || toDoCat.getDescription().equals(ModuleEnum.Surveys.getMessageKey()))
{
styleClass = "WARNING";
img = "/imgs/openedboxNeg.gif";
style = "";
imgClose = "/imgs/closedboxNeg.gif";
imgOpen = "/imgs/openedboxNeg.gif";
 
<%
for (IToDoCat toDoCat : todos)
{
String imgClose;
String imgOpen;
String style;
String img;
String styleClass;
// Duarte Santos
if (toDoCat.getDescription().equals(ModuleEnum.TodoAnnouncements.getMessageKey()) || toDoCat.getDescription().equals(ModuleEnum.Surveys.getMessageKey()))
{
styleClass = "WARNING";
img = "/imgs/openedboxNeg.gif";
style = "";
imgClose = "/imgs/closedboxNeg.gif";
imgOpen = "/imgs/openedboxNeg.gif";
}
//Filipe Matos
else
if(toDoCat.getDescription().equals(ModuleEnum.TodoAnnouncements.getMessageKey()) || toDoCat.getDescription().equals(ModuleEnum.Assessments.getMessageKey())){
 
}
//Filipe Matos
else
if(toDoCat.getDescription().equals(ModuleEnum.TodoAnnouncements.getMessageKey()) || toDoCat.getDescription().equals(ModuleEnum.Assessments.getMessageKey())){
styleClass = "WARNING";
img = "/imgs/openedboxNeg.gif";
style = "";
imgClose = "/imgs/closedboxNeg.gif";
imgOpen = "/imgs/openedboxNeg.gif";
}
else
if (toDoCat.getDescription().equals(ModuleEnum.Reminders.getMessageKey()) || toDoCat.getDescription().equals(ModuleEnum.CourseUnits.getMessageKey()))
{
styleClass = "";
img = "/imgs/openedbox.gif";
style = "";
imgClose = "/imgs/closedbox.gif";
imgOpen = "/imgs/openedbox.gif";
}
else
{
styleClass = "";
img = "/imgs/closedbox.gif";
style = Globals.HIDDEN;
imgClose = "/imgs/closedbox.gif";
imgOpen = "/imgs/openedbox.gif";
}
%>
 
styleClass = "WARNING";
img = "/imgs/openedboxNeg.gif";
style = "";
imgClose = "/imgs/closedboxNeg.gif";
imgOpen = "/imgs/openedboxNeg.gif";
}
else
if (toDoCat.getDescription().equals(ModuleEnum.Reminders.getMessageKey()) || toDoCat.getDescription().equals(ModuleEnum.CourseUnits.getMessageKey()))
{
styleClass = "";
img = "/imgs/openedbox.gif";
style = "";
imgClose = "/imgs/closedbox.gif";
imgOpen = "/imgs/openedbox.gif";
}
else
{
styleClass = "";
img = "/imgs/closedbox.gif";
style = Globals.HIDDEN;
imgClose = "/imgs/closedbox.gif";
imgOpen = "/imgs/openedbox.gif";
}
%>
<div class="list-group">
<div class="list-group-item list-group-item-warning"><%=MessageResources.getMessage(request, toDoCat.getDescription())%> (<%=toDoCat.getTotalToDo()%>)</div>
 
<div class="list-group">
<div class="list-group-item-heading"><%=MessageResources.getMessage(request, toDoCat.getDescription())%> (<%=toDoCat.getTotalToDo()%>) <img alt="abrir" src="<%=request.getContextPath() + img%>" onclick="this.src=showOrHide('<%=toDoCat.getDescription()%>','<%=request.getContextPath() + imgClose%>','<%=request.getContextPath() + imgOpen%>')" ></div>
</div>
 
 
 
<%--<ul id="<%=toDoCat.getDescription()%>" style="<%=style%>">--%>
<%
for (IToDo todo : toDoCat.getAllToDos())
{
 
if (todo.getUrl() != null)
{
%>
<div class="list-group-item">
<%--<ul id="<%=toDoCat.getDescription()%>" style="<%=style%>">--%>
<%
for (IToDo todo : toDoCat.getAllToDos())
{
 
<a href="<%=request.getContextPath() + todo.getUrl()%>">
 
<%
if(todo.getCatArg0() == null && todo.getCatKey() != null)
if (todo.getUrl() != null)
{
out.print(MessageResources.getMessage(request,todo.getCatKey()) + ":");
}
else if(todo.getCatArg0() != null && todo.getCatKey() != null)
{
out.print(MessageResources.getMessage(request,todo.getCatKey(),todo.getCatArg0()) + ":");
}
%>
<div class="list-group-item">
 
%>
<a href="<%=request.getContextPath() + todo.getUrl()%>">
 
<%
if(todo.getCatArg0() == null && todo.getCatKey() != null)
{
out.print(MessageResources.getMessage(request,todo.getCatKey()) + ":");
}
else if(todo.getCatArg0() != null && todo.getCatKey() != null)
{
out.print(MessageResources.getMessage(request,todo.getCatKey(),todo.getCatArg0()) + ":");
}
 
%>
<%=todo.getLabelInsideCat(request)%>
<img src="<%=request.getContextPath()%>/imgs/preencher.gif" width="35px"/>
</a>
 
</div>
<%
}
else
{
%>
<div class="list-group-item">
<%=todo.getLabelInsideCat(request)%>
</div>
<%
}
}
%>
 
</a>
 
</div>
</div>
 
<%
}
else
{
%>
<div class="list-group-item">
<%=todo.getLabelInsideCat(request)%>
</div>
<%
}
}
%>
 
 
</div>
 
<%
}
%>
 
</div>
</div>
</div>
<%