博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
PXC 安装 for 5.7
阅读量:4966 次
发布时间:2019-06-12

本文共 5567 字,大约阅读时间需要 18 分钟。

系统centos7及以上版本

  

安装依赖包:

yum install perl-IO-Socket-SSL perl-DBD-MySQL perl-Time-HiRes socat nc -y

yum install –y openssl openssl-develxtrabackup

如果提示已经安装,可以使用

#updatedb
#locate libssl.so 看看能不能找到 然后用
# ldd /usr/local/mysql/bin/mysqld 查看还有那些依赖需安装安装:

rpm -qa|grep openssl

yum localinstall percona-xtrabackup-24-2.4.9-1.el6.x86_64.rpm

vim /etc/ld.so.conf.d/mysql.conf

下载软件包

wget 

node1

初始化:

/letv/usr/local/mysql/bin/mysqld --defaults-file=/letv/mysql/mysql3366/etc/my3366.cnf --initialize

启动:

/letv/usr/local/mysql/bin/mysqld --defaults-file=/letv/mysql/mysql3366/etc/my3366.cnf --wsrep-new-cluster &

登录修改密码

cat data/error.log |grep password

mysql -S /tmp/mysql3366.sock -uroot -p

alter user() identified by 'zyqzyq';

创建一个做sst的账号

grant reload, lock tables, replication client, process on . to  'sst'@'localhost' identified by 'zyqzyq';

node2

初始化

/letv/usr/local/mysql/bin/mysqld --defaults-file=/letv/mysql/mysql3366/etc/my3366.cnf --initialize

启动 

/letv/usr/local/mysql/bin/mysqld --defaults-file=/letv/mysql/mysql3366/etc/my3366.cnf &

node3

/letv/usr/local/mysql/bin/mysqld --defaults-file=/letv/mysql/mysql3366/etc/my3366.cnf --initialize

/letv/usr/local/mysql/bin/mysqld --defaults-file=/letv/mysql/mysql3366/etc/my3366.cnf &

 

附配置文件:

cat etc/my3366.cnf

[client]
port = 3366

[mysql]

auto-rehash
prompt="\\u@\\h [\\d]>"
#pager="less -i -n -S"
#tee=/opt/mysql/query.log

[mysqld]

####: for global
user =mysql # mysql
basedir =/letv/usr/local/mysql/ # /usr/local/mysql/
datadir =/letv/mysql/mysql3366/data # /usr/local/mysql/data
server_id =313366 # 0
port =3366 # 3366
character_set_server =utf8 
log_timestamps =system
default_time_zone ='+8:00' 
socket =/tmp/mysql3366.sock 
read_only =0 # off
skip_name_resolve =off # 0
auto_increment_increment =1 # 1
auto_increment_offset =1 # 1
lower_case_table_names =1 # 0
secure_file_priv = /tmp/ # null
open_files_limit =65536 # 1024
max_connections =1000 # 151
thread_cache_size =64 # 9
table_open_cache =81920 # 2000
table_definition_cache =4096 # 1400
table_open_cache_instances =64 # 16
max_prepared_stmt_count =1048576 #

####: for binlog

binlog_format =row # row
log_bin =/letv/mysql/mysql3366/logs/mysql-bin # off
binlog_rows_query_log_events =on # off
log_slave_updates =on # off
expire_logs_days =7 # 0
binlog_cache_size =65536 # 65536(64k)
#binlog_checksum =none # CRC32
sync_binlog =1 # 1
slave-preserve-commit-order =ON #

####: for error-log

log_error =error.log # /usr/local/mysql/data/localhost.localdomain.err

general_log =off # off

general_log_file =general.log # hostname.log

####: for slow query log

slow_query_log =on # off
slow_query_log_file =slow.log # hostname.log
#log_queries_not_using_indexes =on # off
long_query_time =1.000000 # 10.000000

####: for gtid

#gtid_executed_compression_period =1000 # 1000
gtid_mode =on # off
enforce_gtid_consistency =on # off

####: for replication

skip_slave_start =1 #
#master_info_repository =table # file
#relay_log_info_repository =table # file
slave_parallel_type =logical_clock # database | LOGICAL_CLOCK
slave_parallel_workers =4 # 0
#rpl_semi_sync_master_enabled =1 # 0
#rpl_semi_sync_slave_enabled =1 # 0
#rpl_semi_sync_master_timeout =1000 # 1000(1 second)
#plugin_load_add =semisync_master.so #
#plugin_load_add =semisync_slave.so #
binlog_group_commit_sync_delay =100 # 500(0.05%秒)、默认值0
binlog_group_commit_sync_no_delay_count = 10 # 0

####: for innodb

innodb_data_file_path =ibdata1:100M:autoextend # ibdata1:12M:autoextend
innodb_temp_data_file_path =ibtmp1:12M:autoextend # ibtmp1:12M:autoextend
innodb_buffer_pool_filename =ib_buffer_pool # ib_buffer_pool
innodb_log_group_home_dir =./ # ./
innodb_log_files_in_group =3 # 2
innodb_log_file_size =100M # 50331648(48M)
innodb_file_per_table =on # on
innodb_online_alter_log_max_size =128M # 134217728(128M)
innodb_open_files =65535 # 2000
innodb_page_size =16k # 16384(16k)
innodb_thread_concurrency =0 # 0
innodb_read_io_threads =4 # 4
innodb_write_io_threads =4 # 4
innodb_purge_threads =4 # 4(垃圾回收)
innodb_page_cleaners =4 # 4(刷新lru脏页)
innodb_print_all_deadlocks =on # off
innodb_deadlock_detect =on # on
innodb_lock_wait_timeout =20 # 50
innodb_spin_wait_delay =128 # 6
innodb_autoinc_lock_mode =2 # 1
innodb_io_capacity =200 # 200
innodb_io_capacity_max =2000 # 2000
#--------Persistent Optimizer Statistics
innodb_stats_auto_recalc =on # on
innodb_stats_persistent =on # on
innodb_stats_persistent_sample_pages =20 # 20

innodb_change_buffer_max_size =25 # 25

innodb_flush_neighbors =1 # 1
#innodb_flush_method = #
innodb_doublewrite =on # on
innodb_log_buffer_size =128M # 16777216(16M)
innodb_flush_log_at_timeout =1 # 1
innodb_flush_log_at_trx_commit =1 # 1
innodb_buffer_pool_size =100M # 134217728(128M)
innodb_buffer_pool_instances =4
#--------innodb scan resistant
innodb_old_blocks_pct =37 # 37
innodb_old_blocks_time =1000 # 1000
#--------innodb read ahead
innodb_read_ahead_threshold =56 # 56 (0..64)
innodb_random_read_ahead =OFF # OFF
#---innodb buffer pool state
innodb_buffer_pool_dump_pct =25 # 25
innodb_buffer_pool_dump_at_shutdown =ON # ON
innodb_buffer_pool_load_at_startup =ON # ON
innodb_flush_method = O_DIRECT

#pxc

innodb_locks_unsafe_for_binlog=1
innodb_autoinc_lock_mode=2

loose-wsrep_cluster_name=pxc_zyq

loose-wsrep_cluster_address=gcomm://172.0.0.1,172.0.0.2,172.0.0.3
loose-wsrep_node_address=172.0.0.1
loose-wsrep_provider=/letv/usr/local/mysql/lib/libgalera_smm.so

loose-wsrep_sst_method=xtrabackup-v2

loose-wsrep_sst_method=rsync
loose-wsrep_sst_auth=sst:zyqzyq

loose-wsrep_debug=on

loose-wsrep_provider_options="debug=on"

转载于:https://www.cnblogs.com/DBA-3306/p/11042684.html

你可能感兴趣的文章
JS第二周
查看>>
杭电1217————不像最短路的"最短路"
查看>>
【iCore3双核心板】发布 iCore3 硬件手册!
查看>>
Leetcode Word Break
查看>>
css性质
查看>>
python数据结构
查看>>
正则指引-括号(3)反向引用
查看>>
android开发读书笔记
查看>>
Gitlab配置、备份、升级、迁移
查看>>
dataTable.NET的search box每輸入一個字母進行一次檢索的問題
查看>>
Python 文件处理
查看>>
邻接表详解
查看>>
android,radio,checkbox
查看>>
[转](.NET Core C#) AES Encryption
查看>>
[转]EntityFramework中常用的数据修改方式
查看>>
[转]SQL Collation冲突解决 临时表
查看>>
[转]Gitlab-CI持续集成之Runner配置和CI脚本
查看>>
Spark&Hive结合起来
查看>>
使用Flex和java servlet上传文件
查看>>
软件工程的实践项目课程的自我目标
查看>>