热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

MySQL集群PerconaXtraDBCluster安装搭建步骤详解

nsitionalENhttp:www.w3.orgTRxhtml1DTDxhtml1-transitional.dtd

最近公司某客户要求我们的数据库搭建PXC集群以保证他们的系统高性能和搞稳定性,以后花费了一些时间去搭建和测试,也踩过一些坑,准备分享出来

系统:CentOS6.6
Percona XtraDB Cluster:5.6.26

建议关闭iptables, 4个端口 3306,4444,4567,4568
Percona XtraDB Cluster环境所涉及的端口:

#MySQL实例端口
1. Regular MySQL port, default 3306.

#Percona XtraDB Cluster相互通讯的端口
2. Port for group communication, default 4567. It can be changed by the option:
wsrep_provider_optiOns="gmcast.listen_addr=tcp://0.0.0.0:4010; "

#用于SST传送的端口
3. Port for State Transfer, default 4444. It can be changed by the option:
wsrep_sst_receive_address=10.11.12.205:5555

#用于IST传送的端口
4. Port for Incremental State Transfer, default port for group communication + 1 (4568). It can be changed by the option:
wsrep_provider_optiOns= "ist.recv_addr=10.11.12.206:7777; "

node1 192.168.3.130
node2 192.168.3.129
node3 192.168.3.128

1.安装软件依赖包(添加repl源,再安装依赖,3台server操作一样。)

rpm -ivh http://dl.Fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum install perl-IO-Socket-SSL perl-DBD-MySQL perl-Time-HiRes socat nc -y

2.安装xtrabackup(PXC同步数据需要用到)

yum install -y http://www.percona.com/downloads/percona-release/RedHat/0.1-3/percona-release-0.1-3.noarch.rpm
yum install -y percona-xtrabackup-24

3.下载安装Percona-XtraDB-Cluster

#安装开发包

yum install -y libaio*
yum groupinstall -y 'Development tools'
yum install -y libssl.so.6
ln -sf /usr/lib64/libssl.so.10 /usr/lib64/libssl.so.6
ln -sf /usr/lib64/libcrypto.so.10 /usr/lib64/libcrypto.so.6


wget https://www.percona.com/downloads/Percona-XtraDB-Cluster-56/Percona-XtraDB-Cluster-5.6.26-25.12/binary/tarball/Percona-XtraDB-Cluster-5.6.26-rel74.0-25.12.1.Linux.x86_64.tar.gz
tar zxvf Percona-XtraDB-Cluster-5.6.26-rel74.0-25.12.1.Linux.x86_64.tar.gz
useradd -M -s /sbin/nologin mysql
mkdir -p /usr/local/pxc
mkdir -p /data/pxc/mysql3306/{data,tmp,logs}
mv /data/download/Percona-XtraDB-Cluster-5.6.26-rel74.0-25.12.1.Linux.x86_64/* /usr/local/pxc/
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
source /etc/profile
chown -R mysql:mysql /data/pxc/mysql3306/
chown -R mysql:mysql /usr/local/pxc 

修改my.cnf配置文件,注意在[mysqld]段落添加PXC的参数:
vi /etc/my.cnf

 130

 
[client]
port            = 3306
socket            = /data/mysql/mysql3306/tmp/mysql.sock   
  

# The MySQL server
[mysqld]
#########Basic##################
explicit_defaults_for_timestamp=true

port            = 3306  
user        = mysql   
basedir         = /usr/local/mysql  
datadir         = /data/mysql/mysql3306/data   
tmpdir          = /data/mysql/mysql3306/tmp   
pid-file        = /data/mysql/mysql3306/tmp/mysql.pid    
socket            = /data/mysql/mysql3306/tmp/mysql.sock   
#skip-grant-tables  

#character set
character_set_server = utf8


open_files_limit = 65535
back_log = 500
#event_scheduler = ON
#lower_case_table_names=1
skip-external-locking
skip_name_resolve = 1
default-storage-engine = InnoDB


#timeout
wait_timeout=1000
interactive_timeout=1000
connect_timeout = 20


server-id       =1303306  #ip最后一位+端口号= 1003376


#percona 的--recursion-method slavehost模式
#report_host = 10.105.9.115
#report_port = 3306



#plugin
plugin-load="semisync_master.so;semisync_slave.so"


#########error log#############
log-error = /data/mysql/mysql3306/logs/error.log  
log-warnings = 2  

#########general log#############
#general_log=1
#general_log_file=/data/mysql/mysql3306/logs/mysql.log 

#########slow log#############
slow_query_log = 1
long_query_time=1
slow_query_log_file = /data/mysql/mysql3306/logs/mysql.slow   


############# for replication###################

log-bin     = /data/mysql/mysql3306/logs/mysql-bin   
binlog_format = row
max_binlog_size = 500M
binlog_cache_size = 2M
max_binlog_cache_size = 2M
expire-logs-days = 7
slave-net-timeout=30


log_bin_trust_function_creators = 1
log-slave-updates = 1   
skip-slave-start = 1
#read_only =1    #从上设置,5.7是super_read_only

#GTID
gtid-mode = on
binlog_gtid_simple_recovery=1
enforce_gtid_consistency=1

#relay log
relay-log = /data/mysql/mysql3306/logs/mysql-relay  
relay-log-index=/data/mysql/mysql3306/logs/relay-bin.index
max-relay-log-size = 500M


#replication crash safe
sync_master_info = 1
sync_relay_log_info = 1
sync_relay_log = 1
relay_log_recovery = 1
master_info_repository = TABLE
relay_log_info_repository = TABLE

#semisync   动态开启 主从切换的时候用
#rpl_semi_sync_master_enabled = 1
#rpl_semi_sync_master_wait_no_slave = 1
#rpl_semi_sync_master_timeout = 1000
#rpl_semi_sync_slave_enabled = 1
#rpl_semi_sync_master_timeout = 100000000 #不要超时,防止切异步,保证主从数据的完全一致性,默认是10000
#rpl_semi_sync_master_wait_point = 'after_sync' #5.7新增参数 after_sync 5.7增强半同步 after_commit5.6普通半同步
#rpl_semi_sync_master_wait_for_slave_count = 2  #5.7新增参数 等待多少个从库接收到binlog


#ignore
#replicate-ignore-db = 'school','school2'
#replicate-do-db = 'school','school2'

#Multi-threaded Slave
#slave_parallel_workers=16
#slave-parallel-type=LOGICAL_CLOCK
#slave-parallel-type=DATABASE

#replication error
#slave-skip-errors=1007,1051,1062

#######per_thread_buffers#####################
max_connections=1100
max_user_connections=1000
max_connect_errors=1000
#myisam_recover
key_buffer_size = 64M
max_allowed_packet = 16M
#table_cache = 3096
table_open_cache = 6144
table_definition_cache = 4096


read_buffer_size = 1M
join_buffer_size = 128K
read_rnd_buffer_size = 1M

#myisam
sort_buffer_size = 128K
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1


myisam_sort_buffer_size = 32M
tmp_table_size = 32M
max_heap_table_size = 64M
query_cache_type=0
query_cache_size = 0
bulk_insert_buffer_size = 32M

thread_cache_size = 64
#thread_concurrency = 32
thread_stack = 192K


###############InnoDB###########################
innodb_data_home_dir = /data/mysql/mysql3306/data      
innodb_log_group_home_dir = /data/mysql/mysql3306/logs    
innodb_data_file_path = ibdata1:1000M:autoextend

innodb_buffer_pool_size = 1G  #根据内存大小设置

innodb_buffer_pool_instances    = 8
#innodb_additional_mem_pool_size = 16M
innodb_log_file_size = 500M
innodb_log_buffer_size = 16M
innodb_log_files_in_group = 3
innodb_flush_log_at_trx_commit = 1
sync_binlog = 1
innodb_lock_wait_timeout = 10
innodb_sync_spin_loops = 40
innodb_max_dirty_pages_pct = 80
innodb_support_xa = 1
innodb_thread_concurrency = 0
innodb_thread_sleep_delay = 500
innodb_concurrency_tickets = 1000
innodb_flush_method = O_DIRECT
innodb_file_per_table = 1
innodb_read_io_threads = 16
innodb_write_io_threads = 16
innodb_io_capacity = 800  #机械盘800 ssd 2000
innodb_flush_neighbors = 1
innodb_file_format = Barracuda
innodb_purge_threads=1   #5.6只能有一个,5.7可以设置多个
innodb_purge_batch_size = 32
innodb_old_blocks_pct=75
innodb_change_buffering=all
innodb_stats_on_metadata=OFF
innodb_print_all_deadlocks = 1
#innodb_status_output=1
#innodb_status_output_locks=1
performance_schema=0   #是否打开P_S库进行性能收集
transaction_isolation = READ-COMMITTED
#innodb_force_recovery=0
#innodb_fast_shutdown=1
#innodb_status_file = 1  #实时输出show engine innodb status到innodb_status文件

############# PXC #####################                                                 
innodb_autoinc_lock_mode=2                                                       
wsrep_cluster_name=pxc-dongzheng                                                 
wsrep_provider=/usr/local/mysql/lib/libgalera_smm.so                             
wsrep_cluster_address=gcomm://192.168.3.130,192.168.3.128,192.168.3.129          
wsrep_node_address=192.168.3.130                                                 
wsrep_slave_threads=2                                                            
wsrep_sst_auth=sst:dongzheng                                                     
wsrep_sst_method=xtrabackup-v2                                                   
wsrep_provider_options="debug=1"



[mysqldump]
quick
max_allowed_packet = 128M


[mysql]
no-auto-rehash
max_allowed_packet = 128M
prompt                         = '(product)\u@\h:\p [\d]> '
default_character_set          = utf8


[myisamchk]
key_buffer_size = 64M
sort_buffer_size = 512k
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout

[mysqld_safe]
#malloc-lib= /usr/local/mysql/lib/mysql/libjemalloc.so
 

129

[client]
port            = 3306
socket            = /data/mysql/mysql3306/tmp/mysql.sock   
  

# The MySQL server
[mysqld]
#########Basic##################
explicit_defaults_for_timestamp=true

port            = 3306  
user           = mysql   
basedir         = /usr/local/mysql  
datadir         = /data/mysql/mysql3306/data   
tmpdir          = /data/mysql/mysql3306/tmp   
pid-file        = /data/mysql/mysql3306/tmp/mysql.pid    
socket            = /data/mysql/mysql3306/tmp/mysql.sock   
#skip-grant-tables  

#character set
character_set_server = utf8


open_files_limit = 65535
back_log = 500
#event_scheduler = ON
#lower_case_table_names=1
skip-external-locking
skip_name_resolve = 1
default-storage-engine = InnoDB


#timeout
wait_timeout=1000
interactive_timeout=1000
connect_timeout = 20


server-id       =1293306  #ip最后一位+端口号= 1003376


#percona 的--recursion-method slavehost模式
#report_host = 10.105.9.115
#report_port = 3306



#plugin
plugin-load="semisync_master.so;semisync_slave.so"


#########error log#############
log-error = /data/mysql/mysql3306/logs/error.log  
log-warnings = 2  

#########general log#############
#general_log=1
#general_log_file=/data/mysql/mysql3306/logs/mysql.log 

#########slow log#############
slow_query_log = 1
long_query_time=1
slow_query_log_file = /data/mysql/mysql3306/logs/mysql.slow   


############# for replication###################

log-bin     = /data/mysql/mysql3306/logs/mysql-bin   
binlog_format = row
max_binlog_size = 500M
binlog_cache_size = 2M
max_binlog_cache_size = 2M
expire-logs-days = 7
slave-net-timeout=30


log_bin_trust_function_creators = 1
log-slave-updates = 1   
skip-slave-start = 1
#read_only =1    #从上设置,5.7是super_read_only

#GTID
gtid-mode = on
binlog_gtid_simple_recovery=1
enforce_gtid_consistency=1

#relay log
relay-log = /data/mysql/mysql3306/logs/mysql-relay  
relay-log-index=/data/mysql/mysql3306/logs/relay-bin.index
max-relay-log-size = 500M


#replication crash safe
sync_master_info = 1
sync_relay_log_info = 1
sync_relay_log = 1
relay_log_recovery = 1
master_info_repository = TABLE
relay_log_info_repository = TABLE

#semisync   动态开启 主从切换的时候用
#rpl_semi_sync_master_enabled = 1
#rpl_semi_sync_master_wait_no_slave = 1
#rpl_semi_sync_master_timeout = 1000
#rpl_semi_sync_slave_enabled = 1
#rpl_semi_sync_master_timeout = 100000000 #不要超时,防止切异步,保证主从数据的完全一致性,默认是10000
#rpl_semi_sync_master_wait_point = 'after_sync' #5.7新增参数 after_sync 5.7增强半同步 after_commit5.6普通半同步
#rpl_semi_sync_master_wait_for_slave_count = 2  #5.7新增参数 等待多少个从库接收到binlog


#ignore
#replicate-ignore-db = 'school','school2'
#replicate-do-db = 'school','school2'

#Multi-threaded Slave
#slave_parallel_workers=16
#slave-parallel-type=LOGICAL_CLOCK
#slave-parallel-type=DATABASE

#replication error
#slave-skip-errors=1007,1051,1062

#######per_thread_buffers#####################
max_connections=1100
max_user_connections=1000
max_connect_errors=1000
#myisam_recover
key_buffer_size = 64M
max_allowed_packet = 16M
#table_cache = 3096
table_open_cache = 6144
table_definition_cache = 4096


read_buffer_size = 1M
join_buffer_size = 128K
read_rnd_buffer_size = 1M

#myisam
sort_buffer_size = 128K
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1


myisam_sort_buffer_size = 32M
tmp_table_size = 32M
max_heap_table_size = 64M
query_cache_type=0
query_cache_size = 0
bulk_insert_buffer_size = 32M

thread_cache_size = 64
#thread_concurrency = 32
thread_stack = 192K


###############InnoDB###########################
innodb_data_home_dir = /data/mysql/mysql3306/data      
innodb_log_group_home_dir = /data/mysql/mysql3306/logs    
innodb_data_file_path = ibdata1:1000M:autoextend

innodb_buffer_pool_size = 1G  #根据内存大小设置

innodb_buffer_pool_instances    = 8
#innodb_additional_mem_pool_size = 16M
innodb_log_file_size = 500M
innodb_log_buffer_size = 16M
innodb_log_files_in_group = 3
innodb_flush_log_at_trx_commit = 1
sync_binlog = 1
innodb_lock_wait_timeout = 10
innodb_sync_spin_loops = 40
innodb_max_dirty_pages_pct = 80
innodb_support_xa = 1
innodb_thread_concurrency = 0
innodb_thread_sleep_delay = 500
innodb_concurrency_tickets = 1000
innodb_flush_method = O_DIRECT
innodb_file_per_table = 1
innodb_read_io_threads = 16
innodb_write_io_threads = 16
innodb_io_capacity = 800  #机械盘800 ssd 2000
innodb_flush_neighbors = 1
innodb_file_format = Barracuda
innodb_purge_threads=1   #5.6只能有一个,5.7可以设置多个
innodb_purge_batch_size = 32
innodb_old_blocks_pct=75
innodb_change_buffering=all
innodb_stats_on_metadata=OFF
innodb_print_all_deadlocks = 1
#innodb_status_output=1
#innodb_status_output_locks=1
performance_schema=0   #是否打开P_S库进行性能收集
transaction_isolation = READ-COMMITTED
#innodb_force_recovery=0
#innodb_fast_shutdown=1
#innodb_status_file = 1  #实时输出show engine innodb status到innodb_status文件

############# PXC #####################                                                 
innodb_autoinc_lock_mode=2                                                      
wsrep_cluster_name=pxc-dongzheng                                                
wsrep_provider=/usr/local/mysql/lib/libgalera_smm.so                            
wsrep_cluster_address=gcomm://192.168.3.130,192.168.3.128,192.168.3.129         
wsrep_node_address=192.168.3.129                                                
wsrep_slave_threads=2                                                           
wsrep_sst_auth=sst:dongzheng                                                    
wsrep_sst_method=xtrabackup-v2                                                  



[mysqldump]
quick
max_allowed_packet = 128M


[mysql]
no-auto-rehash
max_allowed_packet = 128M
prompt                         = '(product)\u@\h:\p [\d]> '
default_character_set          = utf8


[myisamchk]
key_buffer_size = 64M
sort_buffer_size = 512k
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout

[mysqld_safe]
#malloc-lib= /usr/local/mysql/lib/mysql/libjemalloc.so
View Code

128

[client]
port            = 3306
socket            = /data/mysql/mysql3306/tmp/mysql.sock   
  

# The MySQL server
[mysqld]
#########Basic##################
explicit_defaults_for_timestamp=true

port            = 3306  
user           = mysql   
basedir         = /usr/local/mysql  
datadir         = /data/mysql/mysql3306/data   
tmpdir          = /data/mysql/mysql3306/tmp   
pid-file        = /data/mysql/mysql3306/tmp/mysql.pid    
socket            = /data/mysql/mysql3306/tmp/mysql.sock   
#skip-grant-tables  

#character set
character_set_server = utf8


open_files_limit = 65535
back_log = 500
#event_scheduler = ON
#lower_case_table_names=1
skip-external-locking
skip_name_resolve = 1
default-storage-engine = InnoDB


#timeout
wait_timeout=1000
interactive_timeout=1000
connect_timeout = 20


server-id       =1283306  #ip最后一位+端口号= 1003376


#percona 的--recursion-method slavehost模式
#report_host = 10.105.9.115
#report_port = 3306



#plugin
plugin-load="semisync_master.so;semisync_slave.so"


#########error log#############
log-error = /data/mysql/mysql3306/logs/error.log  
log-warnings = 2  

#########general log#############
#general_log=1
#general_log_file=/data/mysql/mysql3306/logs/mysql.log 

#########slow log#############
slow_query_log = 1
long_query_time=1
slow_query_log_file = /data/mysql/mysql3306/logs/mysql.slow   


############# for replication###################

log-bin     = /data/mysql/mysql3306/logs/mysql-bin   
binlog_format = row
max_binlog_size = 500M
binlog_cache_size = 2M
max_binlog_cache_size = 2M
expire-logs-days = 7
slave-net-timeout=30


log_bin_trust_function_creators = 1
log-slave-updates = 1   
skip-slave-start = 1
#read_only =1    #从上设置,5.7是super_read_only

#GTID
gtid-mode = on
binlog_gtid_simple_recovery=1
enforce_gtid_consistency=1

#relay log
relay-log = /data/mysql/mysql3306/logs/mysql-relay  
relay-log-index=/data/mysql/mysql3306/logs/relay-bin.index
max-relay-log-size = 500M


#replication crash safe
sync_master_info = 1
sync_relay_log_info = 1
sync_relay_log = 1
relay_log_recovery = 1
master_info_repository = TABLE
relay_log_info_repository = TABLE

#semisync   动态开启 主从切换的时候用
#rpl_semi_sync_master_enabled = 1
#rpl_semi_sync_master_wait_no_slave = 1
#rpl_semi_sync_master_timeout = 1000
#rpl_semi_sync_slave_enabled = 1
#rpl_semi_sync_master_timeout = 100000000 #不要超时,防止切异步,保证主从数据的完全一致性,默认是10000
#rpl_semi_sync_master_wait_point = 'after_sync' #5.7新增参数 after_sync 5.7增强半同步 after_commit5.6普通半同步
#rpl_semi_sync_master_wait_for_slave_count = 2  #5.7新增参数 等待多少个从库接收到binlog


#ignore
#replicate-ignore-db = 'school','school2'
#replicate-do-db = 'school','school2'

#Multi-threaded Slave
#slave_parallel_workers=16
#slave-parallel-type=LOGICAL_CLOCK
#slave-parallel-type=DATABASE

#replication error
#slave-skip-errors=1007,1051,1062

#######per_thread_buffers#####################
max_connections=1100
max_user_connections=1000
max_connect_errors=1000
#myisam_recover
key_buffer_size = 64M
max_allowed_packet = 16M
#table_cache = 3096
table_open_cache = 6144
table_definition_cache = 4096


read_buffer_size = 1M
join_buffer_size = 128K
read_rnd_buffer_size = 1M

#myisam
sort_buffer_size = 128K
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1


myisam_sort_buffer_size = 32M
tmp_table_size = 32M
max_heap_table_size = 64M
query_cache_type=0
query_cache_size = 0
bulk_insert_buffer_size = 32M

thread_cache_size = 64
#thread_concurrency = 32
thread_stack = 192K


###############InnoDB###########################
innodb_data_home_dir = /data/mysql/mysql3306/data      
innodb_log_group_home_dir = /data/mysql/mysql3306/logs    
innodb_data_file_path = ibdata1:1000M:autoextend

innodb_buffer_pool_size = 1G  #根据内存大小设置

innodb_buffer_pool_instances    = 8
#innodb_additional_mem_pool_size = 16M
innodb_log_file_size = 500M
innodb_log_buffer_size = 16M
innodb_log_files_in_group = 3
innodb_flush_log_at_trx_commit = 1
sync_binlog = 1
innodb_lock_wait_timeout = 10
innodb_sync_spin_loops = 40
innodb_max_dirty_pages_pct = 80
innodb_support_xa = 1
innodb_thread_concurrency = 0
innodb_thread_sleep_delay = 500
innodb_concurrency_tickets = 1000
innodb_flush_method = O_DIRECT
innodb_file_per_table = 1
innodb_read_io_threads = 16
innodb_write_io_threads = 16
innodb_io_capacity = 800  #机械盘800 ssd 2000
innodb_flush_neighbors = 1
innodb_file_format = Barracuda
innodb_purge_threads=1   #5.6只能有一个,5.7可以设置多个
innodb_purge_batch_size = 32
innodb_old_blocks_pct=75
innodb_change_buffering=all
innodb_stats_on_metadata=OFF
innodb_print_all_deadlocks = 1
#innodb_status_output=1
#innodb_status_output_locks=1
performance_schema=0   #是否打开P_S库进行性能收集
transaction_isolation = READ-COMMITTED
#innodb_force_recovery=0
#innodb_fast_shutdown=1
#innodb_status_file = 1  #实时输出show engine innodb status到innodb_status文件

############# PXC #####################                                                 
innodb_autoinc_lock_mode=2                                                       
wsrep_cluster_name=pxc-dongzheng                                                 
wsrep_provider=/usr/local/mysql/lib/libgalera_smm.so                             
wsrep_cluster_address=gcomm://192.168.3.130,192.168.3.128,192.168.3.129          
wsrep_node_address=192.168.3.128                                                 
wsrep_slave_threads=2                                                            
wsrep_sst_auth=sst:dongzheng                                                     
wsrep_sst_method=xtrabackup-v2                                                   
wsrep_provider_options="debug=1;socket.checksum=1"


[mysqldump]
quick
max_allowed_packet = 128M


[mysql]
no-auto-rehash
max_allowed_packet = 128M
prompt                         = '(product)\u@\h:\p [\d]> '
default_character_set          = utf8


[myisamchk]
key_buffer_size = 64M
sort_buffer_size = 512k
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout

[mysqld_safe]
#malloc-lib= /usr/local/mysql/lib/mysql/libjemalloc.so
View Code
cd /usr/local/pxc/
./scripts/mysql_install_db --defaults-file=/etc/my.cnf

看到两次ok

#修改启动脚本
vi /etc/init.d/mysql

basedir=/usr/local/pxc
datadir=/data/pxc/mysql3306/data

4.启动,进行授权操作,对于第一个节点必须以特殊方式启动,如下:

/etc/init.d/mysql --help
Usage: mysql {start|stop|restart|restart-bootstrap|reload|force-reload|status|bootstrap-pxc} [ MySQL (Percona XtraDB Cluster) options ]

第一个节点启动

/etc/init.d/mysql bootstrap-pxc 

5.安全加固
连接mysql:mysql -uroot -p -S /data/mysql/mysql3306/tmp/mysql.sock
delete from mysql.user where user!='root' or host!='localhost';
truncate table mysql.db;
drop database test;
进行授权,这里用户名密码是my.cnf里定义的用户名sst 密码dongzheng
GRANT ALL PRIVILEGES ON *.* TO 'sst'@'%' identified by 'dongzheng';
use mysql;
UPDATE user SET password=PASSWORD('123456') WHERE user='root';
flush privileges;
PXC状态确认
show global status like 'wsrep%';


6.netstat进行查看,可以发现启动两个端口
netstat -lntp | grep mysql
tcp 0 0 0.0.0.0:4567 0.0.0.0:* LISTEN 2964/mysqld
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 2964/mysqld

更多详情见请继续阅读下一页的精彩内容: 2017-05/143501p2.htm


推荐阅读
  • 在CentOS 7环境中安装配置Redis及使用Redis Desktop Manager连接时的注意事项与技巧
    在 CentOS 7 环境中安装和配置 Redis 时,需要注意一些关键步骤和最佳实践。本文详细介绍了从安装 Redis 到配置其基本参数的全过程,并提供了使用 Redis Desktop Manager 连接 Redis 服务器的技巧和注意事项。此外,还探讨了如何优化性能和确保数据安全,帮助用户在生产环境中高效地管理和使用 Redis。 ... [详细]
  • 本文深入探讨了NoSQL数据库的四大主要类型:键值对存储、文档存储、列式存储和图数据库。NoSQL(Not Only SQL)是指一系列非关系型数据库系统,它们不依赖于固定模式的数据存储方式,能够灵活处理大规模、高并发的数据需求。键值对存储适用于简单的数据结构;文档存储支持复杂的数据对象;列式存储优化了大数据量的读写性能;而图数据库则擅长处理复杂的关系网络。每种类型的NoSQL数据库都有其独特的优势和应用场景,本文将详细分析它们的特点及应用实例。 ... [详细]
  • Oracle字符集详解:图表解析与中文乱码解决方案
    本文详细解析了 Oracle 数据库中的字符集机制,通过图表展示了不同字符集之间的转换过程,并针对中文乱码问题提供了有效的解决方案。文章深入探讨了字符集配置、数据迁移和兼容性问题,为数据库管理员和开发人员提供了实用的参考和指导。 ... [详细]
  • Redis:缓存与内存数据库详解
    本文介绍了数据库的基本分类,重点探讨了关系型与非关系型数据库的区别,并详细解析了Redis作为非关系型数据库的特点、工作模式、优点及持久化机制。 ... [详细]
  • 简化报表生成:EasyReport工具的全面解析
    本文详细介绍了EasyReport,一个易于使用的开源Web报表工具。该工具支持Hadoop、HBase及多种关系型数据库,能够将SQL查询结果转换为HTML表格,并提供Excel导出、图表显示和表头冻结等功能。 ... [详细]
  • MongoDB核心概念详解
    本文介绍了NoSQL数据库的概念及其应用场景,重点解析了MongoDB的基本特性、数据结构以及常用操作。MongoDB是一个高性能、高可用且易于扩展的文档数据库系统。 ... [详细]
  • 本文介绍了数据库体系的基础知识,涵盖关系型数据库(如MySQL)和非关系型数据库(如MongoDB)的基本操作及高级功能。通过三个阶段的学习路径——基础、优化和部署,帮助读者全面掌握数据库的使用和管理。 ... [详细]
  • 本文深入探讨了SQL数据库中常见的面试问题,包括如何获取自增字段的当前值、防止SQL注入的方法、游标的作用与使用、索引的形式及其优缺点,以及事务和存储过程的概念。通过详细的解答和示例,帮助读者更好地理解和应对这些技术问题。 ... [详细]
  • 本文探讨了在 SQL Server 中使用 JDBC 插入数据时遇到的问题。通过详细分析代码和数据库配置,提供了解决方案并解释了潜在的原因。 ... [详细]
  • 优化SQL Server批量数据插入存储过程的实现
    本文介绍了一种改进的SQL Server存储过程,用于生成批量插入语句。该方法不仅提高了性能,还支持单行和多行模式,适用于SQL Server 2005及以上版本。 ... [详细]
  • 本文详细介绍了如何解决 Microsoft SQL Server 中用户 'sa' 登录失败的问题。错误代码为 18470,提示该帐户已被禁用。我们将通过 Windows 身份验证方式登录,并启用 'sa' 帐户以恢复其访问权限。 ... [详细]
  • 本文档介绍了如何在Visual Studio 2010环境下,利用C#语言连接SQL Server 2008数据库,并实现基本的数据操作,如增删改查等功能。通过构建一个面向对象的数据库工具类,简化了数据库操作流程。 ... [详细]
  • 时序数据是指按时间顺序排列的数据集。通过时间轴上的数据点连接,可以构建多维度报表,揭示数据的趋势、规律及异常情况。 ... [详细]
  • 使用JS、HTML5和C3创建自定义弹出窗口
    本文介绍如何结合JavaScript、HTML5和C3.js来实现一个功能丰富的自定义弹出窗口。通过具体的代码示例,详细讲解了实现过程中的关键步骤和技术要点。 ... [详细]
  • docker镜像重启_docker怎么启动镜像dock ... [详细]
author-avatar
ougq
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有