首页 > 数据库 >run mysql server in docker with exist database

run mysql server in docker with exist database

时间:2023-03-20 17:56:18浏览次数:37  
标签:run database max loose server innodb performance OFF size

step 1: put your database in $mysql_data_dir first

step 2: put your my.conf to $mysql_cnf, for example: that my.cnf from alibaba cloud

[mysqld]
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
datadir         = /var/lib/mysql
#log-error      = /var/log/mysql/error.log
# By default we only accept connections from localhost
#bind-address   = 127.0.0.1
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

max_connections=10000

loose_performance_schema_max_table_instances=1000
innodb_buffer_pool_load_at_startup=ON
loose_performance_schema_max_index_stat=10000
bulk_insert_buffer_size=4194304
show_old_temporals=OFF
ft_query_expansion_limit=20
innodb_old_blocks_time=1000
innodb_stats_sample_pages=8
thread_stack=262144
lc_time_names=en_US
innodb_thread_concurrency=0
sync_master_info=10000
default_time_zone=+8:00
old_passwords=0
optimizer_search_depth=62
#loose_innodb_data_file_purge_interval=100
innodb_compression_level=6
#loose_innodb_log_optimize_ddl=OFF
loose_performance_schema_max_prepared_statements_instances=1000
max_sort_length=1024
max_binlog_cache_size=18446744073709547520
innodb_online_alter_log_max_size=134217728
key_cache_block_size=1024
mysql_native_password_proxy_users=OFF
innodb_adaptive_max_sleep_delay=150000
innodb_purge_rseg_truncate_frequency=128
query_alloc_block_size=8192
loose_performance_schema_max_socket_instances=1000
innodb_lock_wait_timeout=3600
innodb_purge_threads=1
#loose_performance_point_iostat_interval=2
innodb_compression_failure_threshold_pct=5
innodb_compression_pad_pct_max=50
#loose_innodb_data_file_purge=ON
binlog_rows_query_log_events=OFF
#loose_validate_password_check_user_name=ON
innodb_stats_persistent_sample_pages=20
innodb_ft_total_cache_size=640000000
#loose_max_statement_time=0
event_scheduler=ON
innodb_flush_method=O_DIRECT
loose_performance_schema_accounts_size=10000
eq_range_index_dive_limit=10
#loose_sql_safe_updates=OFF
loose_max_execution_time=0
loose_optimizer_trace_features=greedy_search=on,range_optimizer=on,dynamic_range=on,repeated_subselect=on
#rds_reserved_connections=512
connect_timeout=10
innodb_purge_batch_size=300
div_precision_increment=4
avoid_temporal_upgrade=OFF
innodb_sync_array_size=1
innodb_stats_method=nulls_equal
lock_wait_timeout=31536000
net_read_timeout=30
innodb_deadlock_detect=ON
innodb_write_io_threads=4
end_markers_in_json=OFF
loose_performance_schema_hosts_size=10000
loose_ccl_queue_bucket_count=4
ngram_token_size=2
loose_innodb_numa_interleave=ON
loose_performance_schema_max_cond_instances=10000
max_binlog_stmt_cache_size=18446744073709547520
loose_performance_schema_max_table_lock_stat=10000
loose_performance_schema_max_table_handles=10000
innodb_checksum_algorithm=crc32
loose_innodb_data_file_purge_max_size=512
query_cache_type=0
innodb_ft_enable_diag_print=OFF
innodb_ft_enable_stopword=ON
innodb_io_capacity=20000
slow_launch_time=2
innodb_table_locks=ON
innodb_stats_persistent=ON
tmp_table_size=2097152
loose_performance_point_lock_rwlock_enabled=ON
disconnect_on_expired_password=ON
default_storage_engine=InnoDB
net_retry_count=10
innodb_ft_cache_size=8000000
binlog_cache_size=128KB
innodb_max_dirty_pages_pct=75
query_cache_limit=1048576
innodb_disable_sort_file_cache=ON
innodb_lru_scan_depth=1024
loose_performance_schema_max_mutex_instances=10000
innodb_ft_result_cache_limit=2000000000
long_query_time=1
interactive_timeout=7200
innodb_read_io_threads=4
transaction_prealloc_size=4096
open_files_limit=65535
loose_performance_schema_max_metadata_locks=10000
innodb_open_files=3000
max_heap_table_size=67108864
loose_performance_schema_digests_size=10000
automatic_sp_privileges=ON
explicit_defaults_for_timestamp=OFF
ft_max_word_len=84
innodb_autoextend_increment=64
#sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
sql_mode=STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
innodb_stats_transient_sample_pages=8
innodb_random_read_ahead=OFF
table_open_cache=2000
range_optimizer_max_mem_size=8388608
loose_innodb_rds_faster_ddl=ON
innodb_status_output=OFF
loose_validate_password_number_count=1
innodb_log_compressed_pages=OFF
slave_net_timeout=60
delay_key_write=ON
query_cache_wlock_invalidate=OFF
max_points_in_geometry=65536
general_log=OFF
max_prepared_stmt_count=16382
wait_timeout=3600
log_bin_use_v1_row_events=1
loose_performance_schema_setup_actors_size=10000
query_cache_min_res_unit=1024
innodb_print_all_deadlocks=OFF
loose_thread_pool_size=1
binlog_stmt_cache_size=32768
transaction_isolation=READ-COMMITTED
innodb_buffer_pool_dump_at_shutdown=ON
query_prealloc_size=8192
key_cache_age_threshold=300
loose_performance_schema_setup_objects_size=10000
loose_rds_kill_connections=20
transaction_alloc_block_size=8192
optimizer_trace_limit=1
metadata_locks_cache_size=1024
optimizer_prune_level=1
loose_performance_schema_max_file_instances=1000
innodb_max_purge_lag=0
innodb_buffer_pool_dump_pct=25
innodb_max_dirty_pages_pct_lwm=0
max_sp_recursion_depth=0
innodb_status_output_locks=OFF
updatable_views_with_limit=YES
binlog_row_image=full
innodb_change_buffer_max_size=25
innodb_optimize_fulltext_only=OFF
local_infile=ON
loose_opt_rds_last_error_gtid=ON
innodb_ft_max_token_size=84
innodb_undo_log_truncate=OFF
loose_performance_schema_users_size=10000
innodb_max_undo_log_size=1073741824
slave_parallel_type=LOGICAL_CLOCK
loose_rds_check_core_file_enabled=ON
loose_thread_pool_enabled=OFF
innodb_adaptive_hash_index=ON
innodb_sync_spin_loops=30
net_write_timeout=60
flush_time=0
lower_case_table_names=1
sha256_password_proxy_users=OFF
character_set_filesystem=binary
innodb_flush_sync=ON
tls_version=TLSv1,TLSv1.1,TLSv1.2
key_cache_division_limit=100
loose_performance_schema_max_rwlock_instances=10000
delayed_insert_timeout=300
loose_rds_audit_max_sql_size=2048
preload_buffer_size=32768
innodb_read_ahead_threshold=56
loose_optimizer_switch=index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,mrr=on,mrr_cost_based=on,block_nested_loop=on,batched_key_access=off,materialization=on,semijoin=on,loosescan=on,firstmatch=on,subquery_materialization_cost_based=on,use_index_extensions=on
concurrent_insert=1
block_encryption_mode="aes-128-ecb"
slow_query_log=ON
net_buffer_length=16384
query_cache_size=3145728
innodb_buffer_pool_size=2G
delayed_insert_limit=100
innodb_large_prefix=ON
innodb_monitor_disable=
loose_performance_schema_max_program_instances=10000
innodb_adaptive_flushing_lwm=10
innodb_log_checksums=ON
delayed_queue_size=1000
session_track_gtids=OFF
innodb_thread_sleep_delay=10000
loose_rds_set_connection_id_enabled=ON
innodb_old_blocks_pct=37
innodb_ft_sort_pll_degree=2
log_slow_admin_statements=OFF
innodb_stats_on_metadata=OFF
stored_program_cache=256
group_concat_max_len=1024
innodb_sort_buffer_size=1048576
innodb_page_cleaners=1
innodb_spin_wait_delay=6
myisam_sort_buffer_size=262144
innodb_rollback_segments=128
innodb_commit_concurrency=0
innodb_concurrency_tickets=5000
table_definition_cache=512
auto_increment_increment=1
binlog_checksum=CRC32
max_seeks_for_key=18446744073709500000
autocommit=ON
loose_ccl_queue_bucket_size=64
max_length_for_sort_data=1024
back_log=3000
max_error_count=64
innodb_io_capacity_max=40000
innodb_strict_mode=OFF
binlog_order_commits=ON
min_examined_row_limit=0
performance_schema=OFF
innodb_ft_min_token_size=3
loose_validate_password_policy=1
sync_relay_log_info=10000
innodb_stats_auto_recalc=ON
max_connect_errors=100
join_buffer_size=352KB
innodb_change_buffering=all
optimizer_trace_max_mem_size=16384
innodb_autoinc_lock_mode=2
innodb_rollback_on_timeout=OFF
loose_opt_rds_enable_show_slave_lag=ON
loose_performance_schema_max_thread_instances=10000
max_write_lock_count=102400
master_verify_checksum=OFF
innodb_ft_num_word_optimize=2000
max_join_size=18446744073709500000
loose_validate_password_mixed_case_count=1
log_error_verbosity=2
loose_validate_password_length=8
log_throttle_queries_not_using_indexes=0
innodb_max_purge_lag_delay=0
loose_optimizer_trace=enabled=off,one_line=off
default_week_format=0
innodb_cmp_per_index_enabled=OFF
show_compatibility_56=OFF
host_cache_size=644
low_priority_updates=0
auto_increment_offset=1
range_alloc_block_size=4096
ft_min_word_len=4
loose_performance_point_iostat_volume_size=10000
sort_buffer_size=704KB
slave_type_conversions=
max_allowed_packet=1024M
read_buffer_size=704KB
thread_cache_size=256
optimizer_trace_offset=-1
loose_thread_pool_oversubscribe=32
loose_validate_password_special_char_count=1
character_set_server=utf8mb4
innodb_adaptive_flushing=ON
log_queries_not_using_indexes=OFF
innodb_monitor_enable=
table_open_cache_instances=16
innodb_flush_neighbors=1
innodb_buffer_pool_instances=1

step 3: run bash script

# step-1: configure
mysql_port='3306'
mysql_cnf="~/docker/mysqld_${mysql_port}/my.cnf"
mysql_data_dir="~/docker/mysqld_${mysql_port}/data"

# step-2: restart mysql server
chmod a+r `bash -c "echo ${mysql_cnf}"`
docker rm -f mysqld_${mysql_port}
docker run -d -p ${mysql_port}:3306 --name mysqld_${mysql_port} \
-v `bash -c "echo ${mysql_data_dir}"`:/var/lib/mysql \
-v `bash -c "echo ${mysql_cnf}"`:/etc/my.cnf \
docker.io/library/mysql:5.7
docker attach --sig-proxy=false mysqld_${mysql_port}

# step-3: maintaince if have any problem
docker exec -it mysqld_${mysql_port} bash

done

标签:run,database,max,loose,server,innodb,performance,OFF,size
From: https://www.cnblogs.com/xiangxisheng/p/17237183.html

相关文章

  • Remote Desktop UAF漏洞蓝屏,SQL Server 报偏移量为???的位置执行 读取 期间,操作系统已
    蓝屏转储memory.dmp, 不及格的程序员-八神,每次SqlServer数据库不可用时,在相近时间点上能看到系统蓝屏的系统日志,猜测与蓝屏重启有关。3:kd>!analyze-vtermdd****......
  • Windows Server 2016配置NTP客户端
    前提:开通WindowsTime 服务输入services.msc进入服务管理界面,找到WindowsTime 开启服务。情况1:可以直接设置NTP时钟控制面板——时钟和区域——设置时间和日期——I......
  • Sql Server 编写函数
    编写函数样例样例一编写函数Fmax,求二数大者。CREATEFUNCTIONFmax(@xint,@yint)RETURNSintASBEGINDECLARE@ZINTIF@X>@YSET@Z=@X......
  • 【服务器数据恢复】服务器断电导致Xen Server虚拟机不可用的数据恢复案例
    服务器数据恢复环境:某公司一台DELL服务器,作为WEB服务器使用,安装的WindowsServer操作系统,配置了SQLServer数据库;采用了XenServer虚拟化系统;底层是通过raid卡,用4块STAT......
  • sqlserver触发器的使用以及inserted和deleted详解
    背景:最近在项目中有需求是当人员表中有变动时(比如:增加人员、修改人员信息、删除人员信息)需要把这张表中的变动的信息同步到它对应的日志表中。那么如果用代码写逻辑的话在执......
  • Qt Tcp Server
    chatgpt结果head//TcpServerBase.h#ifndefTCPSERVER_H#defineTCPSERVER_H#include<QObject>#include<QTcpServer>#include<QTcpSocket>classTcpServerBa......
  • 常见的 RuntimeException 有哪些?
    java.lang.ArithmeticException执行数学计算时产生的的异常java.lang.ClassCastException进行强制类型转换的时候产生的异常java.lang.IllegalArgumentExce......
  • 好用的ftp server
    之前在两台电脑之间备份的时候想搞一个局域网传输工具,在网上找了半天没有找到一个好用的东西,用的是utool自带的share,慢的可以,无法忍受(后来证明是路由器的问题),当我把WiFi换......
  • SQL Server开启1433端口,彻底解决方案
    SQLServer开启1433端口,彻底解决方案yaohan404关注IP属地:广东0.1782018.01.0510:34:18字数377阅读29,057环境:Windows10+SQLServer2008在用JDBC连接SQLSe......
  • 【单元测试】Junit 4(七)--junit4 TestRunnner
    TestRunners我没想到一个特别合适的词来形容TestRunners的作用,所以多说几句:TestRunners是具有特殊功能的执行测试用例的通道,也可以理解为测试的执行者,例如可以同时运......