Solution to master-host problem not supported by Mysql-5.5.3-m3 master-slave Synchronization

Source: Internet
Author: User

Environment:
OS: centos release 5.5 (Final) (64-bit)
2.6.18-194. EL5 #1 SMP Fri APR 2 14:58:14 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
MySQL:
Mysql-5.5.3-m3.tar.gz
MASTER: 192.168.0.100
SLAVE: 192.168.0.200
Most configurations are similar to "MySQL master-slave synchronization, read/write splitting configuration steps, problem solving Notes [original]". However, when configuring from the server, the added replication conditions cannot start the database; however, according to the online message, MySQL versions do not support parameters similar to "Master-host" since 5.1.7;

View the following error message in mysql_error.log;
110105 13:38:00 mysqld_safe mysqld from PID file/data0/MySQL/3306/MySQL. PID ended
110105 13:38:06 mysqld_safe starting mysqld daemon with databases from/data0/MySQL/3306/Data
InnoDB: the InnoDB memory heap is disabled
InnoDB: mutexes and rw_locks use GCC atomic builtins
110105 13:38:06 InnoDB: highest supported file format is barracuda.
110105 13:38:06 InnoDB plugin 1.0.6 started; log sequence number 44309
110105 13:38:06 [Error]/usr/local/webserver/MySQL/libexec/mysqld: Unknown variable 'master-host = 192.168.7.202'
110105 13:38:06 [Error] aborting

110105 13:38:06 InnoDB: Starting shutdown...
110105 13:38:08 InnoDB: shutdown completed; log sequence number 44319
110105 13:38:08 [note]/usr/local/webserver/MySQL/libexec/mysqld: shutdown complete
In desperation, change my. CNF from the database to the following configuration. (In the primary database, note that ID is 1 and add the database to be synchronized)
[Client]
Character-set-Server = utf8
Port = 3306
Socket =/tmp/MySQL. Sock

[Mysqld]
Character-set-Server = utf8
Replicate-ignore-DB = MySQL
Replicate-do-DB = DB
Replicate-ignore-DB = test
Replicate-ignore-DB = information_schema
User = MySQL
Port = 3306
Socket =/tmp/MySQL. Sock
Basedir =/usr/local/MySQL
Datadir =/home/MySQL/Data
Log-error =/home/MySQL/mysql_error.log
PID-file =/home/MySQL. PID
Open_files_limit = 10240
Back_log = 600
Max_connections = 5000
Max_connect_errorrs = 6000
Table_cache = 614
External-locking = false
Max_allowed_packet = 32 m
Sort_buffer_size = 1 m
Join_buffer_size = 1 m
Thread _ cache_size = 300
# Thread_concurrency = 8
Query_cache_size = 512 m
Query_cache_limit = 2 m
Query_cache_min_res_unit = 2 K
Default-storage-engine = MyISAM
Thread_stack = 192 K
Transaction_isolation = read-committed
Tmp_table_size = 246 m
Max_heap_table_size = 246 m
Long_query_time = 3
Log-slave-Updates
Log-bin =/home/MySQL/BINLOG
Binlog_cache_size = 4 m
Binlog_format = mixed
Max_binlog_cache_size = 8 m
Max_binlog_size = 1g
Relay-log-Index =/home/MySQL/relaylog
Relay-log-Info-file =/home/MySQL/relaylog
Relay-log =/home/MySQL/relaylog
Expire_logs_days = 30
Key_buffer_size = 256 m
Read_buffer_size = 1 m
Read_rnd_buffer_size = 16 m
Bulk_insert_buffer_size = 64 m
Myisam_sort_buffer_size = 128 m
Myisam_max_sort_file_size = 10g
Myisam_repair_threads = 1
Myisam_recover
Interactive_timeout = 120
Wait_timeout = 120
Skip-name-resolve
# Master-connect-retry = 10
Slave-Skip-errors = 1396
# Master-host = 192.168.1.2
# Master-user = Username
# Master-Password = Password
# Master-ports = 3306
Server-id = 2
Innodb_additional_mem_pool_size = 16 m
Innodb_buffer_pool_size = 512 m
Innodb_data_file_path = ibdata1: 256 M: autoextend
Innodb_file_io_threads = 4
Innodb_thread_concurrency = 8
Innodb_flush_log_at_trx_commit = 2
Innodb_log_buffer_size = 16 m
Innodb_log_file_size = 128 m
Innodb_log_files_in_group = 3
Innodb_max_dirty_pages_pct = 90
Innodb_lock_wait_timeout = 120
Innodb_file_per_table = 0

# Log-Slow-queries =/home/MySQL/slow. Log

# Long_query_time = 10

[Mysqldump]
Quick
Max_allowed_packet = 32 m

After starting the database, run the following command on the slave database;

Mysql-uroot-S/tmp/MySQL. Sock-P

Change master to master_host = '192. 168.0.100 ', master_user = 'slave', master_password = '******', master_log_file = 'mysql-bin.000010', master_log_pos = 192;
Slave start;
Run: Show slave status \ G; and the following status is displayed;
Mysql> show slave status \ G;
* *************************** 1. row ***************************
Slave_io_state: connecting to master
Master_host: 192.168.0.100
Master_user: slave
Master_port: 3306
Connect_retry: 60
Master_log_file: binlog.20.10
Read_master_log_pos: 16860
Relay_log_file: relaylog.000014
Relay_log_pos: 17003
Relay_master_log_file: binlog.000010
Slave_io_running: Connecting
Slave_ SQL _running: Yes
Replicate_do_db: DB
Replicate_ignore_db: MySQL, test, information_schema
Replicate_do_table:
Replicate_ignore_table:
Replicate_wild_do_table:
Replicate_wild_ignore_table:
Last_errno: 0
Last_error:
Skip_counter: 0
Exec_master_log_pos: 16860
Relay_log_space: 17295
Until_condition: None
Until_log_file:
Until_log_pos: 0
Master_ssl_allowed: No
Master_ssl_ca_file:
Master_ssl_ca_path:
Master_ssl_cert:
Master_ssl_cipher:
Master_ssl_key:
Seconds_behind_master: 0
Master_ssl_verify_server_cert: No
Last_io_errno: 0
Last_io_error:
Last_ SQL _errno: Error reconnecting to master 'slave @ 192.168.0.100: 3306 '-retry-time: 60 retries: 86400
Last_ SQL _error:
Replicate_ignore_server_ids:
Master_server_id: 1
1 row in SET (0.00 Sec)

Error:
No query specified

From the above status, we can see that synchronization from the master database is not yet possible;

Then, log on to the 192.168.0.100 master database to allow data synchronization from the database;
Grant replication slave on *. *
Slave@192.168.0.200 identified '******'
Restart the database again. When you log in to view the status:
Mysql> show slave status \ G;
* *************************** 1. row ***************************
Slave_io_state: Waiting for Master to send event
Master_host: 192.168.0.100
Master_user: datasync
Master_port: 3306
Connect_retry: 60
Master_log_file: binlog.20.10
Read_master_log_pos: 16860
Relay_log_file: relaylog.000014
Relay_log_pos: 17003
Relay_master_log_file: binlog.000010
Slave_io_running: Yes
Slave_ SQL _running: Yes
Replicate_do_db: DB
Replicate_ignore_db: MySQL, test, information_schema
Replicate_do_table:
Replicate_ignore_table:
Replicate_wild_do_table:
Replicate_wild_ignore_table:
Last_errno: 0
Last_error:
Skip_counter: 0
Exec_master_log_pos: 16860
Relay_log_space: 17295
Until_condition: None
Until_log_file:
Until_log_pos: 0
Master_ssl_allowed: No
Master_ssl_ca_file:
Master_ssl_ca_path:
Master_ssl_cert:
Master_ssl_cipher:
Master_ssl_key:
Seconds_behind_master: 0
Master_ssl_verify_server_cert: No
Last_io_errno: 0
Last_io_error:
Last_ SQL _errno: 0
Last_ SQL _error:
Replicate_ignore_server_ids:
Master_server_id: 1
1 row in SET (0.00 Sec)

Error:
No query specified
This operation is complete.
Note: The main configuration of my. CNF for master and slave nodes is ID.

Http://hi.baidu.com/adriannet/blog/item/c4e187ecc586b7c32e2e2100.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.