MySQL Forums
Forum List  »  Replication

Re: Replication pointers
Posted by: Theo Viset
Date: August 30, 2005 05:32AM

Hiall,

maybe I represented my replication incorrectly. I have an A and a B database. When I change data in A it occurs also in B, and vice versa. In operational status, updates will only be done at 1 database, preferrably A which updates B accoringly. In any way, when A dies, B takes over and when A comes back on, B should update A.

However, this discussion did not answer my initial question :-)

Can I setup a replicating database by executing only a script, without the need to execute the "SHOW MASTER STATUS" and "CHANGE MASTER TO MASTER_HOST='hostb', MASTER_USER='repl', MASTER_PASSWORD='someword', MASTER_LOG_FILE='ffidsb-bin.000002', MASTER_LOG_POS=2575;" statements?

These are the my.cnf settings
(Master host)

[mysqld]
log-bin
log-slave-updates
server-id=1
master-host=hostb
master-port=3306
master-user=repl
master-password=someword

(Slave host)

[mysqld]
log-bin
log-slave-updates
server-id=2
master-host=hosta
master-port=3306
master-user=repl
master-password=someword


These are the statements I have in mind to create the db:

FLUSH PRIVILEGES;
CREATE USER MyUSER IDENTIFIED BY 'someword';
CREATE USER repl IDENTIFIED BY 'someword';

CREATE DATABASE MyDB;

GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%' IDENTIFIED BY 'someword';
GRANT SUPER, RELOAD, SELECT ON *.* TO 'repl'@'%' IDENTIFIED BY 'someword';
GRANT ALL ON *.* TO 'root'@'%' IDENTIFIED BY 'someword';
GRANT ALL ON MyDB.* TO 'MyUSER'@'%' IDENTIFIED BY 'someword';
GRANT ALL ON *.* TO 'repl'@'%' IDENTIFIED BY 'someword';

USE FFIDS;
SOURCE SETUP_MyDB.SQL; //Create MyDB structure and tables
SOURCE FIXEDFILES.SQL; // Load initial data

USE MYSQL;
SELECT HOST, USER FROM USER;
UPDATE USER SET HOST = '%' WHERE HOST = 'hosta';

// Setup done

Now, when I do this in both my databases (with crosslinked hostnames of course), do I have to set the pointers correctly, or will the db be replicated correc tly by default?


Greetz, T

Options: ReplyQuote


Subject
Views
Written By
Posted
3171
August 29, 2005 01:45AM
1930
August 29, 2005 03:24AM
1932
August 29, 2005 12:42PM
1969
August 30, 2005 03:52AM
Re: Replication pointers
2118
August 30, 2005 05:32AM
1912
August 31, 2005 11:01AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.