How to enable MySQL replication

asked 23 Jun '15, 21:57

Praful's gravatar image

Praful ♦♦
1264923
accept rate: 5%


master ip : 1.2.3.4 (Server to be replicaetd)

slaveip=7.8.9.10 (Server where data is getting replicated)

Update my.cnf of Master:

bind-address = 1.2.3.4

server-id = 1

log_bin = /opt/securonix/data/mysql/mysql-bin.log

binlog_cache_size=64M

skip-name-resolve

binlog_format=mixed

replicate-same-server-id = 0

auto-increment-increment = 1

auto-increment-offset = 2

transaction-isolation=READ-UNCOMMITTED

log_queries_not_using_indexes = 1

Update my.cnf of slave:

bind-address = 7.8.9.10

server-id = 2

binlog_cache_size=64M

skip-character-set-client-handshake

slave_exec_mode=IDEMPOTENT

skip-character-set-client-handshake

plugin-load=thread_pool=thread_pool.so;TP_THREAD_STATE=thread_pool.so

skip-external-locking

skip-name-resolve

binlog_format=mixed

replicate-same-server-id = 0

auto-increment-increment = 2

auto-increment-offset = 1

restart mysql on both master and slave

Execute following commands on Master Mysql Command Prompt:

Create user 'duser'@'%' identified by 'securonix';

grant replication slave on . to 'duser'@'%';

Execute following commands on Master Putty:

mysqldump -ua_securonix --all-databases --master-data > masterdump.sql

grep CHANGE *sql | head -1

Execute following commands on Slave Mysql Command Prompt:

CHANGE MASTER TO MASTER_HOST='1.2.3.4', MASTER_USER = 'druser', MASTER_PASSWORD='securonix';

Execute following commands on Slave Putty:

mysql -ua_securonix < masterdump.sql

Execute following commands on Slave Mysql Command Prompt:

start slave;

show slave status\G;

link

answered 23 Jun '15, 21:58

Praful's gravatar image

Praful ♦♦
1264923
accept rate: 5%

edited 25 Jun '15, 10:44

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×6
×1
×1

Asked: 23 Jun '15, 21:57

Seen: 1,161 times

Last updated: 25 Jun '15, 10:44