zabbix 3.2高可用

说明

1. 基础架构为LAMP环境,采用keepalived实现zabbix服务器高可用,保证主server的mysql或者httpd宕掉后能切换到从server

2、数据库做主主同步,保证两边服务器数据的一致性,实现数据库的高可用。

环境

zabbix01:192.168.8.117

zabbix02:192.168.8.118

vip:192.168.8.111

OS:CentOS release 6.9 X86_64

MYSQL:Percona-Server-5.6

NGINX:tengine-2.2.0

PHP: php-7.0.16

ZABBIX:zabbix3.2.6

zlib:zlib-1.2.11

openssl:openssl-1.0.2

pcre:pcre-8.39

安装依赖

yum update

yum groupinstall ‘开发工具‘

vim /etc/selinux/config

selinux=disabled

:wq

iptables -F

/etc/init.d/iptables save

/etc/init.d/iptables stop

chkconfig iptables off

/etc/init.d/postfix stop && chkconfig postfix off

yum install gcc gcc-c++ libxml2 libxml2-devel libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libmcrypt libmcrypt-devel  openssl-devel  bzip2-devel recode-devel openldap openldap-devel net-snmp net-snmp-devel libcurl-devel libcurl vim wget ntp jemalloc -y

reboot

LNMP环境安装

安装pcre

tar xf pcre-8.39.tar.gz

cd pcre-8.39

./configure --prefix=/usr/local/pcre/ && make && make install

openssl安装

tar xf openssl-1.0.2.tar.gz

cd openssl-1.0.2

./config enable-shared --prefix=/usr/local/openssl/ && make && make test && make install

zlib安装

tar xf zlib-1.2.11.tar.gz

cd zlib-1.2.11

./configure --prefix=/usr/local/zlib && make &&make install

nginx安装

groupadd web

useradd -s /sbin/nologin -g web web

tar xf tengine-2.2.0.tar.gz

./configure --prefix=/usr/local/nginx  --user=web --group=web --with-pcre=/root/pcre-8.39 --with-openssl=/root/openssl-1.0.2 --with-zlib=/root/zlib-1.2.11 --with-file-aio --with-http_gzip_static_module --with-http_realip_module  --with-http_stub_status_module

make && make install

vim /etc/init.d/nginx

#!/bin/sh

#

# nginx - this script starts and stops the nginx daemon

#

# chkconfig:   - 85 15

# description:  Nginx is an HTTP(S) server, HTTP(S) reverse \

#               proxy and IMAP/POP3 proxy server

# processname: nginx

# config:      /etc/nginx/nginx.conf

# config:      /etc/sysconfig/nginx

# pidfile:     /var/run/nginx.pid

# Source function library.

. /etc/rc.d/init.d/functions

# Source networking configuration.

. /etc/sysconfig/network

# Check that networking is up.

[ "$NETWORKING" = "no" ] && exit 0

nginx="/usr/local/nginx/sbin/nginx"

prog=$(basename $nginx)

NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf"

[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx

lockfile=/var/lock/subsys/nginx

make_dirs() {

# make required directories

user=`$nginx -V 2>&1 | grep "configure arguments:" | sed ‘s/[^*]*--user=\([^ ]*\).*/\1/g‘ -`

if [ -z "`grep $user /etc/passwd`" ]; then

useradd -M -s /bin/nologin $user

fi

options=`$nginx -V 2>&1 | grep ‘configure arguments:‘`

for opt in $options; do

if [ `echo $opt | grep ‘.*-temp-path‘` ]; then

value=`echo $opt | cut -d "=" -f 2`

if [ ! -d "$value" ]; then

# echo "creating" $value

mkdir -p $value && chown -R $user $value

fi

fi

done

}

start() {

[ -x $nginx ] || exit 5

[ -f $NGINX_CONF_FILE ] || exit 6

make_dirs

echo -n $"Starting $prog: "

daemon $nginx -c $NGINX_CONF_FILE

retval=$?

echo

[ $retval -eq 0 ] && touch $lockfile

return $retval

}

stop() {

echo -n $"Stopping $prog: "

killproc $prog -QUIT

retval=$?

echo

[ $retval -eq 0 ] && rm -f $lockfile

return $retval

}

restart() {

configtest || return $?

stop

sleep 1

start

}

reload() {

configtest || return $?

echo -n $"Reloading $prog: "

killproc $nginx -HUP

RETVAL=$?

echo

}

force_reload() {

restart

}

configtest() {

$nginx -t -c $NGINX_CONF_FILE

}

rh_status() {

status $prog

}

rh_status_q() {

rh_status >/dev/null 2>&1

}

case "$1" in

start)

rh_status_q && exit 0

$1

;;

stop)

rh_status_q || exit 0

$1

;;

restart|configtest)

$1

;;

reload)

rh_status_q || exit 7

$1

;;

force-reload)

force_reload

;;

status)

rh_status

;;

condrestart|try-restart)

rh_status_q || exit 0

;;

*)

echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"

exit 2

esac

chkconfig nginx on

ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/nginx

chmod +x /etc/init.d/nginx

php安装

tar xf php-7.0.16.tar.gz

cd php-7.0.16

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-bz2 --with-curl --enable-ftp --enable-sockets --disable-ipv6 --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-freetype-dir=/usr/local --enable-gd-native-ttf --with-iconv-dir=/usr/local/lib/libconv --enable-mbstring --enable-calendar --with-gettext --with-libxml-dir=/usr/local --with-zlib --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --enable-dom --enable-xml --enable-fpm --with-libdir=lib64 --enable-bcmath --enable-zip --enable-pcntl --enable-exif --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-opcache --enable-session --enable-mbregex --with-fpm-user=vagrant  --with-fpm-group=nogroup --enable-wddx --with-mcrypt --enable-gd-native-ttf --enable-gd-jis-conv --with-openssl --with-zlib=/usr --with-recode=/usr --with-xmlrpc --enable-inline-optimization --disable-debug --disable-rpath --with-ldap

make

make test

make install

vim /etc/init.d/php-fpm

#! /bin/sh

### BEGIN INIT INFO

# Provides:          php-fpm

# Required-Start:    $remote_fs $network

# Required-Stop:     $remote_fs $network

# Default-Start:     2 3 4 5

# Default-Stop:      0 1 6

# Short-Description: starts php-fpm

# Description:       starts the PHP FastCGI Process Manager daemon

### END INIT INFO

prefix=/usr/local/php

exec_prefix=${prefix}

php_fpm_BIN=${exec_prefix}/sbin/php-fpm

php_fpm_CONF=${prefix}/etc/php-fpm.conf

php_fpm_PID=${prefix}/var/run/php-fpm.pid

php_opts="--fpm-config $php_fpm_CONF --pid $php_fpm_PID"

wait_for_pid () {

try=0

while test $try -lt 35 ; do

case "$1" in

‘created‘)

if [ -f "$2" ] ; then

try=‘‘

break

fi

;;

‘removed‘)

if [ ! -f "$2" ] ; then

try=‘‘

break

fi

;;

esac

echo -n .

try=`expr $try + 1`

sleep 1

done

}

case "$1" in

start)

echo -n "Starting php-fpm "

$php_fpm_BIN --daemonize $php_opts

if [ "$?" != 0 ] ; then

echo " failed"

exit 1

fi

wait_for_pid created $php_fpm_PID

if [ -n "$try" ] ; then

echo " failed"

exit 1

else

echo " done"

fi

;;

stop)

echo -n "Gracefully shutting down php-fpm "

if [ ! -r $php_fpm_PID ] ; then

echo "warning, no pid file found - php-fpm is not running ?"

exit 1

fi

kill -QUIT `cat $php_fpm_PID`

wait_for_pid removed $php_fpm_PID

if [ -n "$try" ] ; then

echo " failed. Use force-quit"

exit 1

else

echo " done"

fi

;;

status)

if [ ! -r $php_fpm_PID ] ; then

echo "php-fpm is stopped"

exit 0

fi

PID=`cat $php_fpm_PID`

if ps -p $PID | grep -q $PID; then

echo "php-fpm (pid $PID) is running..."

else

echo "php-fpm dead but pid file exists"

fi

;;

force-quit)

echo -n "Terminating php-fpm "

if [ ! -r $php_fpm_PID ] ; then

echo "warning, no pid file found - php-fpm is not running ?"

exit 1

fi

kill -TERM `cat $php_fpm_PID`

wait_for_pid removed $php_fpm_PID

if [ -n "$try" ] ; then

echo " failed"

exit 1

else

echo " done"

fi

;;

restart)

$0 stop

$0 start

;;

reload)

echo -n "Reload service php-fpm "

if [ ! -r $php_fpm_PID ] ; then

echo "warning, no pid file found - php-fpm is not running ?"

exit 1

fi

kill -USR2 `cat $php_fpm_PID`

echo " done"

;;

*)

echo "Usage: $0 {start|stop|force-quit|restart|reload|status}"

exit 1

;;

esac

chmod +x /etc/init.d/php-fpm

chkconfig php-fpm on

ln -s /usr/local/php/bin/php /usr/local/bin/php

ln -s /usr/local/php/bin/php-config /usr/local/bin/php-config

ln -s /usr/local/php/bin/phpize /usr/local/bin/phpize

cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf

cp php.ini-development /usr/local/php/etc/php.ini

ln -s /user/local/php/etc/php.ini /etc

vim www.conf

将user和group替换为web

nginx和php整合

cat /user/local/nginx/conf/nginx.conf

mysql安装

tar xf Percona-Server-5.6.33-79.0-r2084bdb-el6-x86_64-bundle.tar

yum localinstall Percona-Server-*

/etc/init.d/mysql start

ps_tokudb_admin --enable -uroot

更改数据引擎

vim /etc/my.cnf

在[mysqld]下添加

default-storage-engine=TokuDB

:wq

/etc/init.d/mysql restart

mysql> show engines;

+--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+

| Engine             | Support | Comment                                                                    | Transactions | XA   | Savepoints |

+--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+

| PERFORMANCE_SCHEMA | YES     | Performance Schema                                                         | NO           | NO   | NO         |

| CSV                | YES     | CSV storage engine                                                         | NO           | NO   | NO         |

| MyISAM             | YES     | MyISAM storage engine                                                      | NO           | NO   | NO         |

| BLACKHOLE          | YES     | /dev/null storage engine (anything you write to it disappears)             | NO           | NO   | NO         |

| MEMORY             | YES     | Hash based, stored in memory, useful for temporary tables                  | NO           | NO   | NO         |

| TokuDB             | DEFAULT | Percona TokuDB Storage Engine with Fractal Tree(tm) Technology             | YES          | YES  | YES        |

| MRG_MYISAM         | YES     | Collection of identical MyISAM tables                                      | NO           | NO   | NO         |

| ARCHIVE            | YES     | Archive storage engine                                                     | NO           | NO   | NO         |

| InnoDB             | YES     | Percona-XtraDB, Supports transactions, row-level locking, and foreign keys | YES          | YES  | YES        |

| FEDERATED          | NO      | Federated MySQL storage engine                                             | NULL         | NULL | NULL       |

+--------------------+---------+----------------------------------------------------------------------------+--------------+------+------------+

10 rows in set (0.03 sec)

chkconfig mysql on

启动服务

/etc/init.d/nginx restart

/etc/ini.d/php-fpm restart

安装zabbix

groupadd -g 201 zabbix

useradd -g zabbix -u 201 -s /sbin/nologin zabbix

tar xf zabbix-3.2.6.tar.gz

cd zabbix-3.2.6

./configure --prefix=/usr/local/zabbix --enable-server --enable-proxy --enable-agent --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl --with-ldap --with-libxml2

make && make install

创建并导入数据(注意顺序)

mysql -e "create database zabbix default charset utf8;"

mysql -e "grant all on zabbix.* to [email protected] identified by ‘zabbix‘;"

mysql -uzabbix -pzabbix zabbix<./database/mysql/schema.sql

mysql -uzabbix -pzabbix zabbix<./database/mysql/images.sql

mysql -uzabbix -pzabbix zabbix<./database/mysql/data.sql

mkdir /var/log/zabbix

chown -R zabbix.zabbix /var/log/zabbix

软链

ln -s /usr/local/zabbix/etc/ /etc/zabbix

ln -s /usr/local/zabbix/bin/* /usr/bin/

ln -s /usr/local/zabbix/sbin/* /usr/sbin/

ln -s /usr/local/zabbix/sbin/* /usr/local/sbin/

ln -s /usr/local/zabbix/bin/* /usr/local/bin/

cp misc/init.d/fedora/core/zabbix_* /etc/init.d/

cp -r frontends/php/ /usr/local/nginx/html/zabbix/

chmod 755 /etc/init.d/zabbix_*

sed -i "[email protected]=/usr/[email protected]=/usr/local/[email protected]" /etc/init.d/zabbix_server

sed -i "[email protected]=/usr/[email protected]=/usr/local/[email protected]“  /etc/init.d/zabbix_agentd

sed -i "[email protected]#[email protected][email protected]" /etc/zabbix/zabbix_server.conf

sed -i "[email protected]# [email protected][email protected]" /etc/zabbix/zabbix_server.conf

sed -i "[email protected][email protected]=127.0.0.1,[email protected]" /etc/zabbix/zabbix_agentd.conf

sed -i "[email protected][email protected]=$IP:[email protected]" /etc/zabbix/zabbix_agentd.conf

sed -i "[email protected]/[email protected]/log/zabbix/[email protected]" /etc/zabbix/zabbix_agentd.conf

sed -i "[email protected]^# [email protected]=1\[email protected]" /etc/zabbix/zabbix_agentd.conf

cp -r frontends/php/ /usr/local/nginx/html/zabbix/

/etc/init.d/zabbix_server start

sed -i ‘s/max_execution_time = 30/max_execution_time = 300/‘ /etc/php.ini

sed -i ‘s/max_input_time = 60/max_input_time = 300/‘ /etc/php.ini

sed -i ‘s/post_max_size = 8M/post_max_size = 16M/‘ /etc/php.ini

sed -i ‘s/;date.timezone =/date.timezone = PRC/‘ /etc/php.ini

sed -i ‘s/;always_populate_raw_post_data/always_populate_raw_post_data/‘ /etc/php.ini

修改zabbix_server.conf参数:

SourceIP=192.168.8.111

DBName=zabbix          数据库名称

DBUser=zabbix          连接数据库的账号,与Mysql授权账号对应

DBPassword=zabbix  连接数据库的密码,与Mysql授权账号的密码对应

修改zabbix_agentd.conf参数:

Server=192.168.8.111

ServerActive=10.10.1.98

Hostname=Zabbix1  #zabbix2修改为自己的hostname

将server1和server2的监控在web界面中添加

安装keepalived实现主从切换

yum install keepalived

创建keepalived状态检查脚本:

vim /etc/keepalived/keepalived_check.sh

#!/bin/bash

mysql_check=`ps -C mysqld --no-header | wc -l`

httpd_check=`ps -C httpd  --no-header | wc -l`

case $1 in

mysqld)

if [ $mysql_check -eq 0 ];then

service mysqld start

sleep 3

if [ $mysql_check -eq 0 ];then

service keepalived stop

fi

fi

;;

httpd)

if [ $httpd_check -eq 0 ];then

service nginx start

sleep 3

if [ $httpd_check -eq 0 ];then

service keepalived stop

fi

fi

;;

esac

chmod 755 /etc/keepalived/keepalived_check.sh

创建zabbix重启脚本(主从切换的时候执行此脚本,必须在keepalived配置文件中增加此脚本,否则,主从切换后,web查看host的状态是错误,但是后台可以获得数据)

vi /etc/keepalived/keepalived_zabbix.sh

#!/bin/bash

sleep 60

/etc/init.d/zabbix_server restart

chmod 777 /etc/keepalived/keepalived_zabbix.sh

以上内容server1和server2配置均相同

修改keepalived配置文件(注意zabbix1/zabbix2的状态和优先级)

vim /etc/keepalived/keepalived.conf

! Configuration File for keepalived

global_defs {

notification_email {

[email protected]

[email protected]             #设置报警地址,可以设置多个,每行1个

[email protected]         #需安装sendmail,并开启邮件报警

}

notification_email_from [email protected]

smtp_server 127.0.0.1           #设置SMTP Server地址

smtp_connect_timeout 30

router_id okooo

}

vrrp_script mysqld                                            #vrrp脚本命名

{

script "/etc/keepalived/keepalived_check.sh mysqld"   #要执行的脚本

interval 2      #脚本指定间隔,秒

weight -30     #优先级(如果脚本执行结果为0,并且weight配置的值大于0,则优先级相应的增加,如果脚本执行结果非0,并且weight配置的值小于0,则优先级相应的减少)

fall   2     #尝试两次都成功才成功

rise   2     #尝试两次都失败才失败

}

vrrp_script httpd

{

script "/etc/keepalived/keepalived_check.sh nginx"

interval 2

weight -20

fall   2     #尝试两次都成功才成功

rise   2     #尝试两次都失败才失败

}

vrrp_instance zabbix_server{

state MASTER/BACKUP                   #指定Keepalived的角色,MASTER为主,BACKUP为备

interface eth0                     #绑定真实的物网卡

virtual_router_id 1          #虚拟路由编号,主备要一致

priority 150/100                           #定义优先级,数字越大,优先级越高,主DR必须大于备用DR

advert_int 1                          #检查间隔,默认为1s

authentication {

auth_type PASS             #认证方式,PASS或AH两种

auth_pass okooo           #认证密码,主备服务器要一致

}

track_script                   #调用上面定义的检查脚本

{

mysqld

}

track_script

{

nginx

}

virtual_ipaddress {

192.168.8.111                 #定义虚拟IP(VIP),可多设,每行一个

}

notify_master "/etc/keepalived/keepalived_zabbix.sh" #指定当切换到master时,执行的脚本

notify_backup "/etc/keepalived/keepalived_zabbix.sh" #指定当切换到backup时,执行的脚本

notify_fault "/sbin/service zabbix_server stop"     #故障时执行的脚本

}

/etc/init.d/keepalived start

chkconfig keepalived on

Mysq主主同步

修改数据库配置文件(zabbix1和zabbix2的server-id不同)

[[email protected] ~]# cat /etc/my.cnf

[mysqld]

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

user=mysql

default-storage-engine=TokuDB

# Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0

server-id=2                            #(zabbix2 设置为2)

log-bin=mysql-bin                      # 开启bin日志

expire_logs_days=365                   # bin日志过期清理时间

max_binlog_size=314572800              # 每个bin日志大小

auto-increment-increment = 2           #字段变化增量值

auto-increment-offset = 1              #初始字段ID为1

slave-skip-errors = all                #忽略所有复制产生的错误

binlog-do-db=zabbix                    # 同步原数据库名

binlog-ignore-db=mysql                 # 不同步数据库名

binlog-ignore-db=test

binlog-ignore-db=performance_schema

binlog-ignore-db=information_schema

replicate-do-db=zabbix

replicate-ignore-db=mysql

replicate-ignore-db=test

replicate-ignore-db=performance_schema

replicate-ignore-db=information_schema

[mysqld_safe]

thp-setting=never

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

建立同步数据同步账号

server1

grant replication slave on *.* to ‘tongbu‘@‘192.168.8.118‘ identified by ‘[email protected]‘;

flush privileges;

server2

grant replication slave on *.* to ‘tongbu‘@‘192.168.8.117‘ identified by ‘[email protected]‘;

flush privileges;

mysql> use mysql

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

Database changed

mysql>  select user,host from user;

+--------+---------------+

| user   | host          |

+--------+---------------+

| root   | 127.0.0.1     |

| tongbu | 192.168.8.117 |

| root   | ::1           |

|        | localhost     |

| root   | localhost     |

| zabbix | localhost     |

|        | zabbix02      |

| root   | zabbix02      |

+--------+---------------+

8 rows in set (0.00 sec)

zabbix02

mysql> show master status;

+------------------+----------+--------------+--------------------------------------------------+-------------------+

| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB                                 | Executed_Gtid_Set |

+------------------+----------+--------------+--------------------------------------------------+-------------------+

| mysql-bin.000001 |     3305 | zabbix       | mysql,test,performance_schema,information_schema |                   |

+------------------+----------+--------------+--------------------------------------------------+-------------------+

1 row in set (0.00 sec)

mysql>  change master to master_host=‘192.168.8.117‘, master_user=‘tongbu‘, master_password=‘[email protected]‘, master_log_file=‘mysql-bin.000001‘,master_log_pos=4290;

mysql> start  slave;

Query OK, 0 rows affected (0.01 sec)

mysql>  show slave status\G

*************************** 1. row ***************************

Slave_IO_State: Waiting for master to send event

Master_Host: 192.168.8.117

Master_User: tongbu

Master_Port: 3306

Connect_Retry: 60

Master_Log_File: mysql-bin.000001

Read_Master_Log_Pos: 76847

Relay_Log_File: zabbix02-relay-bin.000002

Relay_Log_Pos: 72840

Relay_Master_Log_File: mysql-bin.000001

Slave_IO_Running: Yes

Slave_SQL_Running: Yes

Replicate_Do_DB: zabbix

Replicate_Ignore_DB: mysql,test,performance_schema,information_schema

Replicate_Do_Table:

Replicate_Ignore_Table:

zabbix01

mysql> show master status;

+------------------+----------+--------------+--------------------------------------------------+-------------------+

| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB                                 | Executed_Gtid_Set |

+------------------+----------+--------------+--------------------------------------------------+-------------------+

| mysql-bin.000001 |     4290 | zabbix       | mysql,test,performance_schema,information_schema |                   |

+------------------+----------+--------------+--------------------------------------------------+-------------------+

1 row in set (0.00 sec)

mysql> change master to master_host=‘192.168.8.118‘, master_user=‘tongbu‘, master_password=‘[email protected]‘, master_log_file=‘mysql-bin.000001‘,master_log_pos=3305;

Query OK, 0 rows affected, 2 warnings (0.01 sec)

mysql> start  slave;

Query OK, 0 rows affected (0.00 sec)

mysql> show slave status\G

*************************** 1. row ***************************

Slave_IO_State: Waiting for master to send event

Master_Host: 192.168.8.118

Master_User: tongbu

Master_Port: 3306

Connect_Retry: 60

Master_Log_File: mysql-bin.000001

Read_Master_Log_Pos: 127078

Relay_Log_File: zabbix01-relay-bin.000002

Relay_Log_Pos: 124056

Relay_Master_Log_File: mysql-bin.000001

Slave_IO_Running: Yes

Slave_SQL_Running: Yes

Replicate_Do_DB: zabbix

Replicate_Ignore_DB: mysql,test,performance_schema,information_schema

Replicate_Do_Table:

Replicate_Ignore_Table:

Replicate_Wild_Do_Table:

重启服务:

# /etc/init.d/nginx restart

# /etc/init.d/zabbix_agentd restart

# /etc/init.d/zabbix_server restart

时间: 2024-10-09 22:09:40

zabbix 3.2高可用的相关文章

【MySQL】DNS与MHA/ZABBIX构建的高可用MySQL

MySQL实例组与DNS和MHA/ZABBIX架构示意图: DNS搭建:http://www.cnblogs.com/jiangxu67/p/4801230.html MHA分析:http://www.cnblogs.com/jiangxu67/p/4487248.html 总体思想是前端应用和数据库通过域名解析,域名通过Bind服务的数据库保存,MHA和ZABBIX分别对实例群集中的主库和从库进行检测和管理. MHA: 只对主库进行检测,当有mha_manager管理的主库出现异常时,按照自身

pacemaker+corosync实现zabbix高可用集群

一.pacemaker 是什么 1.pacemaker 简单说明 2.pacemaker 由来 二.pacemaker 特点 三.pacemaker 内部结构 1.群集组件说明: 2.功能概述 四.centos6.x+pacemaker+corosync实现zabbix高可用 1.环境说明 五.安装pacemaker和corosync(各个节点均要运行) 1.前提条件各个节点完成主机解析工作. 2.各个节点的时间同步 3.各个节点完成互信工作 4.关闭防火墙与SELinux 5.安装pacema

Zabbix高可用,实现zabbix的无缝切换,无故障时间

作者:骚年有梦 联系方式:[email protected] zabbix高可用设计目标: 1.keepalived服务优先级选择切换机制:对于zabbix服务器来说,只要zabbix存活和mysql存活,就能够正常记录数据,不会丢失数据,php和nginx只是web页面的访问而已,所以我在这里定义mysql和zabbix为主要服务,php和nginx为次要服务,为了实现主要服务存在,次要服务挂了:次要服务器存在,主要服务器挂了,keepalived会优先选择主要服务存在的一方作为Master,

Zabbix实战-简易教程(6)--Server端高可用

3.4 server前端高可用 至此,单台Zabbix server环境已经搭建完成,为了达到高可用效果,我们需要通过2台服务器之间通过HA软件进行探测,一旦检测到主的server挂掉后,从的server会立即顶替.我们这里采用keepalived软件来实现. 3.4.1 Keepalived安装 直接yum安装即可 Yum install keepalived 3.4.2 keepalived配置 Master上的keepalived配置如下: [Master] cat /etc/keepal

MySQL(三):MHA实现MySQL主从架构中主服务器的高可用,zabbix完成manager重启

MHA(Master High Availability)是目前在MySQL高可用方面相对成熟的一个解决方案,MHA在监控到master节点故障时,会提升其中拥有最新数据的slave节点成为新的master节点,在此期间,MHA会通过于其它从节点获取额外信息来避免一致性方面的问题.MHA还提供了master节点的在线切换功能. MHA 服务有两种角色,MHA Manager(管理节点)和 MHA Node(数据节点): MHA Manager:通常单独部署在一台独立机器上管理多个 master/

inotify+rsync+mysql主主复制+keepalived实现zabbix高可用

思路:主备机通过inotify+rsync实现文件同步,通过mysql主主复制实现数据同步,同一时刻只有一台服务器能对外提供zabbix服务,web端登陆虚ip访问,被监控主机通过配置虚ip来完成监控. 配置: 主机 ip 操作系统 zabbix版本 mysql版本 inotify版本 rsync版本 备注 zabbix-server01 172.27.9.80 Centos7.3.1611 zabbix_server (Zabbix) 3.4.10 5.7.22 3.14 3.1.2 关闭防火

zabbix高可用搭建--基础(1)

总架构:2016年开始接触zabbix,因为监控数据的增加以及后期的可扩展性,着手搭建zabbix的高可用.因本人之前是做网络工作,根本不知道php.nginx.keepalive.lvs.mariadb等,搭建高可用用时2个周时间才最终完成.以下是一名网络工程师的搭建心得:一.搭建成功的秘诀:1.查看各系统的日志信息,然后百度寻找解决办法:2.购买相关书籍<zabbix分布式监控系统>.<zabbix最佳实践>:3.购买相关视频,可以从淘宝上看看,其他网络教育平台费用有点高:4.

单表60亿记录等大数据场景的MySQL优化和运维之道 | 高可用架构(转)

转自http://www.php1.cn/Content/DanBiao_60_YiJiLuDengDaShuJuChangJingDe_MySQL_YouHuaHeYunWeiZhiDao_%7C_GaoKeYongJiaGou.html, 更多详细资料请参看原文 此文是根据杨尚刚在[QCON高可用架构群]中,针对MySQL在单表海量记录等场景下,业界广泛关注的MySQL问题的经验分享整理而成,转发请注明出处. 杨尚刚,美图公司数据库高级DBA,负责美图后端数据存储平台建设和架构设计.前新浪高

DRBD+Heartbeat+Mysql 高可用实战

实验环境:Centos 6.7_64位 服务器: Master节点:dm1 IP地址:10.0.0.61(eth0) 192.168.3.150(eth1,心跳) Slave节点:dm2  Ip地址:10.0.0.62(eth0) 192.168.3.160(eth1,心跳) VIP地址:192.168.0.180 一.DRBD环境搭建 DRBD(DistributedReplicatedBlockDevice)是一个基于块设备级别在远程服务器直接同步和镜像数据的软件,用软件实现的.无共享的.服