前言:pxc全名Percona XtraDB Cluster,是Percona公司免費開源的一款優(yōu)秀的高可用解決方案丧裁,并且已經(jīng)在很多企業(yè)中部署到生產(chǎn)環(huán)境护桦。pxc具有多主復(fù)制、數(shù)據(jù)強一致性等優(yōu)秀特性渣慕,具體原理特性等放到下一篇介紹嘶炭,本篇主要介紹快速安裝部署PXC集群抱慌。
說明 | ip |
---|---|
node1 | 192.168.50.3 |
node2 | 192.168.50.4 |
node3 | 192.168.50.5 |
一、安裝依賴
yum install perl-IO-Socket-SSL perl-DBD-MySQL perl-Time-HiRes socat nc -y
二眨猎、安裝xtrabackup
去wwww.percona.com下載最新版本xtrabackup的rpm包抑进,具體參考前面的xtrabackup安裝文檔xtrabackup安裝使用
rpm -ivh percona-xtrabackup-24-2.4.9-1.el6.x86_64.rpm
三、安裝pxc
1.下載安裝包
去wwww.percona.com下載最新版本Percona-XtraDB-Cluster二進制包睡陪,先不急著初始化
特別注意二進制包:
ssl100: for all supported Debian and Ubuntu versions
ssl101: for supported Red Hat Enterprise Linux derivatives
我們一般下載ssl101的二進制包即可
解壓到/usr/local/mysql或者做軟連接也可以寺渗。
2.配置文件
node1配置文件:
#my.cnf
[client]
port = 3306
socket = /tmp/mysql.sock
[mysql]
prompt="\\u@\\h:\\p [\\d]>
#pager="less -i -n -S"
#tee=/home/mysql/query.log
no-auto-rehash
[mysqld]
#misc
user = mysql
basedir = /usr/local/mysql
datadir = /data/pxc/mysql3306/data
port = 3306
socket = /tmp/mysql.sock
event_scheduler = 0
#timeout
interactive_timeout = 300
wait_timeout = 300
#character set
character-set-server = utf8
open_files_limit = 65535
max_connections = 100
max_connect_errors = 100000
#logs
log-output=file
slow_query_log = 1
slow_query_log_file = slow.log
log-error = error.log
log_warnings = 2
pid-file = mysql.pid
long_query_time = 1
#log-slow-admin-statements = 1
#log-queries-not-using-indexes = 1
log-slow-slave-statements = 1
#binlog
binlog_format = row
server-id = 1023306
log-bin = /data/pxc/mysql3306/logs/mysql-bin
binlog_cache_size = 1M
max_binlog_size = 200M
max_binlog_cache_size = 2G
sync_binlog = 0
expire_logs_days = 10
#relay log
skip_slave_start = 1
max_relay_log_size = 500M
relay_log_purge = 1
relay_log_recovery = 1
log_slave_updates
#slave-skip-errors=1032,1053,1062
#buffers & cache
table_open_cache = 2048
table_definition_cache = 2048
table_open_cache = 2048
max_heap_table_size = 96M
sort_buffer_size = 2M
join_buffer_size = 2M
thread_cache_size = 256
query_cache_size = 0
query_cache_type = 0
query_cache_limit = 256K
query_cache_min_res_unit = 512
thread_stack = 192K
tmp_table_size = 96M
key_buffer_size = 8M
read_buffer_size = 2M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 32M
#myisam
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
#innodb
innodb_buffer_pool_size = 100M
innodb_buffer_pool_instances = 1
innodb_data_file_path = ibdata1:100M:autoextend
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 64M
innodb_log_file_size = 256M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_file_per_table = 1
innodb_rollback_on_timeout
innodb_status_file = 1
innodb_io_capacity = 2000
transaction_isolation = READ-COMMITTED
innodb_flush_method = O_DIRECT
#pxc
default_storage_engine=Innodb
innodb_locks_unsafe_for_binlog=1
innodb_autoinc_lock_mode=2
wsrep_cluster_name=pxc_xucl
wsrep_cluster_address=gcomm://192.168.50.3,192.168.50.4,192.168.50.5
wsrep_node_address=192.168.50.3
wsrep_provider=/usr/local/mysql/lib/libgalera_smm.so
wsrep_sst_method=xtrabackup-v2
wsrep_sst_auth=sst:xuclxucl
node2配置文件:
#my.cnf
[client]
port = 3306
socket = /tmp/mysql.sock
[mysql]
prompt="\\u@\\h:\\p [\\d]>
#pager="less -i -n -S"
#tee=/home/mysql/query.log
no-auto-rehash
[mysqld]
#misc
user = mysql
basedir = /usr/local/mysql
datadir = /data/pxc/mysql3306/data
port = 3306
socket = /tmp/mysql.sock
event_scheduler = 0
#timeout
interactive_timeout = 300
wait_timeout = 300
#character set
character-set-server = utf8
open_files_limit = 65535
max_connections = 100
max_connect_errors = 100000
#logs
log-output=file
slow_query_log = 1
slow_query_log_file = slow.log
log-error = error.log
log_warnings = 2
pid-file = mysql.pid
long_query_time = 1
#log-slow-admin-statements = 1
#log-queries-not-using-indexes = 1
log-slow-slave-statements = 1
#binlog
binlog_format = row
server-id = 1023306
log-bin = /data/pxc/mysql3306/logs/mysql-bin
binlog_cache_size = 1M
max_binlog_size = 200M
max_binlog_cache_size = 2G
sync_binlog = 0
expire_logs_days = 10
#relay log
skip_slave_start = 1
max_relay_log_size = 500M
relay_log_purge = 1
relay_log_recovery = 1
log_slave_updates
#slave-skip-errors=1032,1053,1062
#buffers & cache
table_open_cache = 2048
table_definition_cache = 2048
table_open_cache = 2048
max_heap_table_size = 96M
sort_buffer_size = 2M
join_buffer_size = 2M
thread_cache_size = 256
query_cache_size = 0
query_cache_type = 0
query_cache_limit = 256K
query_cache_min_res_unit = 512
thread_stack = 192K
tmp_table_size = 96M
key_buffer_size = 8M
read_buffer_size = 2M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 32M
#myisam
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
#innodb
innodb_buffer_pool_size = 100M
innodb_buffer_pool_instances = 1
innodb_data_file_path = ibdata1:100M:autoextend
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 64M
innodb_log_file_size = 256M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_file_per_table = 1
innodb_rollback_on_timeout
innodb_status_file = 1
innodb_io_capacity = 2000
transaction_isolation = READ-COMMITTED
innodb_flush_method = O_DIRECT
#pxc
default_storage_engine=Innodb
innodb_locks_unsafe_for_binlog=1
innodb_autoinc_lock_mode=2
wsrep_cluster_name=pxc_xucl
wsrep_cluster_address=gcomm://192.168.50.3,192.168.50.4,192.168.50.5
wsrep_node_address=192.168.50.4
wsrep_provider=/usr/local/mysql/lib/libgalera_smm.so
wsrep_sst_method=xtrabackup-v2
wsrep_sst_auth=sst:xuclxucl
node3配置文件:
#my.cnf
[client]
port = 3306
socket = /tmp/mysql.sock
[mysql]
prompt="\\u@\\h:\\p [\\d]>
#pager="less -i -n -S"
#tee=/home/mysql/query.log
no-auto-rehash
[mysqld]
#misc
user = mysql
basedir = /usr/local/mysql
datadir = /data/pxc/mysql3306/data
port = 3306
socket = /tmp/mysql.sock
event_scheduler = 0
#timeout
interactive_timeout = 300
wait_timeout = 300
#character set
character-set-server = utf8
open_files_limit = 65535
max_connections = 100
max_connect_errors = 100000
#logs
log-output=file
slow_query_log = 1
slow_query_log_file = slow.log
log-error = error.log
log_warnings = 2
pid-file = mysql.pid
long_query_time = 1
#log-slow-admin-statements = 1
#log-queries-not-using-indexes = 1
log-slow-slave-statements = 1
#binlog
binlog_format = row
server-id = 1023306
log-bin = /data/pxc/mysql3306/logs/mysql-bin
binlog_cache_size = 1M
max_binlog_size = 200M
max_binlog_cache_size = 2G
sync_binlog = 0
expire_logs_days = 10
#relay log
skip_slave_start = 1
max_relay_log_size = 500M
relay_log_purge = 1
relay_log_recovery = 1
log_slave_updates
#slave-skip-errors=1032,1053,1062
#buffers & cache
table_open_cache = 2048
table_definition_cache = 2048
table_open_cache = 2048
max_heap_table_size = 96M
sort_buffer_size = 2M
join_buffer_size = 2M
thread_cache_size = 256
query_cache_size = 0
query_cache_type = 0
query_cache_limit = 256K
query_cache_min_res_unit = 512
thread_stack = 192K
tmp_table_size = 96M
key_buffer_size = 8M
read_buffer_size = 2M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 32M
#myisam
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
#innodb
innodb_buffer_pool_size = 100M
innodb_buffer_pool_instances = 1
innodb_data_file_path = ibdata1:100M:autoextend
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 64M
innodb_log_file_size = 256M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_file_per_table = 1
innodb_rollback_on_timeout
innodb_status_file = 1
innodb_io_capacity = 2000
transaction_isolation = READ-COMMITTED
innodb_flush_method = O_DIRECT
#pxc
default_storage_engine=Innodb
innodb_locks_unsafe_for_binlog=1
innodb_autoinc_lock_mode=2
wsrep_cluster_name=pxc_xucl
wsrep_cluster_address=gcomm://192.168.50.3,192.168.50.4,192.168.50.5
wsrep_node_address=192.168.50.5
wsrep_provider=/usr/local/mysql/lib/libgalera_smm.so
wsrep_sst_method=xtrabackup-v2
wsrep_sst_auth=sst:xuclxucl
3.初始化節(jié)點1
/usr/local/mysql/bin/mysqld --defaults-file=/data/pxc/my.cnf --initialize
查看error.log輸出如下:
2018-03-22T08:31:02.663756Z 0 [Warning] The syntax '--log_warnings/-W' is deprecated and will be removed in a future release. Please use '--log_error_verbosity' instead.
2018-03-22T08:31:02.663919Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-03-22T08:31:02.663957Z 0 [Note] Ignoring --secure-file-priv value as server is running with --initialize(-insecure) or --bootstrap.
2018-03-22T08:31:02.663970Z 0 [Warning] WSREP: Node is running in bootstrap/initialize mode. Disabling pxc_strict_mode checks
2018-03-22T08:31:02.663985Z 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.7.21-20-29.26-log) starting as process 7358 ...
2018-03-22T08:31:02.665381Z 0 [Note] --initialize specifed on an existing data directory.
2018-03-22T08:31:02.665956Z 0 [Note] WSREP: Setting wsrep_ready to false
2018-03-22T08:31:02.665969Z 0 [Note] WSREP: Found pre-stored initial position: 3330362f-6461-7461-2f00-f50000000000:41556992
2018-03-22T08:31:02.665972Z 0 [Note] WSREP: wsrep_load(): loading provider library 'none'
2018-03-22T08:31:02.665975Z 0 [Note] WSREP: Setting wsrep_ready to true
2018-03-22T08:31:02.678611Z 0 [Warning] InnoDB: Using innodb_locks_unsafe_for_binlog is DEPRECATED. This option may be removed in future releases. Please use READ COMMITTED transaction isolation level instead; Please refer to http://dev.mysql.com/doc/refman/5.7/en/set-transaction.html
2018-03-22T08:31:02.678640Z 0 [Note] InnoDB: PUNCH HOLE support available
2018-03-22T08:31:02.678648Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-03-22T08:31:02.678651Z 0 [Note] InnoDB: Uses event mutexes
2018-03-22T08:31:02.678655Z 0 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
2018-03-22T08:31:02.678658Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-03-22T08:31:02.678661Z 0 [Note] InnoDB: Using Linux native AIO
2018-03-22T08:31:02.678831Z 0 [Note] InnoDB: Number of pools: 1
2018-03-22T08:31:02.678910Z 0 [Note] InnoDB: Using CPU crc32 instructions
2018-03-22T08:31:02.680144Z 0 [Note] InnoDB: Initializing buffer pool, total size = 100M, instances = 1, chunk size = 100M
2018-03-22T08:31:02.682565Z 0 [Note] InnoDB: Completed initialization of buffer pool
2018-03-22T08:31:02.683764Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2018-03-22T08:31:02.693950Z 0 [Note] InnoDB: The first innodb_system data file 'ibdata1' did not exist. A new tablespace will be created!
2018-03-22T08:31:02.694166Z 0 [Note] InnoDB: Setting file './ibdata1' size to 100 MB. Physically writing the file full; Please wait ...
2018-03-22T08:31:02.694496Z 0 [Note] InnoDB: Progress in MB:
100
2018-03-22T08:31:03.069672Z 0 [Note] InnoDB: File './ibdata1' size is now 100 MB.
2018-03-22T08:31:03.069892Z 0 [Note] InnoDB: Setting log file ./ib_logfile101 size to 256 MB
2018-03-22T08:31:03.070000Z 0 [Note] InnoDB: Progress in MB:
100 200
2018-03-22T08:31:03.598100Z 0 [Note] InnoDB: Setting log file ./ib_logfile1 size to 256 MB
2018-03-22T08:31:03.598220Z 0 [Note] InnoDB: Progress in MB:
100 200
2018-03-22T08:31:03.882825Z 0 [Note] InnoDB: Setting log file ./ib_logfile2 size to 256 MB
2018-03-22T08:31:03.882945Z 0 [Note] InnoDB: Progress in MB:
100 200
2018-03-22T08:31:04.246505Z 0 [Note] InnoDB: Created parallel doublewrite buffer at /data/pxc/mysql3306/data/xb_doublewrite, size 3932160 bytes
2018-03-22T08:31:04.318847Z 0 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2018-03-22T08:31:04.318914Z 0 [Warning] InnoDB: New log files created, LSN=45790
2018-03-22T08:31:04.318923Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2018-03-22T08:31:04.318967Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2018-03-22T08:31:04.471597Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2018-03-22T08:31:04.471735Z 0 [Note] InnoDB: Doublewrite buffer not found: creating new
2018-03-22T08:31:04.543336Z 0 [Note] InnoDB: Doublewrite buffer created
2018-03-22T08:31:04.553103Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2018-03-22T08:31:04.553131Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2018-03-22T08:31:04.553757Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-03-22T08:31:04.558344Z 0 [Note] InnoDB: Foreign key constraint system tables created
2018-03-22T08:31:04.560332Z 0 [Note] InnoDB: Creating tablespace and datafile system tables.
2018-03-22T08:31:04.560727Z 0 [Note] InnoDB: Tablespace and datafile system tables created.
2018-03-22T08:31:04.560747Z 0 [Note] InnoDB: Creating sys_virtual system tables.
2018-03-22T08:31:04.560863Z 0 [Note] InnoDB: sys_virtual table created
2018-03-22T08:31:04.560874Z 0 [Note] InnoDB: Creating zip_dict and zip_dict_cols system tables.
2018-03-22T08:31:04.561233Z 0 [Note] InnoDB: zip_dict and zip_dict_cols system tables created.
2018-03-22T08:31:04.561319Z 0 [Note] InnoDB: Waiting for purge to start
2018-03-22T08:31:04.612605Z 0 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.7.21-rel20 started; log sequence number 0
2018-03-22T08:31:04.613279Z 0 [Note] Plugin 'FEDERATED' is disabled.
2018-03-22T08:31:04.622215Z 0 [Note] Salting uuid generator variables, current_pid: 7358, server_start_time: 1521707462, bytes_sent: 0,
2018-03-22T08:31:04.622269Z 0 [Note] Generated uuid: '5c50473c-2dab-11e8-9481-080027de0e0e', server_start_time: 2071092880158721668, bytes_sent: 50293392
2018-03-22T08:31:04.622282Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 5c50473c-2dab-11e8-9481-080027de0e0e.
2018-03-22T08:31:04.623391Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-03-22T08:31:05.090710Z 0 [Note] Auto generated SSL certificates are placed in data directory.
2018-03-22T08:31:05.101030Z 0 [Warning] CA certificate ca.pem is self signed.
2018-03-22T08:31:05.320481Z 0 [Note] Auto generated RSA key files are placed in data directory.
2018-03-22T08:31:05.320880Z 1 [Note] Creating the system database
2018-03-22T08:31:05.320926Z 1 [Note] A temporary password is generated for root@localhost: 5b6RO=Z<g*S9
2018-03-22T08:31:05.333922Z 1 [Note] Creating the system tables
2018-03-22T08:31:05.625787Z 1 [Note] Filling in the system tables, part 1
2018-03-22T08:31:05.626706Z 1 [Note] Filling in the system tables, part 2
2018-03-22T08:31:05.626714Z 1 [Note] Filling in the mysql.help table
2018-03-22T08:31:05.885746Z 1 [Note] Creating user for internal session service
2018-03-22T08:31:05.886040Z 1 [Note] Creating the sys schema
2018-03-22T08:31:06.166453Z 1 [Note] Bootstrapping complete
2018-03-22T08:31:06.166856Z 0 [Note] Giving 0 client threads a chance to die gracefully
2018-03-22T08:31:06.166872Z 0 [Note] WSREP: Waiting for active wsrep applier to exit
2018-03-22T08:31:06.166875Z 0 [Note] WSREP: Service disconnected.
2018-03-22T08:31:06.166877Z 0 [Note] WSREP: Waiting to close threads......
2018-03-22T08:31:11.167025Z 0 [Note] WSREP: Some threads may fail to exit.
2018-03-22T08:31:11.167118Z 0 [Note] Giving 0 client threads a chance to die gracefully
2018-03-22T08:31:11.167124Z 0 [Note] Shutting down slave threads
2018-03-22T08:31:11.167130Z 0 [Note] Forcefully disconnecting 0 remaining clients
2018-03-22T08:31:11.178224Z 0 [Note] Binlog end
2018-03-22T08:31:11.179733Z 0 [Note] InnoDB: FTS optimize thread exiting.
2018-03-22T08:31:11.179813Z 0 [Note] InnoDB: Starting shutdown...
2018-03-22T08:31:11.282666Z 0 [Note] InnoDB: Dumping buffer pool(s) to /data/pxc/mysql3306/data/ib_buffer_pool
2018-03-22T08:31:11.282837Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 180322 9:31:11
2018-03-22T08:31:11.886137Z 0 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
2018-03-22T08:31:13.408971Z 0 [Note] InnoDB: Shutdown completed; log sequence number 2556457
2018-03-22T08:31:13.409032Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
node1初始化完成,接著我們啟動node1
/usr/local/mysql/bin/mysqld --defaults-file=/data/pxc/my.cnf --wsrep-new-cluster &
說明:使用--wsrep-new-cluster 啟動兰迫, 讓他忽略參數(shù): wsrep_cluster_address 讓
他知道他是集群中的第一個節(jié)點信殊, 在啟動中不用去找其它節(jié)點。
查看error.log看到ready for connections表示啟動成功
2018-03-22T08:33:06.775084Z 0 [Warning] The syntax '--log_warnings/-W' is deprecated and will be removed in a future release. Please use '--log_error_verbosity' instead.
2018-03-22T08:33:06.775285Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-03-22T08:33:06.775353Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2018-03-22T08:33:06.775409Z 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.7.21-20-29.26-log) starting as process 7393 ...
2018-03-22T08:33:06.784742Z 0 [Note] WSREP: Setting wsrep_ready to false
2018-03-22T08:33:06.784754Z 0 [Note] WSREP: No pre-stored wsrep-start position found. Skipping position initialization.
2018-03-22T08:33:06.784757Z 0 [Note] WSREP: wsrep_load(): loading provider library '/usr/local/mysql/lib/libgalera_smm.so'
2018-03-22T08:33:06.791639Z 0 [Note] WSREP: wsrep_load(): Galera 3.26(r) by Codership Oy <info@codership.com> loaded successfully.
2018-03-22T08:33:06.791701Z 0 [Note] WSREP: CRC-32C: using hardware acceleration.
2018-03-22T08:33:06.791929Z 0 [Warning] WSREP: Could not open state file for reading: '/data/pxc/mysql3306/data//grastate.dat'
2018-03-22T08:33:06.791936Z 0 [Warning] WSREP: No persistent state found. Bootstraping with default state
2018-03-22T08:33:06.791977Z 0 [Note] WSREP: Found saved state: 00000000-0000-0000-0000-000000000000:-1, safe_to_bootstrap: 1
2018-03-22T08:33:06.800384Z 0 [Note] WSREP: Passing config to GCS: base_dir = /data/pxc/mysql3306/data/; base_host = 192.168.50.3; base_port = 4567; cert.log_conflicts = no; debug = no; evs.auto_evict = 0; evs.delay_margin = PT1S; evs.delayed_keep_period = PT30S; evs.inactive_check_period = PT0.5S; evs.inactive_timeout = PT15S; evs.join_retrans_period = PT1S; evs.max_install_timeouts = 3; evs.send_window = 10; evs.stats_report_period = PT1M; evs.suspect_timeout = PT5S; evs.user_send_window = 4; evs.view_forget_timeout = PT24H; gcache.dir = /data/pxc/mysql3306/data/; gcache.freeze_purge_at_seqno = -1; gcache.keep_pages_count = 0; gcache.keep_pages_size = 0; gcache.mem_size = 0; gcache.name = /data/pxc/mysql3306/data//galera.cache; gcache.page_size = 128M; gcache.recover = no; gcache.size = 128M; gcomm.thread_prio = ; gcs.fc_debug = 0; gcs.fc_factor = 1; gcs.fc_limit = 100; gcs.fc_master_slave = no; gcs.max_packet_size = 64500; gcs.max_throttle = 0.25; gcs.recv_q_hard_limit = 9223372036854775807; gcs.recv_q_soft_limit = 0.25; gcs.sync_donor = no; gmcast.segment = 0; gmcast.version = 0; pc.announce_timeout = PT3S; pc.checksum = false; pc.ignore_quorum = false; pc.ignore_sb = false; pc.npvo = false; pc.recovery = 1; pc.version = 0; pc.wait_prim = true; pc.wait_prim_timeout = PT30S; pc.weight = 1; protonet.backend = asio; protonet.version = 0; repl.causal_read_timeout = PT30S; repl.commit_order = 3; repl.key_format = FLAT8; repl.max_ws_size = 2147483647; repl.proto_max = 8; socket.checksum = 2; socket.recv_buf_size = 212992;
2018-03-22T08:33:06.823061Z 0 [Note] WSREP: GCache history reset: 00000000-0000-0000-0000-000000000000:0 -> 00000000-0000-0000-0000-000000000000:-1
2018-03-22T08:33:06.825847Z 0 [Note] WSREP: Assign initial position for certification: -1, protocol version: -1
2018-03-22T08:33:06.825883Z 0 [Note] WSREP: Preparing to initiate SST/IST
2018-03-22T08:33:06.825888Z 0 [Note] WSREP: Starting replication
2018-03-22T08:33:06.825900Z 0 [Note] WSREP: Setting initial position to 00000000-0000-0000-0000-000000000000:-1
2018-03-22T08:33:06.826070Z 0 [Note] WSREP: Using CRC-32C for message checksums.
2018-03-22T08:33:06.826178Z 0 [Note] WSREP: gcomm thread scheduling priority set to other:0
2018-03-22T08:33:06.826269Z 0 [Warning] WSREP: Fail to access the file (/data/pxc/mysql3306/data//gvwstate.dat) error (No such file or directory). It is possible if node is booting for first time or re-booting after a graceful shutdown
2018-03-22T08:33:06.826275Z 0 [Note] WSREP: Restoring primary-component from disk failed. Either node is booting for first time or re-booting after a graceful shutdown
2018-03-22T08:33:06.829440Z 0 [Note] WSREP: GMCast version 0
2018-03-22T08:33:06.829622Z 0 [Note] WSREP: (a5272275, 'tcp://0.0.0.0:4567') listening at tcp://0.0.0.0:4567
2018-03-22T08:33:06.829635Z 0 [Note] WSREP: (a5272275, 'tcp://0.0.0.0:4567') multicast: , ttl: 1
2018-03-22T08:33:06.829943Z 0 [Note] WSREP: EVS version 0
2018-03-22T08:33:06.830042Z 0 [Note] WSREP: gcomm: bootstrapping new group 'pxc_wubx'
2018-03-22T08:33:06.830067Z 0 [Note] WSREP: start_prim is enabled, turn off pc_recovery
2018-03-22T08:33:06.830613Z 0 [Note] WSREP: Node a5272275 state primary
2018-03-22T08:33:06.830647Z 0 [Note] WSREP: Current view of cluster as seen by this node
view (view_id(PRIM,a5272275,1)
memb {
a5272275,0
}
joined {
}
left {
}
partitioned {
}
)
2018-03-22T08:33:06.830666Z 0 [Note] WSREP: Save the discovered primary-component to disk
2018-03-22T08:33:06.830784Z 0 [Note] WSREP: discarding pending addr without UUID: tcp://192.168.50.3:4567
2018-03-22T08:33:06.830792Z 0 [Note] WSREP: discarding pending addr proto entry 0x2fb9540
2018-03-22T08:33:06.830819Z 0 [Note] WSREP: discarding pending addr without UUID: tcp://192.168.50.4:4567
2018-03-22T08:33:06.830824Z 0 [Note] WSREP: discarding pending addr proto entry 0x2fc1cf0
2018-03-22T08:33:06.830832Z 0 [Note] WSREP: discarding pending addr without UUID: tcp://192.168.50.5:4567
2018-03-22T08:33:06.830835Z 0 [Note] WSREP: discarding pending addr proto entry 0x2fca470
2018-03-22T08:33:06.830861Z 0 [Note] WSREP: gcomm: connected
2018-03-22T08:33:06.831117Z 0 [Note] WSREP: Shifting CLOSED -> OPEN (TO: 0)
2018-03-22T08:33:06.831185Z 0 [Note] WSREP: Waiting for SST/IST to complete.
2018-03-22T08:33:06.833031Z 0 [Note] WSREP: New COMPONENT: primary = yes, bootstrap = no, my_idx = 0, memb_num = 1
2018-03-22T08:33:06.833869Z 0 [Note] WSREP: Starting new group from scratch: a5283990-2dab-11e8-abe5-f600706598d2
2018-03-22T08:33:06.834299Z 0 [Note] WSREP: STATE_EXCHANGE: sent state UUID: a5284acc-2dab-11e8-b04d-a26cf382854e
2018-03-22T08:33:06.834388Z 0 [Note] WSREP: STATE EXCHANGE: sent state msg: a5284acc-2dab-11e8-b04d-a26cf382854e
2018-03-22T08:33:06.834402Z 0 [Note] WSREP: STATE EXCHANGE: got state msg: a5284acc-2dab-11e8-b04d-a26cf382854e from 0 (localhost.localdomain)
2018-03-22T08:33:06.834410Z 0 [Note] WSREP: Quorum results:
version = 4,
component = PRIMARY,
conf_id = 0,
members = 1/1 (primary/total),
act_id = 0,
last_appl. = -1,
protocols = 0/8/3 (gcs/repl/appl),
group UUID = a5283990-2dab-11e8-abe5-f600706598d2
2018-03-22T08:33:06.834416Z 0 [Note] WSREP: Flow-control interval: [100, 100]
2018-03-22T08:33:06.834418Z 0 [Note] WSREP: Trying to continue unpaused monitor
2018-03-22T08:33:06.834421Z 0 [Note] WSREP: Restored state OPEN -> JOINED (0)
2018-03-22T08:33:06.834437Z 0 [Note] WSREP: Member 0.0 (localhost.localdomain) synced with group.
2018-03-22T08:33:06.834441Z 0 [Note] WSREP: Shifting JOINED -> SYNCED (TO: 0)
2018-03-22T08:33:06.834665Z 2 [Note] WSREP: New cluster view: global state: a5283990-2dab-11e8-abe5-f600706598d2:0, view# 1: Primary, number of nodes: 1, my index: 0, protocol version 3
2018-03-22T08:33:06.834678Z 2 [Note] WSREP: Setting wsrep_ready to true
2018-03-22T08:33:06.834701Z 0 [Note] WSREP: SST complete, seqno: 0
2018-03-22T08:33:06.837697Z 0 [Warning] InnoDB: Using innodb_locks_unsafe_for_binlog is DEPRECATED. This option may be removed in future releases. Please use READ COMMITTED transaction isolation level instead; Please refer to http://dev.mysql.com/doc/refman/5.7/en/set-transaction.html
2018-03-22T08:33:06.837781Z 0 [Note] InnoDB: PUNCH HOLE support available
2018-03-22T08:33:06.837787Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-03-22T08:33:06.837790Z 0 [Note] InnoDB: Uses event mutexes
2018-03-22T08:33:06.837793Z 0 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
2018-03-22T08:33:06.837796Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-03-22T08:33:06.837798Z 0 [Note] InnoDB: Using Linux native AIO
2018-03-22T08:33:06.837952Z 0 [Note] InnoDB: Number of pools: 1
2018-03-22T08:33:06.838033Z 0 [Note] InnoDB: Using CPU crc32 instructions
2018-03-22T08:33:06.839425Z 0 [Note] InnoDB: Initializing buffer pool, total size = 100M, instances = 1, chunk size = 100M
2018-03-22T08:33:06.842260Z 0 [Note] InnoDB: Completed initialization of buffer pool
2018-03-22T08:33:06.844122Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2018-03-22T08:33:06.861920Z 0 [Note] InnoDB: Crash recovery did not find the parallel doublewrite buffer at /data/pxc/mysql3306/data/xb_doublewrite
2018-03-22T08:33:06.867175Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2018-03-22T08:33:06.896116Z 0 [Note] InnoDB: Created parallel doublewrite buffer at /data/pxc/mysql3306/data/xb_doublewrite, size 3932160 bytes
2018-03-22T08:33:06.946633Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2018-03-22T08:33:06.946702Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2018-03-22T08:33:06.991171Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2018-03-22T08:33:06.991944Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2018-03-22T08:33:06.991958Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2018-03-22T08:33:06.992189Z 0 [Note] InnoDB: Waiting for purge to start
2018-03-22T08:33:07.043774Z 0 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.7.21-rel20 started; log sequence number 2556457
2018-03-22T08:33:07.043946Z 0 [Note] Plugin 'FEDERATED' is disabled.
2018-03-22T08:33:07.046331Z 0 [Note] InnoDB: Loading buffer pool(s) from /data/pxc/mysql3306/data/ib_buffer_pool
2018-03-22T08:33:07.070494Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2018-03-22T08:33:07.070517Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2018-03-22T08:33:07.076544Z 0 [Warning] CA certificate ca.pem is self signed.
2018-03-22T08:33:07.076618Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2018-03-22T08:33:07.076731Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2018-03-22T08:33:07.076757Z 0 [Note] IPv6 is available.
2018-03-22T08:33:07.076765Z 0 [Note] - '::' resolves to '::';
2018-03-22T08:33:07.076778Z 0 [Note] Server socket created on IP: '::'.
2018-03-22T08:33:07.106190Z 0 [Note] InnoDB: Buffer pool(s) load completed at 180322 9:33:07
2018-03-22T08:33:07.148383Z 0 [Note] Event Scheduler: Loaded 0 events
2018-03-22T08:33:07.150249Z 0 [Note] /usr/local/mysql/bin/mysqld: ready for connections.
Version: '5.7.21-20-29.26-log' socket: '/tmp/mysql.sock' port: 3306 Percona XtraDB Cluster binary (GPL) 5.7.21-29.26, Revision 1702aea, wsrep_29.26
2018-03-22T08:33:07.151857Z 2 [Note] WSREP: Initialized wsrep sidno 2
2018-03-22T08:33:07.151890Z 2 [Note] WSREP: wsrep_notify_cmd is not defined, skipping notification.
2018-03-22T08:33:07.151912Z 2 [Note] WSREP: REPL Protocols: 8 (3, 2)
2018-03-22T08:33:07.151920Z 2 [Note] WSREP: Assign initial position for certification: 0, protocol version: 3
2018-03-22T08:33:07.151957Z 0 [Note] WSREP: Service thread queue flushed.
2018-03-22T08:33:07.152114Z 2 [Note] WSREP: GCache history reset: 00000000-0000-0000-0000-000000000000:0 -> a5283990-2dab-11e8-abe5-f600706598d2:0
2018-03-22T08:33:07.154210Z 2 [Note] WSREP: Synchronized with group, ready for connections
2018-03-22T08:33:07.154222Z 2 [Note] WSREP: Setting wsrep_ready to true
2018-03-22T08:33:07.154232Z 2 [Note] WSREP: wsrep_notify_cmd is not defined, skipping notification.
Node1啟動完成后汁果,我們登錄數(shù)據(jù)庫更改密碼新建SST賬號
alter user user() identified by '123456';
grant reload, lock tables, replication client, process on *.* to 'sst'@'localhost' identified by 'xuclxucl';
4.其他節(jié)點啟動
node2涡拘、node3不需要初始化,可以直接啟動
/usr/local/mysql/bin/mysqld --defaults-file=/data/pxc/my.cnf &
查看error.log
[root@localhost data]# cat error.log
2018-03-22T08:50:31.025706Z 0 [Warning] The syntax '--log_warnings/-W' is deprecated and will be removed in a future release. Please use '--log_error_verbosity' instead.
2018-03-22T08:50:31.025879Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-03-22T08:50:31.025949Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2018-03-22T08:50:31.025976Z 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.7.21-20-29.26-log) starting as process 7391 ...
2018-03-22T08:50:31.028667Z 0 [Note] WSREP: Setting wsrep_ready to false
2018-03-22T08:50:31.028679Z 0 [Note] WSREP: No pre-stored wsrep-start position found. Skipping position initialization.
2018-03-22T08:50:31.028682Z 0 [Note] WSREP: wsrep_load(): loading provider library '/usr/local/mysql/lib/libgalera_smm.so'
2018-03-22T08:50:31.031904Z 0 [Note] WSREP: wsrep_load(): Galera 3.26(r) by Codership Oy <info@codership.com> loaded successfully.
2018-03-22T08:50:31.032279Z 0 [Note] WSREP: CRC-32C: using hardware acceleration.
2018-03-22T08:50:31.032549Z 0 [Warning] WSREP: Could not open state file for reading: '/data/pxc/mysql3306/data//grastate.dat'
2018-03-22T08:50:31.032586Z 0 [Warning] WSREP: No persistent state found. Bootstraping with default state
2018-03-22T08:50:31.032649Z 0 [Note] WSREP: Found saved state: 00000000-0000-0000-0000-000000000000:-1, safe_to_bootstrap: 1
2018-03-22T08:50:31.043831Z 0 [Note] WSREP: Passing config to GCS: base_dir = /data/pxc/mysql3306/data/; base_host = 192.168.50.4; base_port = 4567; cert.log_conflicts = no; debug = no; evs.auto_evict = 0; evs.delay_margin = PT1S; evs.delayed_keep_period = PT30S; evs.inactive_check_period = PT0.5S; evs.inactive_timeout = PT15S; evs.join_retrans_period = PT1S; evs.max_install_timeouts = 3; evs.send_window = 10; evs.stats_report_period = PT1M; evs.suspect_timeout = PT5S; evs.user_send_window = 4; evs.view_forget_timeout = PT24H; gcache.dir = /data/pxc/mysql3306/data/; gcache.freeze_purge_at_seqno = -1; gcache.keep_pages_count = 0; gcache.keep_pages_size = 0; gcache.mem_size = 0; gcache.name = /data/pxc/mysql3306/data//galera.cache; gcache.page_size = 128M; gcache.recover = no; gcache.size = 128M; gcomm.thread_prio = ; gcs.fc_debug = 0; gcs.fc_factor = 1; gcs.fc_limit = 100; gcs.fc_master_slave = no; gcs.max_packet_size = 64500; gcs.max_throttle = 0.25; gcs.recv_q_hard_limit = 9223372036854775807; gcs.recv_q_soft_limit = 0.25; gcs.sync_donor = no; gmcast.segment = 0; gmcast.version = 0; pc.announce_timeout = PT3S; pc.checksum = false; pc.ignore_quorum = false; pc.ignore_sb = false; pc.npvo = false; pc.recovery = 1; pc.version = 0; pc.wait_prim = true; pc.wait_prim_timeout = PT30S; pc.weight = 1; protonet.backend = asio; protonet.version = 0; repl.causal_read_timeout = PT30S; repl.commit_order = 3; repl.key_format = FLAT8; repl.max_ws_size = 2147483647; repl.proto_max = 8; socket.checksum = 2; socket.recv_buf_size = 212992;
2018-03-22T08:50:31.056944Z 0 [Note] WSREP: GCache history reset: 00000000-0000-0000-0000-000000000000:0 -> 00000000-0000-0000-0000-000000000000:-1
2018-03-22T08:50:31.058840Z 0 [Note] WSREP: Assign initial position for certification: -1, protocol version: -1
2018-03-22T08:50:31.058868Z 0 [Note] WSREP: Preparing to initiate SST/IST
2018-03-22T08:50:31.058871Z 0 [Note] WSREP: Starting replication
2018-03-22T08:50:31.058882Z 0 [Note] WSREP: Setting initial position to 00000000-0000-0000-0000-000000000000:-1
2018-03-22T08:50:31.059050Z 0 [Note] WSREP: Using CRC-32C for message checksums.
2018-03-22T08:50:31.059114Z 0 [Note] WSREP: gcomm thread scheduling priority set to other:0
2018-03-22T08:50:31.059200Z 0 [Warning] WSREP: Fail to access the file (/data/pxc/mysql3306/data//gvwstate.dat) error (No such file or directory). It is possible if node is booting for first time or re-booting after a graceful shutdown
2018-03-22T08:50:31.059205Z 0 [Note] WSREP: Restoring primary-component from disk failed. Either node is booting for first time or re-booting after a graceful shutdown
2018-03-22T08:50:31.059519Z 0 [Note] WSREP: GMCast version 0
2018-03-22T08:50:31.059519Z 0 [Note] WSREP: (13906f3a, 'tcp://0.0.0.0:4567') listening at tcp://0.0.0.0:4567
2018-03-22T08:50:31.059519Z 0 [Note] WSREP: (13906f3a, 'tcp://0.0.0.0:4567') multicast: , ttl: 1
2018-03-22T08:50:31.059558Z 0 [Note] WSREP: EVS version 0
2018-03-22T08:50:31.059640Z 0 [Note] WSREP: gcomm: connecting to group 'pxc_wubx', peer '192.168.50.3:,192.168.50.4:,192.168.50.5:'
2018-03-22T08:50:31.061708Z 0 [Note] WSREP: (13906f3a, 'tcp://0.0.0.0:4567') connection established to 13906f3a tcp://192.168.50.4:4567
2018-03-22T08:50:31.061734Z 0 [Warning] WSREP: (13906f3a, 'tcp://0.0.0.0:4567') address 'tcp://192.168.50.4:4567' points to own listening address, blacklisting
2018-03-22T08:50:31.062344Z 0 [Note] WSREP: (13906f3a, 'tcp://0.0.0.0:4567') connection established to a5272275 tcp://192.168.50.3:4567
2018-03-22T08:50:31.062536Z 0 [Note] WSREP: (13906f3a, 'tcp://0.0.0.0:4567') turning message relay requesting on, nonlive peers:
2018-03-22T08:50:31.324478Z 0 [Note] WSREP: declaring a5272275 at tcp://192.168.50.3:4567 stable
2018-03-22T08:50:31.325151Z 0 [Note] WSREP: Node a5272275 state primary
2018-03-22T08:50:31.325520Z 0 [Note] WSREP: Current view of cluster as seen by this node
view (view_id(PRIM,13906f3a,4)
memb {
13906f3a,0
a5272275,0
}
joined {
}
left {
}
partitioned {
}
)
2018-03-22T08:50:31.325537Z 0 [Note] WSREP: Save the discovered primary-component to disk
2018-03-22T08:50:31.325775Z 0 [Note] WSREP: discarding pending addr without UUID: tcp://192.168.50.5:4567
2018-03-22T08:50:31.562109Z 0 [Note] WSREP: gcomm: connected
2018-03-22T08:50:31.562177Z 0 [Note] WSREP: Shifting CLOSED -> OPEN (TO: 0)
2018-03-22T08:50:31.562231Z 0 [Note] WSREP: Waiting for SST/IST to complete.
2018-03-22T08:50:31.562398Z 0 [Note] WSREP: New COMPONENT: primary = yes, bootstrap = no, my_idx = 0, memb_num = 2
2018-03-22T08:50:31.562767Z 0 [Note] WSREP: STATE_EXCHANGE: sent state UUID: 13dd3684-2dae-11e8-b51f-320ac4fc3dca
2018-03-22T08:50:31.563236Z 0 [Note] WSREP: STATE EXCHANGE: sent state msg: 13dd3684-2dae-11e8-b51f-320ac4fc3dca
2018-03-22T08:50:31.563752Z 0 [Note] WSREP: STATE EXCHANGE: got state msg: 13dd3684-2dae-11e8-b51f-320ac4fc3dca from 0 (localhost.localdomain)
2018-03-22T08:50:31.564081Z 0 [Note] WSREP: STATE EXCHANGE: got state msg: 13dd3684-2dae-11e8-b51f-320ac4fc3dca from 1 (localhost.localdomain)
2018-03-22T08:50:31.564099Z 0 [Note] WSREP: Quorum results:
version = 4,
component = PRIMARY,
conf_id = 3,
members = 1/2 (primary/total),
act_id = 4,
last_appl. = -1,
protocols = 0/8/3 (gcs/repl/appl),
group UUID = a5283990-2dab-11e8-abe5-f600706598d2
2018-03-22T08:50:31.564104Z 0 [Note] WSREP: Flow-control interval: [141, 141]
2018-03-22T08:50:31.564107Z 0 [Note] WSREP: Trying to continue unpaused monitor
2018-03-22T08:50:31.564109Z 0 [Note] WSREP: Shifting OPEN -> PRIMARY (TO: 4)
2018-03-22T08:50:31.564163Z 2 [Note] WSREP: State transfer required:
Group state: a5283990-2dab-11e8-abe5-f600706598d2:4
Local state: 00000000-0000-0000-0000-000000000000:-1
2018-03-22T08:50:31.564174Z 2 [Note] WSREP: New cluster view: global state: a5283990-2dab-11e8-abe5-f600706598d2:4, view# 4: Primary, number of nodes: 2, my index: 0, protocol version 3
2018-03-22T08:50:31.564176Z 2 [Note] WSREP: Setting wsrep_ready to true
2018-03-22T08:50:31.564180Z 2 [Warning] WSREP: Gap in state sequence. Need state transfer.
2018-03-22T08:50:31.564182Z 2 [Note] WSREP: Setting wsrep_ready to false
2018-03-22T08:50:31.564248Z 0 [Note] WSREP: Initiating SST/IST transfer on JOINER side (wsrep_sst_xtrabackup-v2 --role 'joiner' --address '192.168.50.4' --datadir '/data/pxc/mysql3306/data/' --defaults-file '/data/pxc/my.cnf' --defaults-group-suffix '' --parent '7391' '' )
2018-03-22T08:50:32.141960Z 2 [Note] WSREP: Prepared SST/IST request: xtrabackup-v2|192.168.50.4:4444/xtrabackup_sst//1
2018-03-22T08:50:32.141982Z 2 [Note] WSREP: wsrep_notify_cmd is not defined, skipping notification.
2018-03-22T08:50:32.142000Z 2 [Note] WSREP: REPL Protocols: 8 (3, 2)
2018-03-22T08:50:32.142014Z 2 [Note] WSREP: Assign initial position for certification: 4, protocol version: 3
2018-03-22T08:50:32.142036Z 0 [Note] WSREP: Service thread queue flushed.
2018-03-22T08:50:32.142051Z 2 [Note] WSREP: Check if state gap can be serviced using IST
2018-03-22T08:50:32.142061Z 2 [Note] WSREP: Local UUID: 00000000-0000-0000-0000-000000000000 != Group UUID: a5283990-2dab-11e8-abe5-f600706598d2
2018-03-22T08:50:32.142096Z 2 [Note] WSREP: State gap can't be serviced using IST. Switching to SST
2018-03-22T08:50:32.142146Z 2 [Note] WSREP: Failed to prepare for incremental state transfer: Local state UUID (00000000-0000-0000-0000-000000000000) does not match group state UUID (a5283990-2dab-11e8-abe5-f600706598d2): 1 (Operation not permitted)
at galera/src/replicator_str.cpp:prepare_for_IST():538. IST will be unavailable.
2018-03-22T08:50:32.146597Z 0 [Note] WSREP: Member 0.0 (localhost.localdomain) requested state transfer from '*any*'. Selected 1.0 (localhost.localdomain)(SYNCED) as donor.
2018-03-22T08:50:32.146641Z 0 [Note] WSREP: Shifting PRIMARY -> JOINER (TO: 4)
2018-03-22T08:50:32.146756Z 2 [Note] WSREP: Requesting state transfer: success, donor: 1
2018-03-22T08:50:32.146778Z 2 [Note] WSREP: GCache history reset: 00000000-0000-0000-0000-000000000000:0 -> a5283990-2dab-11e8-abe5-f600706598d2:4
2018-03-22T08:50:32.858690Z WSREP_SST: [INFO] WARNING: Stale temporary SST directory: /data/pxc/mysql3306/data//.sst from previous state transfer. Removing
2018-03-22T08:50:32.861937Z WSREP_SST: [INFO] Proceeding with SST.........
2018-03-22T08:50:32.886694Z WSREP_SST: [INFO] ............Waiting for SST streaming to complete!
2018-03-22T08:50:34.068994Z 0 [Note] WSREP: (13906f3a, 'tcp://0.0.0.0:4567') turning message relay requesting off
2018-03-22T08:50:45.608868Z 0 [Note] WSREP: 1.0 (localhost.localdomain): State transfer to 0.0 (localhost.localdomain) complete.
2018-03-22T08:50:45.612112Z 0 [Note] WSREP: Member 1.0 (localhost.localdomain) synced with group.
2018-03-22T08:50:45.613446Z WSREP_SST: [INFO] Preparing the backup at /data/pxc/mysql3306/data//.sst
節(jié)點3同節(jié)點2
5.查看各節(jié)點狀態(tài)
mysql> show global status like '%wsrep%';
+----------------------------------+--------------------------------------+
| Variable_name | Value |
+----------------------------------+--------------------------------------+
| wsrep_local_state_uuid | a5283990-2dab-11e8-abe5-f600706598d2 |
| wsrep_protocol_version | 8 |
| wsrep_last_applied | 4 |
| wsrep_last_committed | 4 |
| wsrep_replicated | 4 |
| wsrep_replicated_bytes | 952 |
| wsrep_repl_keys | 4 |
| wsrep_repl_keys_bytes | 128 |
| wsrep_repl_data_bytes | 553 |
| wsrep_repl_other_bytes | 0 |
| wsrep_received | 11 |
| wsrep_received_bytes | 934 |
| wsrep_local_commits | 0 |
| wsrep_local_cert_failures | 0 |
| wsrep_local_replays | 0 |
| wsrep_local_send_queue | 0 |
| wsrep_local_send_queue_max | 1 |
| wsrep_local_send_queue_min | 0 |
| wsrep_local_send_queue_avg | 0.000000 |
| wsrep_local_recv_queue | 0 |
| wsrep_local_recv_queue_max | 3 |
| wsrep_local_recv_queue_min | 0 |
| wsrep_local_recv_queue_avg | 0.363636 |
| wsrep_local_cached_downto | 1 |
| wsrep_flow_control_paused_ns | 0 |
| wsrep_flow_control_paused | 0.000000 |
| wsrep_flow_control_sent | 0 |
| wsrep_flow_control_recv | 0 |
| wsrep_flow_control_interval | [ 141, 141 ] |
| wsrep_flow_control_interval_low | 141 |
| wsrep_flow_control_interval_high | 141 |
| wsrep_flow_control_status | OFF |
| wsrep_cert_deps_distance | 1.000000 |
| wsrep_apply_oooe | 0.000000 |
| wsrep_apply_oool | 0.000000 |
| wsrep_apply_window | 1.000000 |
| wsrep_commit_oooe | 0.000000 |
| wsrep_commit_oool | 0.000000 |
| wsrep_commit_window | 1.000000 |
| wsrep_local_state | 4 |
| wsrep_local_state_comment | Synced |
| wsrep_cert_index_size | 1 |
| wsrep_cert_bucket_count | 22 |
| wsrep_gcache_pool_size | 2704 |
| wsrep_causal_reads | 0 |
| wsrep_cert_interval | 0.000000 |
| wsrep_ist_receive_status | |
| wsrep_ist_receive_seqno_start | 0 |
| wsrep_ist_receive_seqno_current | 0 |
| wsrep_ist_receive_seqno_end | 0 |
| wsrep_incoming_addresses | 192.168.50.4:3306,192.168.50.3:3306 |
| wsrep_desync_count | 0 |
| wsrep_evs_delayed | |
| wsrep_evs_evict_list | |
| wsrep_evs_repl_latency | 0/0/0/0/0 |
| wsrep_evs_state | OPERATIONAL |
| wsrep_gcomm_uuid | a5272275-2dab-11e8-9ba0-4b7e19a09c41 |
| wsrep_cluster_conf_id | 4 |
| wsrep_cluster_size | 2 |
| wsrep_cluster_state_uuid | a5283990-2dab-11e8-abe5-f600706598d2 |
| wsrep_cluster_status | Primary |
| wsrep_connected | ON |
| wsrep_local_bf_aborts | 0 |
| wsrep_local_index | 1 |
| wsrep_provider_name | Galera |
| wsrep_provider_vendor | Codership Oy <info@codership.com> |
| wsrep_provider_version | 3.26(r) |
| wsrep_ready | ON |
+----------------------------------+--------------------------------------+
68 rows in set (0.00 sec)
看到
wsrep_local_state=4
wsrep_local_state_comment = Synced
wsrep_cluster_status = Primary
wsrep_connected = ON
至此据德,PXC集群搭建完成鳄乏,下篇會給大家?guī)鞵XC原理及日常運維相關(guān)操作。