设置配置文件:
cat >> /etc/my.cnf << EOF [client] port = 3306 socket = /tmp/mysql.sock #character-set-server = utf8 [mysqld] connect_timeout = 20 basedir = /usr/local/mysql datadir = /data/mysql-5.5/data user = mysql port = 3306 socket = /tmp/mysql.sock pid-file = /data/mysql-5.5/data/mysql.pid ##init_connect = 'SET AUTOCOMMIT=1' character-set-server = utf8 open_files_limit = 10240 table_open_cache = 6144 table_definition_cache = 4096 table_cache = 512 max_connections = 1100 max_connect_errors = 1000 back_log = 500 event_scheduler = ON external-locking = FALSE skip-name-resolve #default_table_type = MyISAM server-id = 10 #master-host = 192.168.8.31 #master-user = repl #master-password = repl #replicate-ignore-db=mysql slave-net-timeout=35 #master-connect-retry=30 #relay-log = relay-bin #max-relay-log-size = 128M #skip-slave-start #replicate-same-server-id=0 #log_slave_update #replicate-do-db=WATCDB01 #replicate-do-db=WATCDB02 #replicate-do-db=WATCDB03 #replicate-do-db=WATCDB04 wait_timeout=100 interactive_timeout = 100 ##Add for debug,record all the sql ##log = /usr/local/mysql/fetiondata/data/g_log.log ##innodb_status_file = 1 # #tmpdir = /tmp tmpdir = /data/mysql-5.5/tmp tmp_table_size = 32M max_heap_table_size = 64M thread_cache_size = 64 thread_concurrency = 32 thread_stack = 192K max_allowed_packet = 16M sort_buffer_size = 512k join_buffer_size = 512k query_cache_size = 0 query_cache_limit = 2M key_buffer_size = 64M read_buffer_size = 512k read_rnd_buffer_size = 512k bulk_insert_buffer_size = 32M binlog_format = mixed #binlog_cache_size = 1M #log-bin = /data/mysql-5.5/logs/mysql-bin max_binlog_size = 128M #log_long_format slow-query-log slow-query-log-file = mysql.slow #log_queries_not_using_indexes = 0 long_query_time = 1 myisam_sort_buffer_size = 32M myisam_max_sort_file_size = 10G #myisam_max_extra_sort_file_size = 10G myisam_repair_threads = 1 myisam_recover log_error = /data/mysql-5.5/logs/error.log # READ-UNCOMMITTED, READ-COMMITTED, REPEATABLE-READ, SERIALIZABLE #default#transaction_isolation = REPEATABLE-READ transaction_isolation = READ-COMMITTED #innodb_checksums = 0 #innodb_doublewrite = 0 innodb_flush_method = O_DIRECT #96G innodb_buffer_pool_size = 48G #innodb_buffer_pool_size = 60G #innodb_buffer_pool_instances = 10 innodb_buffer_pool_instances = 4 #innodb_buffer_pool_size = 33G innodb_additional_mem_pool_size = 16M innodb_data_home_dir = #innodb_data_file_path = ibdata1:20G;ibdata2:20G;ibdata3:20G;ibdata4:20G;ibdata5:20G;ibdata6:20G;ibdata7:20G;ibdata8:100M:autoextend innodb_data_file_path = ibdata1:2048M:autoextend innodb_log_group_home_dir = /data/mysql-5.5/logs innodb_log_buffer_size = 16M innodb_log_file_size = 1024M innodb_log_files_in_group = 3 innodb_thread_concurrency = 288 innodb_thread_sleep_delay = 500 #innodb_file_io_threads = 8 innodb_concurrency_tickets = 1000 innodb_sync_spin_loops=40 ##innodb_force_recovery is only used for recovery mode; ##innodb_force_recovery = 3 innodb_flush_log_at_trx_commit = 0 innodb_max_dirty_pages_pct = 90 #innodb_lock_wait_timeout = 120 innodb_lock_wait_timeout = 10 innodb_support_xa = 0 #Added to allow create function log_bin_trust_function_creators = 1 innodb_file_per_table = 1 #turn innodb_stats_on_metadata=0 innodb_old_blocks_pct=20 innodb_change_buffering=all #innodb_max_purge_lag innodb_purge_threads=1 innodb_purge_batch_size = 32 innodb_read_io_threads = 8 innodb_write_io_threads = 8 innodb_io_capacity = 2000 innodb_file_format = Barracuda #manage performance_schema performance_schema_events_waits_history_size=100 performance_schema_events_waits_history_long_size=30000 #innodb_strict_mode=1 [mysqldump] quick max_allowed_packet = 128M [mysql] no-auto-rehash [mysqlhotcopy] interactive-timeout [mysqld_safe] open-files-limit = 28192 EOF注意两点:
1).在两台MySQL服务器上开启bin-log日志,默认是开启的!
2).另外一台服务器节点的server-id设置为20,本来设置为10
2.将31服务器设置32的主服务器