zoukankan      html  css  js  c++  java
  • mysql优化后的主配置文件

    #!/bin/bash
    basedir=$mysql
    datadir=$mysql/data
    server_id=$(hostname -I | awk  '{print $NF}'|awk -F '.' '{print $NF}')
    mem=$(free | awk NR==2'{print $2}')
    innodb_buffer_pool_size=$(($mem/2/1024/1024+1))G
    
    cat >/etc/my.cnf <<EOF
    [mysqld]
    basedir = ${basedir}
    datadir = ${datadir}
    character_set_server = utf8
    skip_name_resolve = on
    innodb_buffer_pool_size =${innodb_buffer_pool_size}
    innodb_write_io_threads = 8
    innodb_read_io_threads= 8  
    innodb_log_file_size = 128M
    innodb_log_buffer_size = 32M
    innodb_page_cleaners = 4   
    innodb_io_capacity = 5000
    innodb_flush_log_at_trx_commit  = 2
    innodb_flush_method = O_DIRECT 
    max_allowed_packet = 32M
    max_connections = 4000
    key_buffer_size = 32M
    read_buffer_size = 2M 
    read_rnd_buffer_size = 16M
    sort_buffer_size = 8M
    join_buffer_size = 8M
    thread_stack = 256K
    thread_cache_size = 64
    query_cache_limit = 8M
    query_cache_size = 64M
    query_cache_type = 1
    server_id = ${server_id}
    log_bin = mysql-bin
    binlog_format = row
    relay_log = relay-log
    gtid_mode = ON
    enforce_gtid_consistency = true
    master_info_repository = TABLE
    relay_log_info_repository = TABLE
    slave_parallel_type = LOGICAL_CLOCK
    slave_parallel_workers = 8
    relay_log_recovery = ON
    slow_query_log = on
    long_query_time = 3
    slow_query_log_file = mysql-slow.log
    expire_logs_days = 40
    log_error = mysql.log
    log_bin_trust_function_creators = on
    sql_mode = "STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION"
    lower_case_table_names = 1
    log_timestamps = SYSTEM
    group_concat_max_len = 10240000 EOF
  • 相关阅读:
    下载并使用ASP.NET MVC v1.0 Futures
    关于DataGridView的数据源两个值得注意的小问题
    C++网络编程(二)客户端服务器程序
    C++多态、继承的简单分析
    XML文件解析器TXml
    数组
    CTS类型系统
    光阴不会虚度
    软件的大规模生产
    微创新和山寨的关系
  • 原文地址:https://www.cnblogs.com/ray-mmss/p/11547355.html
Copyright © 2011-2022 走看看