主主+ lvs keepalived 配置文件
2016-02-24 13:17
351 查看
主主+ lvs keepalived 配置文件
主主搭建
rpm -qa | grep mysql
yum remove -y
yum install -y
/etc/init.d/mysql stop
mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
use mysql;
UPDATE user SET Password=PASSWORD('mysql') where USER='root';
/etc/init.d/mysql restart
mysql -uroot -pmysql
SET PASSWORD=password('mysql');
GRANT all privileges on *.* TO 'root'@'%' identified by 'mysql' WITH GRANT OPTION;
SET PASSWORD FOR 'root'@'%' = PASSWORD('mysql');
grant replication slave on *.* to 'rep'@'%' identified by 'rep';
grant replication slave on *.* to 'rep'@'172.16.15.%' identified by 'rep';
change master to master_host='172.16.15.28',master_user='rep',master_password='rep',
master_log_file='mysql-bin.000001',master_log_pos=317;
1 搭建keepalived
! Configuration File for keepalived
global_defs {
router_id mm1
}
vrrp_sync_group VG1 {
group {
VI_1
}
}
vrrp_instance VI_1 {
state BACKUP
interface eth0
virtual_router_id 60
priority 80
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
172.16.15.29
}
}
virtual_server 172.16.15.29 3306 {
delay_loop 6
lb_algo wrr
lb_kind DR
nat_mask 255.255.254.0
persistence_timeout 50
protocol TCP
real_server 172.16.15.28 3306 {
weight 1
notify_down /usr/local/mysql/bin/mysql.sh
TCP_CHECK {
connect_timeout 10
nb_get_retry 3
connect_port 3306
}
}
}
2主机
! Configuration File for keepalived
global_defs {
router_id mm2
}
vrrp_sync_group VG1 {
group {
VI_1
}
}
vrrp_instance VI_1 {
state BACKUP
interface eth1
virtual_router_id 60
priority 100
advert_int 1
nopreempt
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
172.16.15.29
}
}
virtual_server 172.16.15.29 3306 {
delay_loop 6
lb_algo wrr
lb_kind DR
nat_mask 255.255.254.0
persistence_timeout 50
protocol TCP
real_server 172.16.15.27 3306 {
weight 1
notify_down /usr/local/mysql/bin/mysql.sh
TCP_CHECK {
connect_timeout 10
nb_get_retry 3
connect_port 3306
}
}
}
主主搭建
rpm -qa | grep mysql
yum remove -y
yum install -y
/etc/init.d/mysql stop
mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
use mysql;
UPDATE user SET Password=PASSWORD('mysql') where USER='root';
/etc/init.d/mysql restart
mysql -uroot -pmysql
SET PASSWORD=password('mysql');
GRANT all privileges on *.* TO 'root'@'%' identified by 'mysql' WITH GRANT OPTION;
SET PASSWORD FOR 'root'@'%' = PASSWORD('mysql');
grant replication slave on *.* to 'rep'@'%' identified by 'rep';
grant replication slave on *.* to 'rep'@'172.16.15.%' identified by 'rep';
change master to master_host='172.16.15.28',master_user='rep',master_password='rep',
master_log_file='mysql-bin.000001',master_log_pos=317;
1 搭建keepalived
! Configuration File for keepalived
global_defs {
router_id mm1
}
vrrp_sync_group VG1 {
group {
VI_1
}
}
vrrp_instance VI_1 {
state BACKUP
interface eth0
virtual_router_id 60
priority 80
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
172.16.15.29
}
}
virtual_server 172.16.15.29 3306 {
delay_loop 6
lb_algo wrr
lb_kind DR
nat_mask 255.255.254.0
persistence_timeout 50
protocol TCP
real_server 172.16.15.28 3306 {
weight 1
notify_down /usr/local/mysql/bin/mysql.sh
TCP_CHECK {
connect_timeout 10
nb_get_retry 3
connect_port 3306
}
}
}
2主机
! Configuration File for keepalived
global_defs {
router_id mm2
}
vrrp_sync_group VG1 {
group {
VI_1
}
}
vrrp_instance VI_1 {
state BACKUP
interface eth1
virtual_router_id 60
priority 100
advert_int 1
nopreempt
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
172.16.15.29
}
}
virtual_server 172.16.15.29 3306 {
delay_loop 6
lb_algo wrr
lb_kind DR
nat_mask 255.255.254.0
persistence_timeout 50
protocol TCP
real_server 172.16.15.27 3306 {
weight 1
notify_down /usr/local/mysql/bin/mysql.sh
TCP_CHECK {
connect_timeout 10
nb_get_retry 3
connect_port 3306
}
}
}
相关文章推荐
- C++设计模式-1简单工厂模式
- AFNetworking 3.0迁移指南
- java中Overload(重载)和Override(重写、覆盖)
- c语言入门之项目3.9——输出一个“空”三角形
- AJAXdemo.html
- bootstrapValidator不触发校验
- php empty和isset的比较
- MySQL主从复制结构中常用参数
- 排序——插入排序(insertionsort)
- 网络虚拟化是否需要额外的网络架构?
- Spring Mvc提交form表单上传文件
- SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"
- mysql主从同步(低版本)参数说明
- 24、微信-标题栏上的下拉菜单式弹窗TitlePopup
- 内部排序之直接插入排序
- Java 之工厂方法和抽象工厂模式(Abstract Factory)
- 23、微信-温馨提示对话框WarnTipDialog
- Spark MLlib 1.6 -- 协同过滤
- 循环语句应用实例
- 苹果支付(3)