Wiki Spaces
Documentation
Projects
Resources
Get Help from Others
Q&A: Ask OpenMRS
Discussion: OpenMRS Talk
Real-Time: IRC Chat | Slack
#: mysql -u root -p #: mysql> GRANT REPLICATION SLAVE on *.* TO 'rep_user'@'amrsresearch' IDENTIFIED BY 'this-is-the-password'; #:
#: [mysqld] #: ## Replication of AMRS database: #: #: # An ID number to give the master (required): #: server_id=1 #: #: # The location and name of the binlog log files (required): #: log-bin="E:/MySQL Data/binlog/amrs-bin" #: #: # This will limit replication to only the amrs database: #: binlog-do-db=amrs #: #: # This keeps only two weeks of binlog files: #: expire_logs_days=14 #: #: # Set to '1' to write to binlog for every SQL statement instead of every transaction #: # (Safest option in case of server crash): #: sync_binlog=1 #:
mysql -u root -p
mysql> FLUSH TABLES WITH READ LOCK;
#: mysql > SHOW MASTER STATUS; #: +----------------+----------+--------------+------------------+ #: | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | #: +----------------+----------+--------------+------------------+ #: | amrs-bin.00001 | 97 | amrs | | #: +----------------+----------+--------------+------------------+ #:
mysqldump -u root -p -q -e --single-transaction -r"amrs_backup.sql" amrs
#: mysql -u root -p #: mysql> source amrs_backup.sql
#: [mysqld] #: ## Replication for AMRS: #: # ID for slave server must be different than master (required): #: server-id=3 #: #: # Ignore these tables to run AMRS on slave server: #: replicate-ignore-table=amrs.global_property #: replicate-ignore-table=amrs.scheduler_task_config #: replicate-ignore-table=amrs.scheduler_task_config_property #: #: # Ignore these tables to run reports using AMRS on slave server: #: replicate-ignore-table=amrs.cohort #: replicate-ignore-table=amrs.cohort_member #: replicate-ignore-table=amrs.report_object #: replicate-ignore-table=amrs.report_schema_xml #: #: # Ignore any module tables you want on slave but not on master: #: replicate-ignore-table=amrs.versionedfileupload_versioned_file #: replicate-ignore-table=amrs.reporttemplate_report_template #:
#: mysql -u root -p #: mysql> CHANGE MASTER TO master_host='amrsprod', #: -> master_user='rep_user', #: -> master_password='this-is-the-password', #: -> master_log_file = “amrs-bin-00001�, #: -> master_log_pos = 97; #:
info| IMPORTANT: Change the master_log_file and master_log_pos to the values copied from the master (AMRSPROD).
mysql> START SLAVE;
mysql> SHOW SLAVE STATUS\G
mysql> UNLOCK TABLES;