MySQL InnoDB千表无法启动服务

时间:2018-02-06 14:47:58

标签: mysql

我有数千个表的MySQL数据库存在问题

  1. 文件夹数据库大小66 GB,包含16.000个表,可以启动服务 通常
  2. 当数据库大小为180 GB且66.000表时不能 开始服务
  3. 这是my.ini

    [client]
    port=3306
    [mysql]
    no-beep
    default-character-set=utf8
    [mysqld]
    port=3306
    datadir=E:/DataMySQLServer/Data
    character-set-server=utf8
    default-storage-engine=INNODB
    sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
    log-output=FILE
    general-log=0
    general_log_file="WIN-PN6P4KVFP6B.log"
    slow-query-log=1
    slow_query_log_file="WIN-PN6P4KVFP6B-slow.log"
    long_query_time=10
    log-error="WIN-PN6P4KVFP6B.err"
    server-id=1
    secure-file-priv="E:/DataMySQLServer/Uploads"
    max_connections=151
    query_cache_size=0
    table_open_cache=70000
    tmp_table_size=60M
    thread_cache_size=10
    myisam_max_sort_file_size=100G
    myisam_sort_buffer_size=111M
    key_buffer_size=8M
    read_buffer_size=64K
    read_rnd_buffer_size=256K
    innodb_flush_log_at_trx_commit=1
    innodb_log_buffer_size=1M
    innodb_buffer_pool_size=3G
    innodb_log_file_size=48M
    innodb_thread_concurrency=9
    innodb_autoextend_increment=64
    innodb_buffer_pool_instances=8
    innodb_concurrency_tickets=5000
    innodb_old_blocks_time=1000
    innodb_open_files=300
    innodb_stats_on_metadata=0
    innodb_file_per_table=1
    innodb_checksum_algorithm=0
    back_log=80
    flush_time=0
    join_buffer_size=256K
    max_allowed_packet=4M
    max_connect_errors=100
    open_files_limit=70000
    query_cache_type=0
    sort_buffer_size=256K
    table_definition_cache=1400
    binlog_row_event_max_size=8K
    sync_master_info=10000
    sync_relay_log=10000
    sync_relay_log_info=10000
    

    mysql.error

    2018-02-06T14:13:31.328373Z 0 [Warning] TIMESTAMP with implicit DEFAULT 
    value is deprecated. Please use --explicit_defaults_for_timestamp server 
    option (see documentation for more details).
    2018-02-06T14:13:31.338701Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' 
    and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. 
    They will be merged with strict mode in a future release.
    2018-02-06T14:13:31.343938Z 0 [Note] C:\Program Files\MySQL\MySQL Server 
    5.7\bin\mysqld.exe (mysqld 5.7.21-log) starting as process 3408 ...
    2018-02-06T14:13:31.524790Z 0 [Note] InnoDB: Mutexes and rw_locks use 
    Windows interlocked functions
    2018-02-06T14:13:31.525769Z 0 [Note] InnoDB: Uses event mutexes
    2018-02-06T14:13:31.526446Z 0 [Note] InnoDB: _mm_lfence() and _mm_sfence() 
    are used for memory barrier
    2018-02-06T14:13:31.526917Z 0 [Note] InnoDB: Compressed tables use zlib 
     1.2.3
    2018-02-06T14:13:31.538396Z 0 [Note] InnoDB: Number of pools: 1
    2018-02-06T14:13:31.554578Z 0 [Note] InnoDB: Not using CPU crc32 
    instructions
    2018-02-06T14:13:31.557844Z 0 [Note] InnoDB: Initializing buffer pool, total 
    size = 3G, instances = 8, chunk size = 128M
    2018-02-06T14:13:31.703384Z 0 [Note] InnoDB: Completed initialization of 
    buffer pool
    2018-02-06T14:13:31.884100Z 0 [Note] InnoDB: Highest supported file format 
    is Barracuda.
    

    为什么无法启动服务?请帮忙......

    注意上面的my.ini文件,我们更改了table_open_cache=70000innodb_buffer_pool_size=3Gopen_files_limit=70000

    等行

1 个答案:

答案 0 :(得分:0)

对my.cnf / ini [mysqld]部分的建议

#myisam_max_sort_file_size=100G  # lead with # for default until u know what u need
table_open_cache=50000  # from 70000 until you are stable

使用table_definition_cache = 1400,你应该使用open_files_limit = 70000 因为50000 + 1400 =< 70000