free -m
exit
fdisk -l
fdisk /dev/sdb
mke2fs -t ext4 /dev/sdb1
mke2fs -t ext4 /dev/sdb2
mount /dev/sdb1 /opt
mount /dev/sdb2 /backup
mkdir /backup
vi /etc/fs
vi /etc/fstab
df -h
mount /dev/sdb2 /backup
df -h
umount /dev/sdb1
umount /dev/sdb2
mke2fs -t ext4 /dev/sdb
mount /dev/sdb /opt
vi /etc/fstab
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.28-el7-x86_64.tar.gz
df -h
free -g
ls -ltr
tar -xzvf mysql-5.7.28-el7-x86_64.tar.gz -C /usr/local/
cd /usr/local/
ln -s mysql-5.7.28-el7-x86_64 mysql
groupadd mysql
useradd -r -g mysql -s /bin/false mysql
cd /opt
ls
mkdir data
chown mysql.mysql data
chmod 755 /opt/data
yum install libaio-devel.x86_64
cd /usr/local/mysql
bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/opt/data
bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/opt/data
bin/mysql_ssl_rsa_setup --datadir=/opt/data
vi /etc/my.cnf
[client]
port = 3306
default-character-set = utf8
[mysqld_safe]
log-error=/opt/data/mysql.err.log
nice = 0
[mysqld]
server-id=1
symbolic-links=0
innodb_buffer_pool_size=150816M
performance_schema=OFF
log_bin = mysql-bin.log
expire_logs_days = 30
max_binlog_size = 300M
binlog_format = row
basedir=/usr/local/mysql
innodb_log_file_size=200M
innodb_flush_log_at_trx_commit=1
sync_binlog=1
slave_skip_errors = ddl_exist_errors
character_set_server=utf8
lower_case_table_names=1
skip_name_resolve
explicit_defaults_for_timestamp = 1
datadir=/opt/data
default-storage-engine = INNODB
#binlog
gtid-mode=on
log-bin
log-slave-updates=true
enforce-gtid-consistency=true
master-info-repository=TABLE
relay-log-info-repository=TABLE
sync-master-info=1
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
symbolic-links=0
!includedir /etc/mysql/conf.d/
bin/mysqld_safe --user=mysql &
bin/mysql -uroot -p'DZ<(*d&l&36I'
set password=password('12345qwe');
cp support-files/mysql.server /etc/init.d/mysql
service mysql restart
ps -ef|grep mysql
主从
change master to master_host='192.168.3.130' ,master_user='repl',master_password='repl',master_auto_position=1;
start slave
mysql> show slave status\G;
show global status like 'rpl%';
主 set global rpl_semi_sync_master_enabled=1;
从set global rpl_semi_sync_slave_enabled=1;
stop slave io_thread;
Query OK, 0 rows affected (0.00 sec)
mysql> start slave io_thread;
Query OK, 0 rows affected (0.00 sec)