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 multi-instance installation and common operation and maintenance points

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Important: when configuring GNR, all GNR should be named in [mysqld xxx] format, otherwise an error of finding GNR will be reported.

Prepare the Mysqld_multi configuration file to join the configuration information of multiple instances

Specify GNR to start the instance (do not specify the keyword MYSQLD)

Mysqld_multi start 3308

Specify the port and SOCK file to shut down the instance

Mysqladmin-uroot-p123456-P3307-S/mydata/data2/mysql.sock shutdown

Specify connection instance

Mysql-uroot-p123456-S/mydata/data2/mysql.sock

Specify the startup instance

Mysqld_multi start mysqld3307

The following is the configuration file for multiple instances

[client]

# socket = / mydata/data/mysql.sock

[mysqld_multi]

Log=/mydata/mysqld_multi.log

# mysqld=/usr/sbin/mysqld

User=mysql

# basedir = / usr

# sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

[mysqld3306]

# basic settings#

User=mysql

Server-id = 333

Port = 3306

Socket=/mydata/data/master1.sock

# skip-grant-tables

Character_set_server=utf8

Skip_name_resolve = 1

Max_connections = 2000

Max_connect_errors = 1000

Datadir = / mydata/data

Explicit_defaults_for_timestamp = 1

Join_buffer_size = 134217728

Tmp_table_size = 67108864

Tmpdir = / tmp

Lower_case_table_names=1

Log_error = error.log

# replication settings#

Master_info_repository = TABLE

Relay_log_info_repository = TABLE

Log_bin = bin.log

Gtid_mode = on

Enforce_gtid_consistency = 1

Log_slave_updates

Binlog_format = row

Relay_log = relay.log

Relay_log_recovery = 1

# binlog_gtid_simple_recovery = 1

Slave_skip_errors = ddl_exist_errors

# innodb settings#

Innodb_buffer_pool_size = 1G

Innodb_buffer_pool_instances = 8

Innodb_lock_wait_timeout = 50

Innodb_log_file_size = 500m

Innodb_purge_threads = 4

Innodb_large_prefix = 1

Innodb_thread_concurrency = 64

Innodb_print_all_deadlocks = 1

Innodb_strict_mode = 1

Innodb_sort_buffer_size = 67108864

# semi sync replication settings#

# plugin_dir=/usr/local/mysql/lib/plugin

# plugin_load = "rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so"

Loose_rpl_semi_sync_master_enabled = 1

Loose_rpl_semi_sync_slave_enabled = 1

Loose_rpl_semi_sync_master_timeout = 5000

[mysqld3307]

# basic settings#

User=mysql

Server-id = 789

Port = 3307

Skip-grant-tables

Socket=/mydata/data2/master2.sock

Character_set_server=utf8

Skip_name_resolve = 1

Max_connections = 2000

Max_connect_errors = 1000

Datadir = / mydata/data2

Explicit_defaults_for_timestamp = 1

Join_buffer_size = 134217728

Tmp_table_size = 67108864

Tmpdir = / tmp

Lower_case_table_names=1

Log_error = error.log

# replication settings#

Master_info_repository = TABLE

Relay_log_info_repository = TABLE

Log_bin = bin.log

Gtid_mode = on

Enforce_gtid_consistency = 1

Log_slave_updates

Binlog_format = row

Relay_log = relay.log

Relay_log_recovery = 1

# binlog_gtid_simple_recovery = 1

Slave_skip_errors = ddl_exist_errors

# innodb settings#

Innodb_buffer_pool_size = 1G

Innodb_buffer_pool_instances = 8

Innodb_lock_wait_timeout = 50

Innodb_log_file_size = 500m

Innodb_purge_threads = 4

Innodb_large_prefix = 1

Innodb_thread_concurrency = 64

Innodb_print_all_deadlocks = 1

Innodb_strict_mode = 1

Innodb_sort_buffer_size = 67108864

# semi sync replication settings#

# plugin_dir=/usr/local/mysql/lib/plugin

# plugin_load = "rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so"

Loose_rpl_semi_sync_master_enabled = 1

Loose_rpl_semi_sync_slave_enabled = 1

Loose_rpl_semi_sync_master_timeout = 5000

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