一、安装部署mysql5.7
1.软件下载
mv mysql-5.7.20-linux-glibc2.12-x86_64 ../mysql-5.7
mkdir -p /var/lib/mysql/data
cd /usr/local/mysql-5.7/
useradd -M -s /sbin/nologin mysql
chown -R mysql:mysql /var/lib/mysql/data
cd /var/lib/mysql/data
配置文件
vi my.cnf
[client]
port=3306
socket=/var/lib/mysql/data/mysql.sock
default-character-set = utf8mb4
init-connect='SET NAMES utf8mb4'
character-set-server = utf8mb4
[mysqld]
# server configuration
# directory config
datadir=/var/lib/mysql/data
basedir=/usr/local/mysql-5.7/
port=3306
socket=/var/lib/mysql/data/mysql.sock
#replica config
server_id=1
gtid_mode=ON
enforce_gtid_consistency=ON
master_info_repository=TABLE
relay_log_info_repository=TABLE
binlog_checksum=NONE
log_slave_updates=ON
log_bin=binlog
binlog_format=ROW
# mgr config
transaction_write_set_extraction=XXHASH64
loose-group_replication_group_name="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
loose-group_replication_start_on_boot=off
loose-group_replication_local_address= "192.168.110.139:33061" -- 独立于应用连接端口
# Note that this option does not need to list all members in the group, but rather a list of servers that should b#e contacted in case this server wishes to join the group
#The server that starts the group does not make use of this option, since it is the initial server and as
#such, it is in charge of bootstrapping the group.
loose-group_replication_group_seeds= "192.168.110.139:33061,192.168.110.140:33061,192.168.110.141:33061" -- 不需要列出所有成员,最好都列出来
loose-group_replication_bootstrap_group= off
# 字符集
default-character-set = utf8mb4
init-connect='SET NAMES utf8mb4'
character-set-server = utf8mb4
# 存储引擎
default_storage_engine = Innodb
# 内存
innodb_buffer_pool_size = 48G
# redo
innodb_log_buffer_size = 16M
innodb_log_file_size = 1024M
innodb_log_files_in_group = 3
innodb_log_group_home_dir = /var/lib/mysql/data
# io
innodb_flush_log_at_trx_commit = 1
sync_binlog = 1
#初始化连接
init_connect = 'set names utf8mb4'
# report_host
report_port = 3306
report_host = 192.168.110.139
#logs
general_log = 0
log_error =/var/lib/mysql/data/mysql_error.log
slow_query_log_file = /var/lib/mysql/data/mysql_slow.log
general_log_file = /var/lib/mysql/data/mysql_general.log
# relay_log = /var/lib/mysql/data/relay-bin
# 组内成员独立配置选项
server_id, datadir, group_replication_local_address
2.目录规划