06.09.2014 Views

Bases de datos: Software libre - Universitat Oberta de Catalunya

Bases de datos: Software libre - Universitat Oberta de Catalunya

Bases de datos: Software libre - Universitat Oberta de Catalunya

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

© FUOC • 71Z799014MO 61 <strong>Bases</strong> <strong>de</strong> <strong>datos</strong> en MySQL<br />

El servidor maestro <strong>de</strong>be i<strong>de</strong>ntificarse con un id, en este caso será el número<br />

1. a continuación, reiniciamos el servidor:<br />

/etc/init.d/mysql restart<br />

Finalmente, consultamos el nombre <strong>de</strong>l archivo 'binlog' y la posición <strong>de</strong> compensación<br />

(estos <strong>datos</strong> son necesarios para configurar el esclavo):<br />

mysql> show master status;<br />

+-----------------+----------+--------------+------------------+<br />

| File | Position | Binlog_do_db | Binlog_ignore_db |<br />

+-----------------+----------+--------------+------------------+<br />

| maestro-bin.001 | 76 | | |<br />

+-----------------+----------+--------------+------------------+<br />

5.6.3. Configuración <strong>de</strong>l servidor esclavo<br />

En el servidor esclavo, editamos el archivo /etc/my.cnf y agregamos, al igual<br />

que en el maestro, la activación <strong>de</strong>l archivo 'binlog' y un i<strong>de</strong>ntificador <strong>de</strong>l servidor<br />

(que <strong>de</strong>be ser distinto <strong>de</strong>l i<strong>de</strong>ntificador <strong>de</strong>l servidor maestro):<br />

[mysqld]<br />

log-bin<br />

server-id = 2<br />

Reiniciamos el servidor esclavo:<br />

# /etc/init.d/mysql restart<br />

Configuramos los <strong>datos</strong> <strong>de</strong>l maestro en el servidor esclavo:.<br />

mysql> change master to<br />

-> master_host = ’maestro.empresa.com’,<br />

-> master_user = ’replicador’,<br />

-> master_password = ’secreto’,<br />

-> master_log_file = ’maestro-log.001’,<br />

-> master_log_pos = 76;<br />

El último paso es iniciar el servidor esclavo:<br />

mysql> start slave;<br />

Y ya tendremos el servidor esclavo funcionando.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!