|
以下是my.cnf配置文件參數(shù)解釋 [client] port = 3309 socket = /home/mysql/mysql/tmp/mysql.sock [mysqld] !include /home/mysql/mysql/etc/mysqld.cnf #包含的配置 文件 ,把用戶名,密碼文件單獨存放 port = 3309 socket = /home/mysql/mysql/tmp/mysql.sock pid-file = /longxibendi/mysql/mysql/var/mysql.pid basedir = /home/mysql/mysql/ datadir = /longxibendi/mysql/mysql/var/ # tmp dir settings tmpdir = /home/mysql/mysql/tmp/ slave-load-tmpdir = /home/mysql/mysql/tmp/ #當slave 執(zhí)行 load data infile 時用 # language = /home/mysql/mysql/share/mysql/english/ character-sets-dir = /home/mysql/mysql/share/mysql/charsets/ # skip options skip-name-resolve #grant 時,必須使用ip不能使用主機名 skip-symbolic-links #不能使用連接文件 skip-external-locking #不使用系統(tǒng)鎖定,要使用myisamchk,必須關閉服務器 skip-slave-start #啟動mysql,不啟動復制 #sysdate-is-now # res settings back_log = 50 #接受隊列,對于沒建立tcp連接的請求隊列放入緩存中,隊列大小為back_log,受限制與OS參數(shù) max_connections = 1000 #最大并發(fā)連接數(shù) ,增大該值需要相應增加允許打開的文件描述符數(shù) max_connect_errors = 10000 #如果某個用戶發(fā)起的連接error超過該數(shù)值,則該用戶的下次連接將被阻塞,直到管理員執(zhí)行flush hosts ; 命令;防止黑客 #open_files_limit = 10240 connect-timeout = 10 #連接超時之前的最大秒數(shù),在Linux平臺上,該超時也用作等待服務器首次回應的時間 wait-timeout = 28800 #等待關閉連接的時間 interactive-timeout = 28800 #關閉連接之前,允許interactive_timeout(取代了wait_timeout)秒的不活動時間??蛻舳说臅抴ait_timeout變量被設為會話interactive_timeout變量的值。 slave-net-timeout = 600 #從服務器也能夠處理網(wǎng)絡連接中斷。但是,只有從服務器超過slave_net_timeout秒沒有從主服務器收到數(shù)據(jù)才通知網(wǎng)絡中斷 net_read_timeout = 30 #從服務器讀取信息的超時 net_write_timeout = 60 #從服務器寫入信息的超時 net_retry_count = 10 #如果某個通信端口的讀操作中斷了,在放棄前重試多次 net_buffer_length = 16384 #包消息緩沖區(qū)初始化為net_buffer_length字節(jié),但需要時可以增長到max_allowed_packet 字節(jié) max_allowed_packet = 64M # # table_cache = 512 #所有線程打開的表的數(shù)目。增大該值可以增加mysqld需要的文件描述符的數(shù)量 thread_stack = 192K #每個線程的堆棧大小 thread_cache_size = 20 #線程緩存 thread_concurrency = 8 #同時運行的線程的數(shù)據(jù) 此處最好為CPU個數(shù)兩倍。本機配置為CPU的個數(shù) # qcache settings query_cache_size = 256M #查詢緩存大小 query_cache_limit = 2M #不緩存查詢大于該值的結(jié)果 query_cache_min_res_unit = 2K #查詢緩存分配的最小塊大小 # default settings # time zone default-time-zone = system #服務器時區(qū) character-set-server = utf8 #server級別字符集 default-storage-engine = InnoDB #默認存儲 # tmp & heap tmp_table_size = 512M #臨時表大小,如果超過該值,則結(jié)果放到磁盤中 max_heap_table_size = 512M #該變量設置MEMORY (HEAP)表 可以增長到的最大空間大小 log-bin = mysql-bin #這些路徑相對于datadir log-bin-index = mysql-bin.index relay-log = relay-log relay_log_index = relay-log.index # warning & error log log-warnings = 1 log-error = /home/mysql/mysql/log/mysql.err log_output = FILE #參數(shù)log_output指定了慢查詢輸出的格式,默認為FILE,你可以將它設為TABLE,然后就可以查詢mysql架構(gòu)下的slow_log表了 # slow query log slow_query_log = 1 long-query-time = 1 #慢查詢時間 超過1秒則為慢查詢 slow_query_log_file = /home/mysql/mysql/log/slow.log #log-queries-not-using-indexes #log-slow-slave-statements general_log = 1 general_log_file = /home/mysql/mysql/log/mysql.log max_binlog_size = 1G max_relay_log_size = 1G # if use auto-ex, set to 0 relay-log-purge = 1 #當不用中繼日志時,刪除他們。這個操作有SQL線程完成 # max binlog keeps days expire_logs_days = 30 #超過30天的binlog刪除 binlog_cache_size = 1M #session級別 # replication replicate-wild-ignore-table = mysql.% #復制時忽略數(shù)據(jù)庫及表 replicate-wild-ignore-table = test.% #復制時忽略數(shù)據(jù)庫及表 # slave_skip_errors=all key_buffer_size = 256M #myisam索引buffer,只有key沒有data sort_buffer_size = 2M #排序buffer大小;線程 級別 read_buffer_size = 2M #以全表掃描(Sequential Scan)方式掃描數(shù)據(jù)的buffer大小 ;線程級別 join_buffer_size = 8M # join buffer 大小;線程級別 read_rnd_buffer_size = 8M #MyISAM以索引掃描(Random Scan)方式掃描數(shù)據(jù)的buffer大小 ;線程級別 bulk_insert_buffer_size = 64M #MyISAM 用在塊插入優(yōu)化中的樹緩沖區(qū)的大小。注釋:這是一個per thread的限制 myisam_sort_buffer_size = 64M #MyISAM 設置恢復表之時使用的緩沖區(qū)的尺寸,當在REPAIR TABLE或用CREATE INDEX創(chuàng)建索引或ALTER TABLE過程中排序 MyISAM索引分配的緩沖區(qū) myisam_max_sort_file_size = 10G #MyISAM 如果臨時文件會變得超過索引,不要使用快速排序索引方法來創(chuàng)建一個索引。注釋:這個參數(shù)以字節(jié)的形式給出.重建MyISAM索引(在REPAIR TABLE、ALTER TABLE或LOAD DATA INFILE過程中)時,允許MySQL使用的臨時文件的最大空間大小。如果文件的大小超過該值,則使用鍵值緩存創(chuàng)建索引,要慢得多。該值的單位為字節(jié) myisam_repair_threads = 1 #如果該值大于1,在Repair by sorting過程中并行創(chuàng)建MyISAM表索引(每個索引在自己的線程內(nèi)) myisam_recover = 64K#允許的GROUP_CONCAT()函數(shù)結(jié)果的最大長度 transaction_isolation = REPEATABLE-READ innodb_file_per_table #innodb_status_file = 1 #innodb_open_files = 2048 innodb_additional_mem_pool_size = 100M #幀緩存的控制對象需要從此處申請緩存,所以該值與innodb_buffer_pool對應 innodb_buffer_pool_size = 2G #包括數(shù)據(jù)頁、索引頁、插入緩存、鎖信息、自適應哈希所以、數(shù)據(jù)字典信息 innodb_data_home_dir = /longxibendi/mysql/mysql/var/ #innodb_data_file_path = ibdata1:1G:autoextend innodb_data_file_path = ibdata1:500M;ibdata2:2210M:autoextend #表空間 innodb_file_io_threads = 4 #io線程數(shù) innodb_thread_concurrency = 16 #InnoDB試著在InnoDB內(nèi)保持操作系統(tǒng)線程的數(shù)量少于或等于這個參數(shù)給出的限制 innodb_flush_log_at_trx_commit = 1 #每次commit 日志緩存中的數(shù)據(jù)刷到磁盤中 innodb_log_buffer_size = 8M #事物日志緩存 innodb_log_file_size = 500M #事物日志大小 #innodb_log_file_size =100M innodb_log_files_in_group = 2 #兩組事物日志 innodb_log_group_home_dir = /longxibendi/mysql/mysql/var/#日志組 innodb_max_dirty_pages_pct = 90 #innodb主線程刷新緩存池中的數(shù)據(jù),使臟數(shù)據(jù)比例小于90% innodb_lock_wait_timeout = 50 #InnoDB事務在被回滾之前可以等待一個鎖定的超時秒數(shù)。InnoDB在它自己的 鎖定表中自動檢測事務死鎖并且回滾事務。InnoDB用LOCK TABLES語句注意到鎖定設置。默認值是50秒 #innodb_flush_method = O_DSYNC [mysqldump] quick max_allowed_packet = 64M [mysql] disable-auto-rehash #允許通過TAB鍵提示 default-character-set = utf8 connect-timeout = 3
信息發(fā)布:廣州名易軟件有限公司 http://www.jetlc.com
|