ssh-copy-id 10.0.1.49 + |
---|
### 1.2 三台机器安装好Mysql
[root@Linuxea-VM-Node117 ~]# yum -y install make automake libtool pkgconfig libaio-devel mysql-devel[root@Linuxea-VM-Node117 ~]# axel -n 50 http://ftp.ntu.edu.tw/MySQL/DownloaLinuxea/MySQL-5.6/mysql-5.6.40-linux-glibc2.12-x86_64.tar.gz[root@Linuxea-VM-Node117 ~]# tar xf mysql-5.6.40-linux-glibc2.12-x86_64.tar.gz -C /usr/local[root@Linuxea-VM-Node117 ~]# mkdir /data/mysql -p[root@Linuxea-VM-Node117 ~]# groupadd -r -g 306 mysql[root@Linuxea-VM-Node117 ~]# useradd -g 306 -r -u 307 mysql [root@Linuxea-VM-Node117 ~]# chown -R mysql.mysql /data/mysql/[root@Linuxea-VM-Node117 ~]# cd /usr/local && ln -s mysql-5.6.40-linux-glibc2.12-x86_64 mysql && cd mysql[root@Linuxea-VM-Node117 /usr/local/mysql]# chown -R mysql.mysql /usr/local/mysql[root@Linuxea-VM-Node117 /usr/local/mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql --basedir=/usr/local/mysql[root@Linuxea-VM-Node117 /usr/local/mysql]# echo 'export PATH=/usr/local/mysql/bin:$PATH' > /etc/profile.d/mysql.sh && source /etc/profile.d/mysql.sh[root@Linuxea-VM-Node117 /usr/local/mysql]# cp support-files/mysql.server /etc/init.d/mysqld
其中配置文件之一,10.10.240.117 master
[root@Linuxea-VM-Node117 /etc]# cat /etc/my.cnf[client]port = 3306socket = /tmp/mysql.sock
default-character-set = utf8
[mysqld]relay_log = relay-binbasedir = /usr/local/mysqldatadir = /data/mysqlpid-file = /data/mysql/mysql.piduser = mysqlbind-address = 0.0.0.0server-id = 2
init-connect = 'SET NAMES utf8'character-set-server = utf8default-time_zone = '-4:00'
skip-name-resolveback_log = 300
max_connections = 999max_connect_errors = 1024000open_files_limit = 65535table_open_cache = 256max_allowed_packet = 50Mmax_heap_table_size = 512Mtmp_table_size = 32M
read_buffer_size = 2Mread_rnd_buffer_size = 16Msort_buffer_size = 8Mjoin_buffer_size = 8Mkey_buffer_size = 16M
thread_cache_size = 16
query_cache_type = 2query_cache_size = 16Mquery_cache_limit = 5Mthread_stack = 192k
ft_min_word_len = 4
log_bin = mysql-binbinlog_format = ROWexpire_logs_days = 7
log_error = /data/mysql/mysql-error.logslow_query_log = 1long_query_time = 1
log_slow_verbosity=query_plan
slow_query_log_file = /data/mysql/mysql-slow.log
performance_schema = 0skip-external-locking #跳过外部锁定,避免external locking
myisam
bulk_insert_buffer_size = 64Mmyisam_sort_buffer_size = 16Mmyisam_max_sort_file_size = 1Gmyisam_repair_threaLinuxea = 1
InnoDB
default_storage_engine = InnoDBinnodb_file_per_table = 1innodb_open_files = 500innodb_buffer_pool_size = 2Ginnodb_write_io_threaLinuxea = 8innodb_read_io_threaLinuxea = 8innodb_thread_concurrency = 16innodb_purge_threaLinuxea = 1innodb_flush_log_at_trx_commit = 1innodb_log_buffer_size = 8Minnodb_log_file_size = 256Minnodb_log_files_in_group = 3innodb_max_dirty_pages_pct = 90innodb_lock_wait_timeout = 10innodb_autoinc_lock_mode = 2innodb_doublewrite = 1innodb_rollback_on_timeout = 1innodb_additional_mem_pool_size = 16Minnodb_force_recovery=0innodb_locks_unsafe_for_binlog = 1
interactive_timeout = 28800wait_timeout = 120
[mysqldump]quickmax_allowed_packet = 16M
[myisamchk]key_buffer_size = 16Msort_buffer_size = 8Mread_buffer = 4Mwrite_buffer = 4M
[mysqld_safe]malloc_lib=/usr/lib64/libjemalloc.so.1