Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mysql double host

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Master01

[client]

Port = 3306

Socket = / home/mysql/socket/mysql.sock

# default-character-set=utf8

[mysqld]

Port = 3306

# character_set_server=utf8

# skip-grant-tables = 1

Character_set_server = utf8

Socket = / home/mysql/socket/mysql.sock

Datadir = / home/mysql/data

Pid-file = / home/mysql/pid/mysql.pid

User = mysql

Bind-address = 0.0.0.0

Server-id = 1 # note here

Skip-name-resolve

Back_log = 600,

Max_connections = 1000

Max_connect_errors = 6000

Open_files_limit = 65535

Table_open_cache = 128,

Max_allowed_packet = 4m

Binlog_cache_size = 1m

Max_heap_table_size = 8m

Tmp_table_size = 16m

Read_buffer_size = 2m

Read_rnd_buffer_size = 8m

Sort_buffer_size = 8m

Join_buffer_size = 8m

Key_buffer_size = 4m

Thread_cache_size = 8

Query_cache_size = 8m

Query_cache_limit = 2m

Ft_min_word_len = 4

Log_bin = mysql-bin

Binlog_format = mixed

Expire_logs_days = 30

Log_error = / home/mysql/error/mysql-error.log

Slow_query_log = 1

Long_query_time = 1

Slow_query_log_file = / home/mysql/slow/mysql-slow.log

Performance_schema = 0

Explicit_defaults_for_timestamp

Skip-external-locking

Default_storage_engine = InnoDB

Innodb_file_per_table = 1

Innodb_open_files = 500,

Innodb_buffer_pool_size = 64m

Innodb_write_io_threads = 4

Innodb_read_io_threads = 4

Innodb_thread_concurrency = 0

Innodb_purge_threads = 1

Innodb_flush_log_at_trx_commit = 2

Innodb_log_buffer_size = 2m

Innodb_log_file_size = 32m

Innodb_log_files_in_group = 3

Innodb_max_dirty_pages_pct = 90

Innodb_lock_wait_timeout = 120

Bulk_insert_buffer_size = 8m

Myisam_sort_buffer_size = 8m

Myisam_max_sort_file_size = 10G

Myisam_repair_threads = 1

Interactive_timeout = 28800

Wait_timeout = 28800

Innodb_file_per_table = ON

Sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

Validate-password = OFF

Log_bin_trust_function_creators = ON

Lower_case_table_names=1

# binlog-ignore-db=mysql

# myql start bantongbu

Rpl_semi_sync_master_enabled=1

# mysql_binlog_size = 500m

Max_binlog_size=1024M

Expire_logs_days=7

Replicate-wild-ignore-table=mysql.% # add here

Replicate-wild-ignore-table=information_schema.% # add here

Replicate-wild-ignore-table=performance_schema.% # add here

Replicate-wild-ignore-table=test.%

# MM#

Auto_increment_offset = 1 # add here

Auto_increment_increment = 2 # add odd and even numbers here

[mysqldump]

Quick

Max_allowed_packet = 16m

[myisamchk]

Key_buffer_size = 8m

Sort_buffer_size = 8m

Read_buffer = 4m

Write_buffer = 4m

# # #

Configuration of master02

[client]

Port = 3306

Socket = / home/mysql/socket/mysql.sock

# default-character-set=utf8

[mysqld]

Port = 3306

# character_set_server=utf8

# skip-grant-tables = 1

Character_set_server = utf8

Socket = / home/mysql/socket/mysql.sock

Datadir = / home/mysql/data

Pid-file = / home/mysql/pid/mysql.pid

User = mysql

Bind-address = 0.0.0.0

Server-id = 3 # it's different here.

Skip-name-resolve

Back_log = 600,

Max_connections = 1000

Max_connect_errors = 6000

Open_files_limit = 65535

Table_open_cache = 128,

Max_allowed_packet = 4m

Binlog_cache_size = 1m

Max_heap_table_size = 8m

Tmp_table_size = 16m

Read_buffer_size = 2m

Read_rnd_buffer_size = 8m

Sort_buffer_size = 8m

Join_buffer_size = 8m

Key_buffer_size = 4m

Thread_cache_size = 8

Query_cache_size = 8m

Query_cache_limit = 2m

Ft_min_word_len = 4

Log_bin = mysql-bin

Binlog_format = mixed

Expire_logs_days = 30

Log_error = / home/mysql/error/mysql-error.log

Slow_query_log = 1

Long_query_time = 1

Slow_query_log_file = / home/mysql/slow/mysql-slow.log

Performance_schema = 0

Explicit_defaults_for_timestamp

Skip-external-locking

Default_storage_engine = InnoDB

Innodb_file_per_table = 1

Innodb_open_files = 500,

Innodb_buffer_pool_size = 64m

Innodb_write_io_threads = 4

Innodb_read_io_threads = 4

Innodb_thread_concurrency = 0

Innodb_purge_threads = 1

Innodb_flush_log_at_trx_commit = 2

Innodb_log_buffer_size = 2m

Innodb_log_file_size = 32m

Innodb_log_files_in_group = 3

Innodb_max_dirty_pages_pct = 90

Innodb_lock_wait_timeout = 120

Bulk_insert_buffer_size = 8m

Myisam_sort_buffer_size = 8m

Myisam_max_sort_file_size = 10G

Myisam_repair_threads = 1

Interactive_timeout = 28800

Wait_timeout = 28800

Innodb_file_per_table = ON

Sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

Validate-password = OFF

Log_bin_trust_function_creators = ON

Lower_case_table_names=1

# binlog-ignore-db=mysql

# myql start bantongbu

Rpl_semi_sync_master_enabled=1

# mysql_binlog_size = 500m

Max_binlog_size=1024M

Expire_logs_days=7

Replicate-wild-ignore-table=mysql.%

Replicate-wild-ignore-table=information_schema.%

Replicate-wild-ignore-table=performance_schema.%

Replicate-wild-ignore-table=test.%

# MM#

Auto_increment_offset = 2 # it's different here.

Auto_increment_increment = 2 # it's different here.

[mysqldump]

Quick

Max_allowed_packet = 16m

[myisamchk]

Key_buffer_size = 8m

Sort_buffer_size = 8m

Read_buffer = 4m

Write_buffer = 4m

# #

Master01

Grant replication slave on. To 'repl_user'@'1922.168.56.11' identified by' repl_passwd'

Show master status

Master02

Change master to

Master_host='192.168.56.10'

Master_user='repl_user'

Master_password='repl_passwd'

Master_log_file='mysql-bin.000046'

Master_log_pos=154

Start slave

# #

Master02

Grant replication slave on. To 'repl_user'@'1922.168.56.10' identified by' repl_passwd'

Show master status

Master01

Change master to

Master_host='192.168.56.11'

Master_user='repl_user'

Master_password='repl_passwd'

Master_log_file='mysql-bin.000046'

Master_log_pos=154

Start slave

# #

At this point, after the dual master has been built, one insertion test is down and the other is inserting the test. It can be seen that the primary keys do not conflict.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report