⑤修改Slave数据库的配置文件
以192.168.1.5 Slave数据库的配置文件为例
修改/etc/my.cnf ,在[MySQLd]区段内加入参数
- # vi /etc/my.cnf
- master-host=192.168.1.3
- master-user=testbak
- master-password=**** //自己指定
- master-port=3306
- server-id=2
- master-connect-retry=60 预设重试间隔60秒
- replicate-do-db=hello 告诉slave只做ephd数据库的更新
- log-slave-updates
- *******************************************************************************
- # Example MySQL config file for very large systems.
- #
- # This is for large system with memory of 1G-2G 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/MySQL/var) or
- # ~/.my.cnf to set user-specific options.
- #
- # One can in this file use all long options that the program supports.
- # If you want to know which options a program support, run the program
- # with --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
- set-variable = key_buffer=384M
- set-variable = max_allowed_packet=1M
- set-variable = table_cache=512
- set-variable = sort_buffer=2M
- set-variable = record_buffer=2M
- set-variable = thread_cache=8
- # Try number of CPU's*2 for thread_concurrency
- set-variable = thread_concurrency=8
- set-variable = myisam_sort_buffer_size=64M
- master-host=192.168.1.3
- master-user=testbak
- master-password=testbak
- master-port=3306
- server-id=2
- master-connect-retry=60
- replicate-do-db=hello
- log-slave-updates
- # Point the following paths to different dedicated disks
- #tmpdir = /tmp/
- #log-update = /path-to-dedicated-directory/hostname
时间:2010-10-20 10:02 来源:phpchina 作者:phpchina 原文链接