导读

作者:蒋乐兴    MySQL-DBA 目前在 github 上维护着两套 MySQL 开源工具 mysqltools & dbm(dbm-agent dbm-center),对机器学习和程序化交易也有些心得。

640?wx_fmt=gif

一想到你在关注我就忍不住有点紧张

目录

  • 用dbm来解放生产力

  • 安装&初始化dbm-agent

  • 一行命令解决安装单机的问题

  • 一行命令解决增加slave的问题

  • 一行命令解决搭建MGR集群的问题

  • dbm-agent建设出来的实例质量如何

一、用dbm来解放生产力

对于 dbm 来说不管你是搭建单机、主从复制、异或是 MGR 都只需要一行命令就能高效、高质量的解决;并且几乎不会有任何成本(dbm是全开源的,包含dbm-agent,dbm-center),下面先来检验一下 dbm-agent 常来的效率提升。

二、安装&初始化dbm-agent
1、 通过 pip3 这个 python 包管理工具来安装 dbm-agent
   bash	
   sudo su	
   pip3 install dbm-agent	
   Installing collected packages: dbm-agent	
     Running setup.py install for dbm-agent ... done	
   Successfully installed dbm-agent-0.4.2

2、 初始化 dbm-agent

   bash	
   sudo su	
   dbm-agent init	
   # 成功后可以看到如下目录结构	
   tree /usr/local/dbm-agent/	
   ├── etc	
   │   ├── dbma.cnf          # dbm-agent 的配置文件	
   │   ├── init-users.sql    # 在初始化数据库里将使用这个文件中的用户名和密码来创建用户	
   │   └── templates	
   │       ├── create-innodb-cluster.js	
   │       ├── init-users.sql.jinja	
   │       ├── mysql-8.0.17.cnf.jinja    # mysql-8.0.17 版本对应的配置文件模板	
   │       ├── mysql-8.0.18.cnf.jinja    # mysql-8.0.18 版本对应的配置文件模板	
   │       ├── mysql-8.0-init-only.jinja # 只有初始化时才用到的配置文件	
   │       └── mysqld.service.jinja      # mysql systemd 配置文件模板	
   ├── logs    # dbm-agent 的日志文件保存目录(只要有守护进程模式下才会向这时写日志)	
   └── pkg

init 的时候可以通过 --init-pwd 设置 mysql 用户的密码,如果没有指定那么默认为 dbma@0352

3、 下载 mysql 与 mysql-shell 的二进制安装包到 /usr/local/dbm-agent/pkg, 完成后目录的内容如下

   bash	
   tree /usr/local/dbm-agent/pkg	
   ├── mysql-8.0.18-linux-glibc2.12-x86_64.tar.xz          # 各个软件的安装包(要自己下载并保存到这里,dbm-agent不会自动下载它	
   └── mysql-shell-8.0.18-linux-glibc2.12-x86-64bit.tar.gz # 各个软件的安装包(要自己下载并保存到这里,dbm-agent不会自动下载它)

下面的内容不会再加上 sudo su 了,默认都在 root 下运行


三、一行命令解决安装单机的问题

1、 安装一个监听在 3306 端口上的实例,限制它最大给用 1G 内存

   bash	
   dbma-cli-single-instance --port=3306 --max-mem=1024 install	
   2019-11-17 16:48:03,108 - dbm-agent.dbma.mysqldeploy.SingleInstanceInstaller.install - im - INFO - 1115 - execute checkings for install mysql	
   2019-11-17 16:48:03,135 - dbm-agent.dbma.mysqldeploy.SingleInstanceInstaller._create_mysql_user - im - INFO - 864 - create user 'mysql3306' complete	
   2019-11-17 16:48:03,136 - dbm-agent.dbma.mysqldeploy.SingleInstanceInstaller._create_data_dir - im - INFO - 888 - create datadir '/database/mysql/data/3306' complete	
   2019-11-17 16:48:03,137 - dbm-agent.dbma.mysqldeploy.SingleInstanceInstaller._create_binlog_dir - im - INFO - 910 - create binary dir '/binlog/mysql/binlog/3306' complete	
   2019-11-17 16:48:03,138 - dbm-agent.dbma.mysqldeploy.SingleInstanceInstaller._create_backup_dir - im - INFO - 932 - create backup dir '/backup/mysql/backup/3306' complete	
   2019-11-17 16:48:03,138 - dbm-agent.dbma.mysqldeploy.MyCnfInitRender.render_template_file - im - INFO - 518 - using template 'mysql-8.0-init-only.jinja' 	
   2019-11-17 16:48:03,138 - dbm-agent.dbma.mysqldeploy.MyCnfInitRender.set_template - im - INFO - 457 - using template file 'mysql-8.0-init-only.jinja' 	
   2019-11-17 16:48:03,175 - dbm-agent.dbma.mysqldeploy.MyCnfInitRender.render - im - INFO - 497 - render mysql config file /tmp/mysql-init.cnf	
   2019-11-17 16:48:03,175 - dbm-agent.dbma.mysqldeploy.MyCnfInitRender.render_template_file - im - INFO - 524 - render template file complete	
   2019-11-17 16:48:03,175 - dbm-agent.dbma.mysqldeploy.MyCnfMSRender.render_template_file - im - INFO - 548 - using template 'mysql-8.0.18.cnf.jinja' 	
   2019-11-17 16:48:03,175 - dbm-agent.dbma.mysqldeploy.MyCnfMSRender.set_template - im - INFO - 457 - using template file 'mysql-8.0.18.cnf.jinja' 	
   2019-11-17 16:48:03,208 - dbm-agent.dbma.mysqldeploy.MyCnfMSRender.render - im - INFO - 497 - render mysql config file /etc/my-3306.cnf	
   2019-11-17 16:48:03,208 - dbm-agent.dbma.mysqldeploy.MyCnfMSRender.render_template_file - im - INFO - 554 - render template file complete	
   2019-11-17 16:48:03,208 - dbm-agent.dbma.mysqldeploy.SingleInstanceInstaller._render_production_cnf - im - INFO - 956 - render production cnf complete	
   2019-11-17 16:48:03,209 - dbm-agent.dbma.mysqldeploy.SingleInstanceInstaller._init_database - im - INFO - 1004 - ['/usr/local/mysql-8.0.18-linux-glibc2.12-x86_64/bin/mysqld', '--defaults-file=/tmp/mysql-init.cnf', '--initialize-insecure', '--user=mysql3306', '--init-file=/usr/local/dbm-agent/etc/init-users.sql']	
   2019-11-17 16:48:13,963 - dbm-agent.dbma.mysqldeploy.SingleInstanceInstaller._init_database - im - INFO - 1011 - init database complete	
   2019-11-17 16:48:13,967 - dbm-agent.dbma.mysqldeploy.MySQLSystemdRender.render - im - INFO - 666 - render systemd config file complete	
   2019-11-17 16:48:13,967 - dbm-agent.dbma.mysqldeploy.SingleInstanceInstaller._config_systemd - im - INFO - 1027 - mysql systemd config complete	
   2019-11-17 16:48:14,146 - dbm-agent.dbma.mysqldeploy.SingleInstanceInstaller._enable_mysql - im - INFO - 1038 - config mysql auto start on boot complete	
   2019-11-17 16:48:16,172 - dbm-agent.dbma.mysqldeploy.SingleInstanceInstaller._start_mysql - im - INFO - 1068 - start mysql complete	
   2019-11-17 16:48:16,173 - dbm-agent.dbma.mysqldeploy.SingleInstanceInstaller._export_path - im - INFO - 1078 - export path complete	
   2019-11-17 16:48:16,177 - dbm-agent.dbma.mysqldeploy.SingleInstanceInstaller._export_header_file - im - INFO - 1106 - export header file complete	
   2019-11-17 16:48:16,177 - dbm-agent.dbma.mysqldeploy.SingleInstanceInstaller._export_so - im - INFO - 1093 - so file has been exported	
   2019-11-17 16:48:16,177 - dbm-agent.dbma.mysqldeploy.SingleInstanceInstaller.install - im - INFO - 1150 - install mysql single instance complete

2、 检查进程是否运行

   bash	
   ps -ef | grep mysql	
   mysql33+   7418      1  1 16:48 ?        00:00:02 /usr/local/mysql-8.0.18-linux-glibc2.12-x86_64/bin/mysqld --defaults-file=/etc/my-3306.cnf                                                      	
   root       7463   7271  0 16:51 pts/0    00:00:00 grep --color=auto mysql

3、 连接进去测试一下

   sql	
   mysql -h127.0.0.1 -P3306 -uroot -pdbma@0352	
   mysql: [Warning] Using a password on the command line interface can be insecure.	
   Welcome to the MySQL monitor.  Commands end with ; or \g.	
   Your MySQL connection id is 8	
   Server version: 8.0.18 MySQL Community Server - GPL	
   Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.	
   Oracle is a registered trademark of Oracle Corporation and/or its	
   affiliates. Other names may be trademarks of their respective	
   owners.	
   Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.	
   mysql> select user,host from mysql.user order by user;                                           	
   +--------------------+-----------+	
   | user               | host      |	
   +--------------------+-----------+	
   | cloneuser          | %         |	
   | cloneuser          | 127.0.0.1 |	
   | cloneuser          | localhost |	
   | dbma               | 127.0.0.1 |	
   | innodbclusteradmin | %         |	
   | monitor            | 127.0.0.1 |	
   | mysql.infoschema   | localhost |	
   | mysql.session      | localhost |	
   | mysql.sys          | localhost |	
   | repluser           | %         |	
   | root               | 127.0.0.1 |	
   | root               | localhost |	
   +--------------------+-----------+	
   12 rows in set (0.01 sec)


四、一行命令解决增加slave的问题

上一个例子中的单机是在 172.16.192.100 这台主机上的,如果想把 172.16.192.110 作为它的 slave ;手工做的话就要“备份”,“还原”,“建立主从关系”,dbm-agent 把这些逻辑都实现了,并且只要一行命令就能解决

1、 假设你已经在 172.16.192.110 主机上完成了 dbm-agent 的安装与初始化

   bash	
   dbma-cli-build-slave --host=172.16.192.100 --port=3306 build-slave	
   2019-11-17 17:03:46,620 - dbm-agent.dbma.mysqldeploy.MySQLBuildSlave.remote_clone - bms - INFO - 1590  - execute checkings for install mysql	
   2019-11-17 17:03:46,654 - dbm-agent.dbma.mysqldeploy.MySQLBuildSlave.install - bms - INFO - 1115  - execute checkings for install mysql	
   2019-11-17 17:03:46,695 - dbm-agent.dbma.mysqldeploy.MySQLBuildSlave._create_mysql_user - bms - INFO - 864  - create user 'mysql3306' complete	
   2019-11-17 17:03:46,698 - dbm-agent.dbma.mysqldeploy.MySQLBuildSlave._create_data_dir - bms - INFO - 888  - create datadir '/database/mysql/data/3306' complete	
   2019-11-17 17:03:46,701 - dbm-agent.dbma.mysqldeploy.MySQLBuildSlave._create_binlog_dir - bms - INFO - 910  - create binary dir '/binlog/mysql/binlog/3306' complete	
   2019-11-17 17:03:46,704 - dbm-agent.dbma.mysqldeploy.MySQLBuildSlave._create_backup_dir - bms - INFO - 932  - create backup dir '/backup/mysql/backup/3306' complete	
   2019-11-17 17:03:46,706 - dbm-agent.dbma.mysqldeploy.MyCnfInitRender.render_template_file - bms - INFO - 518  - using template 'mysql-8.0-init-only.jinja' 	
   2019-11-17 17:03:46,706 - dbm-agent.dbma.mysqldeploy.MyCnfInitRender.set_template - bms - INFO - 457  - using template file 'mysql-8.0-init-only.jinja' 	
   2019-11-17 17:03:46,741 - dbm-agent.dbma.mysqldeploy.MyCnfInitRender.render - bms - INFO - 497  - render mysql config file /tmp/mysql-init.cnf	
   2019-11-17 17:03:46,741 - dbm-agent.dbma.mysqldeploy.MyCnfInitRender.render_template_file - bms - INFO - 524  - render template file complete	
   2019-11-17 17:03:46,742 - dbm-agent.dbma.mysqldeploy.MyCnfMSRender.render_template_file - bms - INFO - 548  - using template 'mysql-8.0.18.cnf.jinja' 	
   2019-11-17 17:03:46,742 - dbm-agent.dbma.mysqldeploy.MyCnfMSRender.set_template - bms - INFO - 457  - using template file 'mysql-8.0.18.cnf.jinja' 	
   2019-11-17 17:03:46,779 - dbm-agent.dbma.mysqldeploy.MyCnfMSRender.render - bms - INFO - 497  - render mysql config file /etc/my-3306.cnf	
   2019-11-17 17:03:46,779 - dbm-agent.dbma.mysqldeploy.MyCnfMSRender.render_template_file - bms - INFO - 554  - render template file complete	
   2019-11-17 17:03:46,779 - dbm-agent.dbma.mysqldeploy.MySQLBuildSlave._render_production_cnf - bms - INFO - 956  - render production cnf complete	
   2019-11-17 17:03:46,779 - dbm-agent.dbma.mysqldeploy.MySQLBuildSlave._init_database - bms - INFO - 1004  - ['/usr/local/mysql-8.0.18-linux-glibc2.12-x86_64/bin/mysqld', '--defaults-file=/tmp/mysql-init.cnf', '--initialize-insecure', '--user=mysql3306', '--init-file=/usr/local/dbm-agent/etc/init-users.sql']	
   2019-11-17 17:03:57,934 - dbm-agent.dbma.mysqldeploy.MySQLBuildSlave._init_database - bms - INFO - 1011  - init database complete	
   2019-11-17 17:03:57,938 - dbm-agent.dbma.mysqldeploy.MySQLSystemdRender.render - bms - INFO - 666  - render systemd config file complete	
   2019-11-17 17:03:57,938 - dbm-agent.dbma.mysqldeploy.MySQLBuildSlave._config_systemd - bms - INFO - 1027  - mysql systemd config complete	
   2019-11-17 17:03:58,110 - dbm-agent.dbma.mysqldeploy.MySQLBuildSlave._enable_mysql - bms - INFO - 1038  - config mysql auto start on boot complete	
   2019-11-17 17:04:00,144 - dbm-agent.dbma.mysqldeploy.MySQLBuildSlave._start_mysql - bms - INFO - 1068  - start mysql complete	
   2019-11-17 17:04:00,145 - dbm-agent.dbma.mysqldeploy.MySQLBuildSlave._export_path - bms - INFO - 1078  - export path complete	
   2019-11-17 17:04:00,147 - dbm-agent.dbma.mysqldeploy.MySQLBuildSlave._export_header_file - bms - INFO - 1106  - export header file complete	
   2019-11-17 17:04:00,148 - dbm-agent.dbma.mysqldeploy.MySQLBuildSlave._export_so - bms - INFO - 1093  - so file has been exported	
   2019-11-17 17:04:00,148 - dbm-agent.dbma.mysqldeploy.MySQLBuildSlave.install - bms - INFO - 1150  - install mysql single instance complete	
   2019-11-17 17:04:00,167 - dbm-agent.dbma.mysqldeploy.MySQLBuildSlave.remote_clone - bms - INFO - 1613  - prepare execute 'set @@global.clone_valid_donor_list='172.16.192.100:3306';' 	
   2019-11-17 17:04:00,168 - dbm-agent.dbma.mysqldeploy.MySQLBuildSlave.remote_clone - bms - INFO - 1618  - prepare execute 'clone instance from cloneuser@'172.16.192.100':3306 identified by 'dbma@0352';' 	
   2019-11-17 17:04:03,431 - dbm-agent.dbma.mysqldeploy.MySQLBuildSlave.remote_clone - bms - INFO - 1629  - remote clone complete (mysql will auto restart,please wait)	
   2019-11-17 17:04:03,432 - dbm-agent.dbma.mysqldeploy.MySQLBuildSlave.build_slave - bms - INFO - 1689  - wait mysql protocol avaiable	
   2019-11-17 17:04:14,454 - dbm-agent.dbma.mysqldeploy.MySQLBuildSlave.build_slave - bms - INFO - 1710  - prepare execute 'change master to master_host='172.16.192.100',master_port=3306,master_user='repluser',master_password='dbma@0352',master_ssl = 1,master_auto_position=1;'	
   2019-11-17 17:04:14,466 - dbm-agent.dbma.mysqldeploy.MySQLBuildSlave.build_slave - bms - INFO - 1716  - prepare execute 'start slave;' 	
   2019-11-17 17:04:14,472 - dbm-agent.dbma.mysqldeploy.MySQLBuildSlave.build_slave - bms - INFO - 1728  - rebuild mysql slave complete

2、 检查主从关系是否正常

   sql	
   mysql -uroot -pdbma@0352 -h127.0.0.1	
   mysql: [Warning] Using a password on the command line interface can be insecure.	
   Welcome to the MySQL monitor.  Commands end with ; or \g.	
   Your MySQL connection id is 12	
   Server version: 8.0.18 MySQL Community Server - GPL	
   Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.	
   Oracle is a registered trademark of Oracle Corporation and/or its	
   affiliates. Other names may be trademarks of their respective	
   owners.	
   Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.	
   mysql> show slave status \G	
   *************************** 1. row ***************************	
                  Slave_IO_State: Waiting for master to send event	
                     Master_Host: 172.16.192.100	
                     Master_User: repluser	
                     Master_Port: 3306	
                   Connect_Retry: 60	
                 Master_Log_File: mysql-bin.000002	
             Read_Master_Log_Pos: 151	
                  Relay_Log_File: relay.000002	
                   Relay_Log_Pos: 357	
           Relay_Master_Log_File: mysql-bin.000002	
                Slave_IO_Running: Yes	
               Slave_SQL_Running: Yes


五、一行命令解决搭建MGR集群的问题

这里不再举例了可以直接到 github 上看 dbm-agent 的说明, mysql-group-replication,mysql-shell,innodb-cluster,mysql-router 个个都支持。


六、dbm-agent建设出来的实例质量如何

1、 一份完整、按需优化&渲染过后的配置文件

ini	
   #cat /etc/my-3306.cnf	
   [mysqld]	
   # basic	
   user                                     = mysql3306	
   basedir                                  = /usr/local/mysql-8.0.18-linux-glibc2.12-x86_64	
   datadir                                  = /database/mysql/data/3306	
   server_id                                = 1388	
   port                                     = 3306	
   bind_address                             = *	
   admin_address                            = 127.0.0.1	
   mysqlx_port                              = 33060	
   admin_port                               = 33062	
   socket                                   = /tmp/mysql-3306.sock	
   mysqlx_socket                            = /tmp/mysqlx-33060.sock	
   pid_file                                 = /tmp/mysql-3306.pid  	
   character_set_server                     = utf8mb4	
   open_files_limit                         = 102000	
   max_prepared_stmt_count                  = 1048576  	
   skip_name_resolve                        = 1     	
   super_read_only                          = OFF	
   log_timestamps                           = system	
   event_scheduler                          = OFF	
   auto_generate_certs                      = ON	
   activate_all_roles_on_login              = ON	
   end_markers_in_json                      = OFF	
   tmpdir                                   = /tmp/	
   max_connections                          = 128	
   autocommit                               = ON	
   sort_buffer_size                         = 256K	
   join_buffer_size                         = 256K	
   eq_range_index_dive_limit                = 200	
   ## table	
   big_tables                               = OFF	
   sql_require_primary_key                  = OFF	
   lower_case_table_names                   = 1	
   auto_increment_increment                 = 1	
   auto_increment_offset                    = 1	
   table_open_cache                         = 4000	
   table_definition_cache                   = 2000	
   table_open_cache_instances               = 32	
   ## net	
   max_allowed_packet                       = 1G	
   connect_timeout                          = 10	
   interactive_timeout                      = 28800	
   net_read_timeout                         = 30	
   net_retry_count                          = 10	
   net_write_timeout                        = 60	
   net_buffer_length                        = 32K	
   ## logs	
   log_output                               = FILE	
   general_log                              = OFF	
   general_log_file                         = general.log	
   # error	
   log_error                                = err.log	
   log_statements_unsafe_for_binlog         = ON	
   # slow	
   slow_query_log                           = ON	
   slow_query_log_file                      = slow.log	
   long_query_time                          = 2	
   log_queries_not_using_indexes            = OFF	
   log_slow_admin_statements                = OFF	
   log_slow_slave_statements                = OFF	
   # binlog	
   log_bin                                  = /binlog/mysql/binlog/3306/mysql-bin	
   binlog_checksum                          = none	
   log_bin_trust_function_creators          = ON	
   binlog_direct_non_transactional_updates  = OFF	
   binlog_expire_logs_seconds               = 604800	
   binlog_error_action                      = ABORT_SERVER	
   binlog_format                            = ROW	
   max_binlog_stmt_cache_size               = 1G	
   max_binlog_cache_size                    = 1G	
   max_binlog_size                          = 1G	
   binlog_order_commits                     = ON	
   binlog_row_image                         = FULL	
   binlog_row_metadata                      = MINIMAL	
   binlog_rows_query_log_events             = ON	
   binlog_stmt_cache_size                   = 32K	
   log_slave_updates                        = ON	
   binlog_transaction_dependency_history_size =25000	
   binlog_transaction_dependency_tracking   = WRITESET	
   sync_binlog                              = 1	
   binlog_cache_size                        = 96K	
   binlog_group_commit_sync_delay           = 0	
   binlog_group_commit_sync_no_delay_count  = 0	
   ## replication	
   rpl_semi_sync_master_enabled             = 1	
   rpl_semi_sync_slave_enabled              = 1	
   rpl_semi_sync_master_timeout             = 1000	
   rpl_semi_sync_master_wait_point          = AFTER_SYNC	
   rpl_semi_sync_master_wait_no_slave       = ON	
   rpl_semi_sync_master_wait_for_slave_count = 1	
   master_info_repository                   = table	
   sync_master_info                         = 10000	
   skip_slave_start                         = OFF	
   slave_load_tmpdir                        = /tmp/	
   plugin_load_add                          = semisync_master.so	
   plugin_load_add                          = semisync_slave.so	
   relay_log                                = relay	
   sync_relay_log                           = 10000	
   sync_relay_log_info                      = 10000	
   relay_log_info_repository                = table	
   slave_preserve_commit_order              = ON	
   slave_parallel_type                      = logical_clock	
   slave_parallel_workers                   = 2	
   slave_max_allowed_packet                 = 1G	
   ## gtid	
   gtid_mode                                = ON	
   binlog_gtid_simple_recovery              = ON	
   enforce_gtid_consistency                 = ON	
   gtid_executed_compression_period         = 1000	
   ## clone	
   plugin-load-add                          = mysql_clone.so	
   clone                                    = FORCE_PLUS_PERMANEN	
   # engines	
   default_storage_engine                   = innodb	
   default_tmp_storage_engine               = innodb	
   internal_tmp_mem_storage_engine          = TempTable	
   ## innodb	
   innodb_data_home_dir                     = ./	
   innodb_data_file_path                    = ibdata1:64M:autoextend	
   innodb_page_size                         = 16K	
   innodb_default_row_format                = dynamic	
   innodb_log_group_home_dir                = ./	
   innodb_redo_log_encrypt                  = OFF	
   innodb_online_alter_log_max_size         = 256M	
   innodb_undo_directory                    = ./	
   innodb_undo_log_encrypt                  = OFF	
   innodb_undo_log_truncate                 = ON	
   innodb_max_undo_log_size                 = 1G	
   innodb_rollback_on_timeout               = OFF	
   innodb_rollback_segments                 = 128	
   innodb_log_checksums                     = ON	
   innodb_checksum_algorithm                = crc32	
   innodb_log_compressed_pages              = ON	
   innodb_doublewrite                       = ON	
   innodb_commit_concurrency                = 0	
   innodb_read_only                         = OFF	
   innodb_dedicated_server                  = OFF	
   innodb_old_blocks_pct                    = 37	
   innodb_old_blocks_time                   = 1000	
   innodb_random_read_ahead                 = OFF	
   innodb_read_ahead_threshold              = 56	
   innodb_max_dirty_pages_pct_lwm           = 20	
   innodb_max_dirty_pages_pct               = 90	
   innodb_lru_scan_depth                    = 1024	
   innodb_adaptive_flushing                 = ON	
   innodb_adaptive_flushing_lwm             = 10	
   innodb_flushing_avg_loops                = 30	
   innodb_buffer_pool_dump_pct              = 50	
   innodb_buffer_pool_dump_at_shutdown      = ON	
   innodb_buffer_pool_load_at_startup       = ON	
   innodb_buffer_pool_filename              = ib_buffer_pool	
   innodb_stats_persistent                  = ON	
   innodb_stats_on_metadata                 = ON	
   innodb_stats_method                      = nulls_equal	
   innodb_stats_auto_recalc                 = ON	
   innodb_stats_include_delete_marked       = ON	
   innodb_stats_persistent_sample_pages     = 20	
   innodb_stats_transient_sample_pages      = 8	
   innodb_status_output                     = OFF	
   innodb_status_output_locks               = OFF	
   innodb_buffer_pool_dump_now              = OFF	
   innodb_buffer_pool_load_abort            = OFF	
   innodb_buffer_pool_load_now              = OFF	
   innodb_thread_concurrency                = 0	
   innodb_concurrency_tickets               = 5000	
   innodb_thread_sleep_delay                = 15000	
   innodb_adaptive_max_sleep_delay          = 150000	
   innodb_read_io_threads                   = 4	
   innodb_write_io_threads                  = 4	
   innodb_use_native_aio                    = ON	
   innodb_flush_sync                        = OFF	
   innodb_spin_wait_delay                   = 6	
   innodb_purge_threads                     = 4	
   innodb_purge_batch_size                  = 300	
   innodb_purge_rseg_truncate_frequency     = 128	
   innodb_deadlock_detect                   = ON	
   innodb_print_all_deadlocks               = ON	
   innodb_lock_wait_timeout                 = 50	
   innodb_table_locks                       = ON	
   innodb_sync_array_size                   = 1	
   innodb_sync_spin_loops                   = 30	
   innodb_print_ddl_logs                    = OFF	
   innodb_replication_delay                 = 0	
   innodb_cmp_per_index_enabled             = OFF	
   innodb_disable_sort_file_cache           = OFF	
   innodb_numa_interleave                   = OFF	
   innodb_strict_mode                       = ON	
   innodb_sort_buffer_size                  = 1M	
   innodb_fast_shutdown                     = 1	
   innodb_force_load_corrupted              = OFF	
   innodb_force_recovery                    = 0	
   innodb_temp_tablespaces_dir              = ./#innodb_temp/	
   innodb_tmpdir                            = ./	
   innodb_temp_data_file_path               = ibtmp1:64M:autoextend	
   innodb_page_cleaners                     = 4	
   innodb_adaptive_hash_index               = ON	
   innodb_adaptive_hash_index_parts         = 8	
   innodb_flush_log_at_timeout              = 1	
   innodb_fsync_threshold                   = 0	
   innodb_fill_factor                       = 90	
   innodb_file_per_table                    = ON	
   innodb_autoextend_increment              = 64	
   innodb_open_files                        = 100000	
   innodb_buffer_pool_chunk_size            = 128M	
   innodb_buffer_pool_instances             = 1	
   innodb_log_files_in_group                = 8	
   innodb_log_file_size                     = 64M	
   innodb_flush_neighbors                   = 0	
   innodb_io_capacity                       = 4000	
   innodb_io_capacity_max                   = 20000	
   innodb_autoinc_lock_mode                 = 2	
   innodb_change_buffer_max_size            = 25	
   innodb_flush_method                      = O_DIRECT	
   innodb_log_buffer_size                   = 64M	
   innodb_flush_log_at_trx_commit           = 1	
   innodb_buffer_pool_size                  = 256M	
   ####  for performance_schema	
   performance_schema                                                      =OFF	
   performance_schema_consumer_global_instrumentation                      =ON	
   performance_schema_consumer_thread_instrumentation                      =ON	
   performance_schema_consumer_events_stages_current                       =ON	
   performance_schema_consumer_events_stages_history                       =ON	
   performance_schema_consumer_events_stages_history_long                  =OFF	
   performance_schema_consumer_statements_digest                           =ON	
   performance_schema_consumer_events_statements_current                   =ON	
   performance_schema_consumer_events_statements_history                   =ON	
   performance_schema_consumer_events_statements_history_long              =OFF	
   performance_schema_consumer_events_waits_current                        =ON	
   performance_schema_consumer_events_waits_history                        =ON	
   performance_schema_consumer_events_waits_history_long                   =OFF	
   performance-schema-instrument                                           ='memory/%=COUNTED'	
   # -- ~ _ ~    ~ _ ~     ~ _ ~ --	
   # base on mysql-8.0.18	
   # generated by https://www.sqlpy.com 2019年10月14日 21时47分11秒	
   # wechat: jianglegege	
   # email: 1721900707@qq.com	
   # -- ~ _ ~ --

2、 把规范和流程物化到 dbm-agent 的每一个环节,而不是口头上或文档上;更加详细的内容可以参考 github dbm-agent

640?wx_fmt=png

640?wx_fmt=gif

扫码加入MySQL技术Q群

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐