主机名映射
[root@localhost ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.200.20 mysql-db01
192.168.200.28 mysql-db02
192.168.200.29 mysql-db03
关闭selinux和iptables
[root@mysql-db01 ~]# setenforce 0
[root@mysql-db01 ~]# service iptables stop
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
安装(3台都装)
[root@mysql-db01 ~]# yum -y install ncurses-devel
[root@mysql-db01 ~]# yum -y install libaio
[root@mysql-db01 ~]# tar xf mysql-5.6.17-linux-glibc2.5-x86_64.tar.gz -C /usr/local/
[root@mysql-db01 ~]# ln -s /usr/local/mysql-5.6.17-linux-glibc2.5-x86_64 /usr/local/mysql
[root@mysql-db01 ~]# useradd mysql -s /sbin/nologin -M
[root@mysql-db01 ~]# /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/
[root@mysql-db01 ~]# /bin/cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
[root@mysql-db01 ~]# /bin/cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
[root@mysql-db01 ~]# ln -s /usr/local/mysql/bin/* /usr/local/bin/
[root@mysql-db01 ~]# which mysqladmin
/usr/local/bin/mysqladmin
加入开机自启动并启动mysql
[root@mysql-db01 ~]# chkconfig mysqld on
[root@mysql-db01 ~]# chkconfig mysqld --list
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@mysql-db01 ~]# /etc/init.d/mysqld start
Starting MySQL. SUCCESS!
[root@mysql-db01 ~]# netstat -antup | grep mysql
tcp 0 0 :::3306 :::* LISTEN 1258/mysqld
配置密码
[root@mysql-db01 ~]# mysqladmin -uroot password '666666'
主库操作(mysql-db01)
修改配置文件
#修改主库配置文件/etc/my.cnf
[root@mysql-db01 mysql]# cat /etc/my.cnf
[client]
socket = /usr/local/mysql/data/mysql.sock
[mysqld]
lower_case_table_names = 1
default-storage-engine = InnoDB
port = 3306
datadir = /usr/local/mysql/data
character-set-server = utf8
socket = /usr/local/mysql/data/mysql.sock
log_bin = mysql-bin #开启binlog日志
server_id = 1 #设置server_id
innodb_buffer_pool_size = 200M
slave-parallel-workers = 8
thread_cache_size = 600
back_log = 600
slave_net_timeout = 60
max_binlog_size = 512M
key_buffer_size = 8M
query_cache_size = 64M
join_buffer_size = 2M
sort_buffer_size = 2M
query_cache_type = 1
thread_stack = 192K
#重启动MySQL服务
[root@mysql-db01 mysql]# /etc/init.d/mysqld restart
Shutting down MySQL.. SUCCESS!
Starting MySQL. SUCCESS!
创建主从复制用户
mysql> grant replication slave on *.* to rep@'192.168.200.%' identified by '666666';
Query OK, 0 rows affected (0.01 sec)
mysql> select user,host from mysql.user;
+------+---------------+
| user | host |
+------+---------------+
| root | 127.0.0.1 |
| rep | 192.168.200.% |
| root | ::1 |
| | localhost |
| root | localhost |
| | mysql-db01 |
| root | mysql-db01 |
+------+---------------+
7 rows in set (0.00 sec)
mysql> show grants for rep@'192.168.200.%';
+----------------------------------------------------------------------------------------------------------------------------+
| Grants for rep@192.168.200.% |
+----------------------------------------------------------------------------------------------------------------------------+
| GRANT REPLICATION SLAVE ON *.* TO 'rep'@'192.168.200.%' IDENTIFIED BY PASSWORD '*B2B366CA5C4697F31D4C55D61F0B17E70E5664EC' |
+----------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
从库操作(mysql-db02和mysql-db03)
修改配置文件
#修改mysql-db02配置文件(和mysql-db01配置文件一致)
#只需要修改server-id = 5选项
[root@mysql-db02 ~]# cat /etc/my.cnf
[client]
socket = /usr/local/mysql/data/mysql.sock
[mysqld]
lower_case_table_names = 1
default-storage-engine = InnoDB
port = 3306
datadir = /usr/local/mysql/data
character-set-server = utf8
socket = /usr/local/mysql/data/mysql.sock
log_bin = mysql-bin #从binlog也要打开
server_id = 5 #仅需修改此项
innodb_buffer_pool_size = 200M
slave-parallel-workers = 8
thread_cache_size = 600
back_log = 600
slave_net_timeout = 60
max_binlog_size = 512M
key_buffer_size = 8M
query_cache_size = 64M
join_buffer_size = 2M
sort_buffer_size = 2M
query_cache_type = 1
thread_stack = 192K
[root@mysql-db02 ~]# /etc/init.d/mysqld restart #重启mysql
Shutting down MySQL.. SUCCESS!
Starting MySQL. SUCCESS!
#修改mysql-db03配置文件(和mysql-db01配置文件一致)
#只需要修改server-id = 10选项
[root@mysql-db03 ~]# cat /etc/my.cnf
[client]
socket = /usr/local/mysql/data/mysql.sock
[mysqld]
lower_case_table_names = 1
default-storage-engine = InnoDB
port = 3306
datadir = /usr/local/mysql/data
character-set-server = utf8
socket = /usr/local/mysql/data/mysql.sock
log_bin = mysql-bin #从binlog也要打开
server_id = 10 #只需修改此项
innodb_buffer_pool_size = 200M
slave-parallel-workers = 8
thread_cache_size = 600
back_log = 600
slave_net_timeout = 60
max_binlog_size = 512M
key_buffer_size = 8M
query_cache_size = 64M
join_buffer_size = 2M
sort_buffer_size = 2M
query_cache_type = 1
thread_stack = 192K
[root@mysql-db03 ~]# /etc/init.d/mysqld restart #重启mysql
Shutting down MySQL.. SUCCESS!
Starting MySQL. SUCCESS!
开启GTID
mysql> show global variables like '%gtid%'; #查看GTID是否开启
+--------------------------+-------+
| Variable_name | Value |
+--------------------------+-------+
| enforce_gtid_consistency | OFF |
| gtid_executed | |
| gtid_mode | OFF |
| gtid_owned | |
| gtid_purged | |
+--------------------------+-------+
5 rows in set (0.07 sec) #没开启
编辑mysql配置文件(主库从库都需要修改)
再次查看GTID状态
[root@mysql-db01 ~]# mysql -uroot -p666666
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.17-log MySQL Community Server (GPL)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show global variables like '%gtid%';
+--------------------------+-------+
| Variable_name | Value |
+--------------------------+-------+
| enforce_gtid_consistency | ON | # 执行GTID一致
| gtid_executed | |
| gtid_mode | ON | # 开启GTID模块
| gtid_owned | |
| gtid_purged | |
+--------------------------+-------+
5 rows in set (0.00 sec)
开启从库的主从复制功能(mysql-db02,mysql-db03)
mysql> start slave; #开启主从同步功能
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.0.51
Master_User: rep
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000003
Read_Master_Log_Pos: 151
Relay_Log_File: mysql-db02-relay-bin.000002
Relay_Log_Pos: 361
Relay_Master_Log_File: mysql-bin.000003
Slave_IO_Running: Yes #此项yes代表成功
Slave_SQL_Running: Yes #此项yes代表成功
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
#....以下省略若干行....
因为MHA需要relaylog日志,但是mysql会自动删除relaylog日志,所以需要关闭自动删除
#登陆从库
[root@mysql-db02 ~]# mysql -uroot -p123123
#临时禁用自动删除relay log功能
mysql> set global relay_log_purge = 0;
Query OK, 0 rows affected (0.00 sec)
#设置只读
mysql> set global read_only=1;
Query OK, 0 rows affected (0.00 sec)
编辑配置文件/etc/my.cof
修改配置文件必须重启服务
/etc/init.d/mysqld restart
部署MHA
环境准备(所有节点mysql-01,mysql-02,mysql-03)
#光盘安装依赖包
[root@mysql-db01 ~]# yum -y install perl-DBD-MySQL
#安装mha4mysql-node-0.56-0.el6.noarch.rpm
[root@mysql-db01 rpm]# rpm -ivh mha4mysql-node-0.56-0.el6.noarch.rpm
Preparing... ########################################### [100%]
1:mha4mysql-node ########################################### [100%]
[root@mysql-db01 rpm]# mysql -uroot -p666666
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.17-log MySQL Community Server (GPL)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> grant all privileges on *.* to mha@'192.168.200.%' identified by '666666';
Query OK, 0 rows affected (0.12 sec)
mysql> select user,host from mysql.user where user='mha';
+------+---------------+
| user | host |
+------+---------------+
| mha | 192.168.200.% | #主库上创建从库自动复制
+------+---------------+
1 row in set (0.10 sec)
# 3台MsQL都需要安装mha4mysql-node-0.56-0.el6.noarch.rpm
部署管理节点(mha-manager)
在mysql-db03上部署管理节点
#使用阿里云源+epel源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
wget -O /etc/yum.repos.d/epel-6.repo http://mirrors.aliyun.com/repo/epel-6.repo
#安装manager依赖包(需要公网源)
[root@mysql-db03 ~]# yum -y install perl-Config-Tiny epel-release perl-Log-Dispatch perl-Parallel-ForkManager perl-Time-HiRes
#安装manager包
[root@mysql-db03 rpm]# rpm -ivh mha4mysql-manager-0.56-0.el6.noarch.rpm
Preparing... ########################################### [100%]
1:mha4mysql-manager ########################################### [100%]
编辑配置文件
#创建配置文件目录
[root@mysql-db03 ~]# mkdir -p /etc/mha
#创建日志目录
[root@mysql-db03 ~]# mkdir -p /var/log/mha/mha1
#创建配置文件(默认没有)
[root@mysql-db03 ~]# cd /etc/mha/
[root@mysql-db03 mha]# ls
[root@mysql-db03 mha]# vim /etc/mha/mha1.cnf
[root@mysql-db03 mha]# cat /etc/mha/mha1.cnf
[server default]
manager_log=/var/log/mha/mha1/manager #manager管理日志存放路径
manager_workdir=/var/log/mha/mha1 #manager管理日志的目录路径
master_binlog_dir=/usr/local/mysql/data #binlog日志的存放路径
user=mha #管理账户
password=123123 #管理账户密码
ping_interval=2 #存活检查的间隔时间
repl_user=rep #主从复制的授权账户
repl_password=123123 #主从复制的授权账户密码
ssh_user=root #用于ssh连接的账户
[server1]
hostname=192.168.0.51
port=3306
[server2]
#candidate_master=1 #此条暂时注释掉(后面解释)
#check_repl_delay=0 #此条暂时注释掉(后面解释)
hostname=192.168.0.52
port=3306
[server3]
hostname=192.168.0.53
port=3306
配置ssh信任(所有节点mysql-db01,mysql-db02,mysql-db03)
#创建秘钥对,三个都创建,因为要互相免密码登录
[root@mysql-db03 ~]# ssh-keygen -t dsa -P "" -f ~/.ssh/id_dsa
#发送mysql-db03公钥,包括自己
[root@mysql-db03 ~]# ssh-copy-id -i /root/.ssh/id_dsa.pub root@192.168.200.20
[root@mysql-db03 ~]# ssh-copy-id -i /root/.ssh/id_dsa.pub root@192.168.200.28
[root@mysql-db03 ~]# ssh-copy-id -i /root/.ssh/id_dsa.pub root@192.168.200.29
#发送mysql-db02公钥,包括自己
[root@mysql-db02 ~]# ssh-copy-id -i /root/.ssh/id_dsa.pub root@192.168.200.20
[root@mysql-db02 ~]# ssh-copy-id -i /root/.ssh/id_dsa.pub root@192.168.200.28
[root@mysql-db02 ~]# ssh-copy-id -i /root/.ssh/id_dsa.pub root@192.168.200.29
#发送mysql-db01公钥,包括自己
[root@mysql-db01 ~]# ssh-copy-id -i /root/.ssh/id_dsa.pub root@192.168.200.20
[root@mysql-db01 ~]# ssh-copy-id -i /root/.ssh/id_dsa.pub root@192.168.200.28
[root@mysql-db01 ~]# ssh-copy-id -i /root/.ssh/id_dsa.pub root@192.168.200.29
启动测试
ssh检查检测
[root@mysql-db03 mha]# masterha_check_ssh --conf=/etc/mha/mha1.cnf #ssh检查命令
Sat Nov 24 06:21:45 2018 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Sat Nov 24 06:21:45 2018 - [info] Reading application default configuration from /etc/mha/mha1.cnf..
Sat Nov 24 06:21:45 2018 - [info] Reading server configuration from /etc/mha/mha1.cnf..
Sat Nov 24 06:21:45 2018 - [info] Starting SSH connection tests..
Sat Nov 24 06:21:46 2018 - [debug]
Sat Nov 24 06:21:45 2018 - [debug] Connecting via SSH from root@192.168.200.20(192.168.200.20:22) to root@192.168.200.28(192.168.200.28:22)..
Sat Nov 24 06:21:45 2018 - [debug] ok.
Sat Nov 24 06:21:45 2018 - [debug] Connecting via SSH from root@192.168.200.20(192.168.200.20:22) to root@192.168.200.29(192.168.200.29:22)..
Sat Nov 24 06:21:45 2018 - [debug] ok.
Sat Nov 24 06:21:47 2018 - [debug]
Sat Nov 24 06:21:46 2018 - [debug] Connecting via SSH from root@192.168.200.29(192.168.200.29:22) to root@192.168.200.20(192.168.200.20:22)..
Sat Nov 24 06:21:46 2018 - [debug] ok.
Sat Nov 24 06:21:46 2018 - [debug] Connecting via SSH from root@192.168.200.29(192.168.200.29:22) to root@192.168.200.28(192.168.200.28:22)..
Sat Nov 24 06:21:47 2018 - [debug] ok.
Sat Nov 24 06:21:47 2018 - [debug]
Sat Nov 24 06:21:45 2018 - [debug] Connecting via SSH from root@192.168.200.28(192.168.200.28:22) to root@192.168.200.20(192.168.200.20:22)..
Sat Nov 24 06:21:46 2018 - [debug] ok.
Sat Nov 24 06:21:46 2018 - [debug] Connecting via SSH from root@192.168.200.28(192.168.200.28:22) to root@192.168.200.29(192.168.200.29:22)..
Sat Nov 24 06:21:46 2018 - [debug] ok.
Sat Nov 24 06:21:47 2018 - [info] All SSH connection tests passed successfully. #出现这个就表示成功
主从复制检查
(1)错误的主从复制检测 [root@mysql-db03 ~]# masterha_check_repl --conf=/etc/mha/mha1.cnf
如果出现下面的情况
因此在mysql-db02和mysql-db03上添加主从复制的用户即可。
grant replication slave on *.* to rep@'192.168.200.%' identified by '666666';
再次检查
启动MHA
#启动
[root@mysql-db03 ~]# nohup masterha_manager --conf=/etc/mha/mha1.cnf --remove_dead_master_conf --ignore_last_failover < /dev/null > /var/log/mha/mha1/manager.log 2>&1 & #启动后按几次回车,不退出就是没问题。
[root@mysql-db03 ~]# ps -ef | grep perl | grep -v grep
root 5585 2925 0 09:23 pts/1 00:00:00 perl /usr/bin/masterha_manager --conf=/etc/mha/mha1.cnf --remove_dead_master_conf --ignore_last_failover
(1)登陆mysql-db02(192.168.200.28)查看信息状态
#登陆数据库mysql-db02(192.168.200.28)
[root@mysql-db03 ~]# mysql -uroot -p666666
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.200.20 #这是主库IP地址
Master_User: rep
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000003
Read_Master_Log_Pos: 1656
Relay_Log_File: mysql-db02-relay-bin.000004
Relay_Log_Pos: 1796
Relay_Master_Log_File: mysql-bin.000003
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
..以下省略若干内容..
(2)停掉mysql-db01(192.168.200.20)上的MySQL服务
[root@localhost rpm]# /etc/init.d/mysqld stop
Shutting down MySQL...... SUCCESS!
(3)查看mysql-db03上的MySQL从库同步状态
[root@localhost mha]# mysql -uroot -p666666 -e 'show slave status\G'
Warning: Using a password on the command line interface can be insecure.
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.200.28 #现在的主库IP
Master_User: rep
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000003 #binlog日志
Read_Master_Log_Pos: 662 #binlog日志位置
Relay_Log_File: localhost-relay-bin.000002
Relay_Log_Pos: 665
Relay_Master_Log_File: mysql-bin.000003
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
..以下省略若干内容..
(4)查看mysql-db02上的MySQL,主库同步状态。
5)查看mysql-db03上的mha进程状态
[root@mysql-db03 ~]# ps -ef | grep perl | grep -v grep #查询发现mha进程已经没了
[root@mysql-db03 ~]#
(6)查看mha配置文件信息
进行mha的故障还原测试
(1)将故障宕机的mysql-db01的MySQL服务启动并授权进行从同步
[root@mysql-db01 ~]# /etc/init.d/mysqld start
Starting MySQL. SUCCESS!
[root@mysql-db01 ~]# mysql -uroot -p666666
mysql> CHANGE MASTER TO MASTER_HOST='192.168.200.28', MASTER_PORT=3306, MASTER_AUTO_POSITION=1, MASTER_USER='rep', MASTER_PASSWORD='666666';
(2)将mha配置文件里缺失的部分补全
[root@localhost mha]# cat /etc/mha/mha1.cnf
[server default]
manager_log=/var/log/mha/mha1/manager
manager_workdir=/var/log/mha/mha1
master_binlog_dir=/usr/local/mysql/data
password=666666
ping_interval=2
repl_password=666666
repl_user=rep
ssh_user=root
user=mha
[server1]
hostname=192.168.200.20
port=3306
[server2]
hostname=192.168.200.28
port=3306
[server3]
hostname=192.168.200.29
port=3306
(3)启动mha进程
[root@mysql-db03 ~]# nohup masterha_manager --conf=/etc/mha/mha1.cnf --remove_dead_master_conf --ignore_last_failover < /dev/null > /var/log/mha/mha1/manager.log 2>&1 &
[root@localhost mha]# ps -ef |grep perl
root 4541 934 0 23:39 pts/0 00:00:00 perl /usr/bin/masterha_manager --conf=/etc/mha/mha1.cnf --remove_dead_master_conf --ignore_last_failover
(4)停掉mysql-db02上的MySQL服务
[root@localhost ~]# /etc/init.d/mysqld stop
Shutting down MySQL...... SUCCESS!
(5)查看mysql-db03上的主从同步状态:
(6)启动mysql-db02上的MySQL服务
[root@mysql-db02 ~]# /etc/init.d/mysqld start
Starting MySQL. SUCCESS!
[root@mysql-db02 ~]# mysql -uroot -p666666
mysql> CHANGE MASTER TO MASTER_HOST='192.168.200.20', MASTER_PORT=3306, MASTER_AUTO_POSITION=1, MASTER_USER='rep', MASTER_PASSWORD='666666';
mysql> start slave;
mysql> show slave status\G #查看从同步状态
(7)再次补全mha配置文件后,启动mha进程
[root@localhost mha]# cat /etc/mha/mha1.cnf
[server default]
manager_log=/var/log/mha/mha1/manager
manager_workdir=/var/log/mha/mha1
master_binlog_dir=/usr/local/mysql/data
password=666666
ping_interval=2
repl_password=666666
repl_user=rep
ssh_user=root
user=mha
[server1]
hostname=192.168.200.20
port=3306
[server2]
hostname=192.168.200.28
port=3306
[server3]
hostname=192.168.200.29
port=3306
[root@mysql-db03 ~]# nohup masterha_manager --conf=/etc/mha/mha1.cnf --remove_dead_master_conf --ignore_last_failover < /dev/null > /var/log/mha/mha1/manager.log 2>&1 &
[root@localhost mha]# ps -ef | grep perl | grep -v grep
root 5027 934 0 Nov24 pts/0 00:00:00 perl /usr/bin/masterha_manager --conf=/etc/mha/mha1.cnf --remove_dead_master_conf --ignore_last_failover
MHA-Atlas-MySQL高可用集群的更多相关文章
-
构建MHA实现MySQL高可用集群架构
一.MHA简介 MHA(Master HighAvailability)目前在MySQL高可用方面是一个相对成熟的解决方案,它由日本DeNA公司youshimaton(现就职于Facebook公司)开 ...
-
MySQL高可用集群方案
一.Mysql高可用解决方案 方案一:共享存储 一般共享存储采用比较多的是 SAN/NAS 方案. 方案二:操作系统实时数据块复制 这个方案的典型场景是 DRBD,DRBD架构(MySQL+DRBD+ ...
-
部署MYSQL高可用集群
mysql-day08 部署MYSQL高可用集群 u 集群架构 ...
-
Mysql高可用集群环境介绍
MySQL高可用集群环境搭建 01.MySQL高可用环境方案 02.MySQL主从复制原理 03.MySQL主从复制作用 04.在Linux环境上安装MySQL 05.在MySQL集群环境上配置主从复 ...
-
Mysql 高可用集群PXC
PXC是percona公司的percona xtraDB cluster,简称PXC.它是基于Galera协议的高可用集群方案.可以实现多个节点间的数据同步复制以及读写,并且可保障数据库的服务高可 ...
-
keepalived+MySQL高可用集群
基于keepalived搭建MySQL的高可用集群 MySQL的高可用方案一般有如下几种: keepalived+双主,MHA,MMM,Heartbeat+DRBD,PXC,Galera Clus ...
-
corosync+pacemaker and drbd实现mysql高可用集群
DRBD:Distributed Replicated Block Device 分布式复制块设备,原理图如下 DRBD 有主双架构和双主架构的,当处于主从架构时,这个设备一定只有一个节点是可以读写的 ...
-
heatbeat-gui实现基于nfs的mysql高可用集群
一.简述HA高可用集群 高可用集群就是当集群中的一个节点发生各种软硬件及人为故障时,集群中的其他节点能够自动接管故障节点的资源并向外提供服务.以实现减少业务中断时间,为用户提供更可靠,更高效的服务. ...
-
MYSQL高可用集群架构-MHA架构
1 MHA简介:MHA(Master High Availability)目前在MySQL高可用方面是一个相对成熟的解决方案,它由日本DeNA公司youshimaton(现就职于Facebook公司 ...
-
基于Galera Cluster多主结构的Mysql高可用集群
Galera Cluster特点 1.多主架构:真正的多点读写的集群,在任何时候读写数据,都是最新的 2.同步复制:集群不同节点之间数据同步,没有延迟,在数据库挂掉之后,数据不会丢失 3.并发复制:从 ...
随机推荐
-
安装 Dubbo 注册中心(Zookeeper-3.4.6)--单节点
1.建议使用dubbo-2.3.3以上版本的使用zookeeper注册中心客户端2.Zookeeper是Apache Hadoop的子项目,强度相对较好,建议生产环境使用该注册中心.3.Dubbo未对 ...
-
BZOJ1834 [ZJOI2010]network 网络扩容(最小费用最大流)
挺直白的构图..最小费用最大流的定义. #include<cstdio> #include<cstring> #include<queue> #include< ...
-
java 使用redis 数据库
[TOC] java 使用redis 数据库 连接redis package com.wsc.redis.Test1; import java.util.List; import java.util. ...
-
AppCan
启动服务 将app程序寄宿在计算机上,在计算机上调试:访问服务地址,将appToken值复制一下 在浏览器输入192.168.2.102:3000/appToken的值/文件路径后即可调试 入口文件 ...
-
vue.js实战——splice使用
Vue在检测到数组变化时,并不是直接重新渲染整个列表,而是最大化地复用DOM元素.替换的数组中含有相同元素的项不会被重新渲染,因此可以大胆地用新数组来替换就数组,不用担心性能问题. 需要注意的是,以下 ...
-
在Django中接收文件并存储
首先是一个views函数的例子 def get_user_profiles(request): if request.method == 'POST': myFile = request.FILES. ...
-
Spatial Sound Research
Spatial Sound Research What are our goals? The basic goal of our research is to develop cost-effecti ...
-
Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) C. Ray Tracing 数学
C. Ray Tracing 题目连接: http://codeforces.com/contest/724/problem/C Description oThere are k sensors lo ...
-
Mac下用brew搭建PHP(LNMP/LAMP)开发环境
Mac下搭建lamp开发环境很容易,有xampp和mamp现成的集成环境.但是集成环境对于经常需要自定义一些配置的开发者来说会非常麻烦,而且Mac本身自带apache和php,在brew的帮助下非常容 ...
-
Spring JDBC处理CLOB类型字段
以下示例将演示使用spring jdbc更新CLOB类型的字段值,即更新student表中的可用记录. student表的结构如下 - CREATE TABLE student( ID INT NOT ...