大家看看服务器这样的配置,my.ini如何配置为佳呢

[复制链接]
查看11 | 回复9 | 2008-7-6 20:41:58 | 显示全部楼层 |阅读模式
主板:INTEL D965G(BTX架构,DG965PZ,板载4个SATAII接口,支持RAID 0/1/10/5)
CPU:INTEL Pentium Dual-CoreE2180
内存:金士顿2G DDRII-667MHZ *2(即4G)
硬盘:320G SATAII 16M
机箱:1U BTX架构
电源:300W 1U专用
网卡:板载英特尔千兆位以太网 LAN 控制器
显卡:Intel Graphics Media Accelerator X3000
数据库使用innodb引擎,做一个门户网站,访问量日有几万,my.ini如何设置呢?
回复

使用道具 举报

千问 | 2008-7-6 20:41:58 | 显示全部楼层
# Example MySQL config file for large systems.
#
# This is for a large system with memory = 512M where the system runs mainly
# MySQL.
#
# You can copy this file to
# /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is /usr/local/var) or
# ~/.my.cnf to set user-specific options.
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.
# The following options will be passed to all MySQL clients
[client]
#password
= your_password
port
= 3306
socket
= /tmp/mysql.sock
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port
= 3306
socket
= /tmp/mysql.sock
skip-locking
key_buffer = 256M
max_allowed_packet = 1M
table_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size= 16M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8
回复

使用道具 举报

千问 | 2008-7-6 20:41:58 | 显示全部楼层
# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking
# Replication Master Server (default)
# binary logging is required for replication
log-bin=mysql-bin
# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id
= 1
# Replication Slave (comment out master section to use this)
#
# To configure this host as a replication slave, you can choose between
# two methods :
#
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
#the syntax is:
#
#CHANGE MASTER TO MASTER_HOST=, MASTER_PORT=,
#MASTER_USER=, MASTER_PASSWORD= ;
#
#where you replace , ,by quoted strings and
# by the master's port number (3306 by default).
#
#Example:
#
#CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
#MASTER_USER='joe', MASTER_PASSWORD='secret';
#
# OR
回复

使用道具 举报

千问 | 2008-7-6 20:41:58 | 显示全部楼层
#
# 2) Set the variables below. However, in case you choose this method, then
#start replication for the first time (even unsuccessfully, for example
#if you mistyped the password in master-password and the slave fails to
#connect), the slave will create a master.info file, and any later
#change in this file to the variables' values below will be ignored and
#overridden by the content of the master.info file, unless you shutdown
#the slave server, delete master.info and restart the slaver server.
#For that reason, you may want to leave the lines below untouched
#(commented) and instead use CHANGE MASTER TO (see above)
#
# required unique id between 2 and 2^32 - 1
# (and different from the master)
# defaults to 2 if master-host is set
# but will not function as a slave if omitted
#server-id = 2
#
# The replication master for this slave - required
#master-host =
#
# The username the slave will use for authentication when connecting
# to the master - required
#master-user =
#
# The password the slave will authenticate with when connecting to
# the master - required
#master-password =
#
# The port the master is listening on.
# optional - defaults to 3306
#master-port =
#
# binary logging - not required for slaves, but recommended
#log-bin=mysql-bin
# Point the following paths to different dedicated disks
#tmpdir
= /tmp/

#log-update
= /path-to-dedicated-directory/hostname
# Uncomment the following if you are using BDB tables
#bdb_cache_size = 64M
#bdb_max_lock = 100000
回复

使用道具 举报

千问 | 2008-7-6 20:41:58 | 显示全部楼层
[myisamchk]
key_buffer = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
回复

使用道具 举报

千问 | 2008-7-6 20:41:58 | 显示全部楼层
参考安装目录下的my_large.ini文件
回复

使用道具 举报

千问 | 2008-7-6 20:41:58 | 显示全部楼层
好的 ,谢谢了,呵呵,我配置的是这样!
#
##使用4G内存,一个双核CPU,主要使用innodb引擎,排序、分组查询比较多
#
[client]
port = 3307
socket = /tmp/mysql.sock

[mysql]
no-auto-rehash

[mysqldump]
quick
max_allowed_packet = 32M

[mysqld]
port = 3307
socket = /tmp/mysql.sock
basedir="C:/Program Files/MySQL/MySQL Server 5.0/"
datadir="C:/Program Files/MySQL/MySQL Server 5.0/Data/"
default-character-set=utf8
back_log = 103
max_connections = 512
max_connect_errors = 1024
table_cache = 307
external-locking = FALSE
init_connect='SET AUTOCOMMIT=0'
max_allowed_packet = 32M
sort_buffer_size = 2M
join_buffer_size = 2M
thread_cache_size = 51
thread_concurrency = 8
query_cache_size = 32M
query_cache_limit = 2M
query_cache_min_res_unit = 2k
default_table_type = InnoDB
thread_stack = 192K
transaction_isolation = READ-COMMITTED
tmp_table_size = 123M
max_heap_table_size = 123M
log-slow-queries = slow.log
log_error = error.log
log = log.log
long_query_time = 1
log_long_format
server-id = 1
log-bin = mysqld-log
log-bin-index = mysqld-bin.index
binlog_cache_size = 4M
max_binlog_cache_size = 8M
max_binlog_size = 512M
expire_logs_days = 7
key_buffer_size = 32M
read_buffer_size = 1M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_max_extra_sort_file_size = 10G
myisam_repair_threads = 1
myisam_recover
skip-bdb

innodb_additional_mem_pool_size = 16M
#innodb_buffer_pool_size最大值只能设定到物理内存的80%
innodb_buffer_pool_size = 2048M
#linux选项
#innodb_data_file_path = ibdata1:1024M:autoextend
innodb_file_io_threads = 4
innodb_thread_concurrency = 8
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 16M
innodb_log_file_size = 128M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
innodb_file_per_table = 0

[mysqlhotcopy]
interactive-timeout

[mysqld_safe]
open-files-limit = 3072
回复

使用道具 举报

千问 | 2008-7-6 20:41:58 | 显示全部楼层
basedir="C:/Program Files/MySQL/MySQL Server 5.0/"
datadir="C:/Program Files/MySQL/MySQL Server 5.0/Data/"
安装在C盘呀??数据也放C盘呀??
回复

使用道具 举报

千问 | 2008-7-6 20:41:58 | 显示全部楼层
C盘不好吧,c盘用来装系统的,而且数据大了怎么办?
回复

使用道具 举报

千问 | 2008-7-6 20:41:58 | 显示全部楼层
根据使用情况慢慢调整。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行