Mysql 多实例multi_mysqld_multi 启动 mysql 多实例

因为连接数的问题,我不得不在一台机器上多启 mysql instance

1. 建立两个 mysql 数据库实例

mysql_install_db --datadir=xxx

2. 配置 /etc/my.cnf

[client]

#password= your_password

#port= 3306

#socket= /var/lib/mysql/mysql.sock

# Here follows entries for some specific programs

[mysqld_multi]

mysqld = /usr/bin/mysqld_safe

mysqladmin = /usr/bin/mysqladmin

user = mysql

password = mysql

[mysqld1]

datadir = /home/intple/mysql/data1

max_connections = 800

long_query_time = 0.1

#log-queries-not-using-indexes

slow_query_log = 1

slow_query_log_file = /var/log/mysql-slow.log

port= 3306

socket= /home/intple/mysql/data1/mysql.sock

skip-locking

key_buffer_size = 384M

max_allowed_packet = 1M

table_open_cache = 512

sort_buffer_size = 2M

read_buffer_size = 2M

read_rnd_buffer_size = 8M

myisam_sort_buffer_size = 64M

thread_cache_size = 32

query_cache_size = 512M

# Try number of CPU's*2 for thread_concurrency

thread_concurrency = 32

log-bin=mysql-bin

server-id = 1

binlog_format=mixed

innodb_buffer_pool_size = 20G

innodb_additional_mem_pool_size = 32M

innodb_thread_concurrency = 32

# Set .._log_file_size to 25 % of buffer pool size

innodb_log_file_size = 256M

innodb_log_buffer_size = 32M

innodb_flush_log_at_trx_commit = 1

innodb_autoextend_increment = 64M

innodb_lock_wait_timeout = 200

[mysqld2]

datadir = /home/intple/mysql/data2

max_connections = 800

long_query_time = 0.1

#log-queries-not-using-indexes

slow_query_log = 1

slow_query_log_file = /var/log/mysql2-slow.log

port= 3307

socket= /home/intple/mysql/data2/mysql2.sock

skip-locking

key_buffer_size = 384M

max_allowed_packet = 1M

table_open_cache = 512

sort_buffer_size = 2M

read_buffer_size = 2M

read_rnd_buffer_size = 8M

myisam_sort_buffer_size = 64M

thread_cache_size = 32

query_cache_size = 512M

# Try number of CPU's*2 for thread_concurrency

thread_concurrency = 32

log-bin=mysql-bin

server-id= 1

binlog_format=mixed

innodb_buffer_pool_size = 20G

innodb_additional_mem_pool_size = 32M

innodb_thread_concurrency = 32

# Set .._log_file_size to 25 % of buffer pool size

innodb_log_file_size = 256M

innodb_log_buffer_size = 32M

innodb_flush_log_at_trx_commit = 1

innodb_autoextend_increment = 64M

innodb_lock_wait_timeout = 200

[mysqldump]

quick

max_allowed_packet = 16M

[mysql]

no-auto-rehash

# Remove the next comment character if you are not familiar with SQL

#safe-updates

[myisamchk]

key_buffer_size = 256M

sort_buffer_size = 256M

read_buffer = 2M

write_buffer = 2M

[mysqlhotcopy]

interactive-timeout

3. 启动

mysqld_multi start 1 &

mysqld_multi start 2 &

posted on 2011-07-12 15:59 哈哈的日子 阅读(462) 评论(0)  编辑  收藏

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值