mysql集群之keepalived简单搭建_MySQL
1安装必须的相关包
yum -y install kernel-devel openssl* popt popt-devel
2下载安装
wget http://www.keepalived.org/software/keepalived-1.2.9.tar.gz tar -xf keepalived-1.2.9.tar.gz mkdir /usr/local/keepalived cd ~/ keepalived-1.2.9 ./configure --prefix=/usr/local/keepalived/ make && make install cp /usr/local/keepalived/sbin/keepalived /usr/sbin/ cp /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig cp /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/init.d/ chmod +x /etc/init.d/keepalived mkdir /etc/keepalived cp /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived
3修改配置文件如下
[root@M128 ~]# vim /etc/keepalived/keepalived.conf global_defs { notification_email { [email protected] } notification_email_from [email protected] smtp_server smtp.126.com # 邮件服务器地址 smtp_connect_timeout 30 # 连接超时时间 router_id LVS_Master } vrrp_script chk_http_port { script "/etc/keepalived/check_haproxy.sh" # haproxy运行检测脚本[haproxy宕掉重启haproxy服务] interval 5 # 脚本执行间隔 weight -5 # 执行脚本后优先级变更:5表示优先级+5;-5则表示优先级-5 } vrrp_instance VI_A { state MASTER # 主上此值为MASTER,从上为BACKUP interface eth0 virtual_router_id 50 # 此值主从必须一致 priority 100 advert_int 1 authentication { # authentication两个参数值,主从也必须一致 auth_type PASS auth_pass yiban } track_script { chk_http_port } virtual_ipaddress { 192.168.78.220 } }
5启动keepalived
确保网络正常
service network restart (线上不要这么做)
/etc/init.d/keepalived start
查看结果
ip a

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











Scenario description for nodes to completely evacuate from ProxmoxVE and rejoin the cluster. When a node in the ProxmoxVE cluster is damaged and cannot be repaired quickly, the faulty node needs to be kicked out of the cluster cleanly and the residual information must be cleaned up. Otherwise, new nodes using the IP address used by the faulty node will not be able to join the cluster normally; similarly, after the faulty node that has separated from the cluster is repaired, although it has nothing to do with the cluster, it will not be able to access the web management of this single node. In the background, information about other nodes in the original ProxmoxVE cluster will appear, which is very annoying. Evict nodes from the cluster. If ProxmoxVE is a Ceph hyper-converged cluster, you need to log in to any node in the cluster (except the node you want to delete) on the host system Debian, and run the command

PHP database optimization method in high concurrency environment With the rapid development of the Internet, more and more websites and applications need to face high concurrency challenges. In this case, database performance optimization becomes particularly important, especially for systems that use PHP as the back-end development language. This article will introduce some database optimization methods in PHP high concurrency environment and give corresponding code examples. Using connection pooling In a high-concurrency environment, frequent creation and destruction of database connections may cause performance bottlenecks. Therefore, using connection pooling can

In today's cloud computing era, containerization technology has become one of the most popular technologies in the open source world. The emergence of Docker has made cloud computing more convenient and efficient, and has become an indispensable tool for developers and operation and maintenance personnel. The application of multi-node cluster technology is widely used based on Docker. Through multi-node cluster deployment, we can utilize resources more efficiently, improve reliability and scalability, and also be more flexible in deployment and management. Next, we will introduce how to use Docker to

Workerman is a high-performance PHPSocket framework that allows PHP to handle asynchronous network communication more efficiently. In Workerman's documentation, there are detailed instructions and code examples on how to implement a server cluster. In order to implement a server cluster, we first need to clarify the concept of a server cluster. A server cluster connects multiple servers to a network to improve system performance, reliability and scalability by sharing loads and resources. In Workerman, you can use the following two methods

Common clusters in PHP include LAMP cluster, Nginx cluster, Memcached cluster, Redis cluster and Hadoop cluster. Detailed introduction: 1. LAMP cluster. LAMP refers to a combination of Linux, Apache, MySQL and PHP. It is a common PHP development environment. In a LAMP cluster, multiple servers run the same application and are balanced through a load balancer. Requests are distributed to different servers; 2. Nginx cluster, Nginx is a high-performance web server and so on.

How to use MongoDB to implement data clustering and load balancing functions Introduction: In today's big data era, the rapid growth of data volume has put forward higher requirements for database performance. In order to meet these requirements, data clustering and load balancing have become indispensable technical means. As a mature NoSQL database, MongoDB provides rich functions and tools to support data clustering and load balancing. This article will introduce how to use MongoDB to implement data clustering and load balancing functions, and provide specific code

How to implement distributed containers and clusters in PHP microservices In the development of today's Internet applications and systems, microservice architecture has become a popular design pattern. In the microservice architecture, distributed containers and clusters are indispensable components. This article will introduce how to implement distributed containers and clusters in PHP microservices and provide specific code examples. 1. The concept and implementation of distributed containers Distributed containers refer to a way of deploying various components of an application on different servers and working together through network communication. exist

Linux, the full name of GNU/Linux, is a Unix-like operating system that can be used and spread freely. It is a multi-user, multi-task, multi-thread, and multi-CPU operating system based on POSIX. So what is a Linux server cluster system? What are its main components? The following is an introduction to the specific content. The Linux server cluster system is a distributed computing environment based on the Linux operating system. It is composed of multiple independent server nodes. These nodes are connected to each other through high-speed networks to collaboratively complete various computing tasks. The cluster system has high reliability, high performance and scalability, and can provide users with stable and powerful service support. Through the cluster system, servers can be effectively divided into
