项目进阶 之 集群环境搭建(3)多管理节点MySQL集群
项目进阶 之 集群环境搭建(三)多管理节点MySQL集群 上次的博文项目进阶 之 集群环境搭建(二)MySQL集群中,我们搭建了一个基础的MySQL集群,这篇博客咱们继续讲解MySQL集群的相关内容,同时针对上一篇遗留的问题提出一个解决方法。 1、单管理节点MySQL集群
项目进阶 之 集群环境搭建(三)多管理节点MySQL集群上次的博文项目进阶 之 集群环境搭建(二)MySQL集群中,我们搭建了一个基础的MySQL集群,这篇博客咱们继续讲解MySQL集群的相关内容,同时针对上一篇遗留的问题提出一个解决方法。
1、单管理节点MySQL集群和多管理节点MySQL集群
上一篇的博客中,我们搭建的MySQL集群架构中,只存在一个管理节点,这样搭建的集群可以用如下所示的结构表示。
仔细分析上图就会发现,上图所示的单管理节点MySQL集群存在当唯一的管理节点由于网络、断电、压力过大等各种原因宕机后,数据节点和SQL节点将会各自为战,成为一盘散沙。这样搭建的MySQL集群可用性较低,所以我们要将单管理节点集群改变成如下图所示的多管理节点集群。
在上图的多管理节点MySQL集群中,由于管理节点存在多个,所以当其中的某一个管理节点出现宕机之后,其他的管理节点自动接过MySQL集群的管理权限,保证MySQL集群的正常运行。
2、多管理节点MySQL集群配置
多管理节点MySQL的配置非常简单,仅需要修改之前的博文中提高的三种节点的三个地方。1)修改管理节点配置
打开管理节点C:\mysql\bin下的config.ini文件,将其中ndb_mgmd的相关配置修改为如下内容:[ndb_mgmd] # Management process options: # Hostname or IP address of management node HostName=192.168.24.16 # Directory for management node log files DataDir=C:/mysql/bin/cluster-logs [ndb_mgmd] # Management process options: # Hostname or IP address of management node HostName=192.168.24.43 # Directory for management node log files DataDir=C:/mysql/bin/cluster-logs
2)修改数据节点配置
打开数据节点C:\mysqlcluster\datanode\mysql下的my.ini文件,将其中mysql_cluster的相关配置修改为如下内容:[mysql_cluster] # Optionsfor data node process: #location of management server ndb-connectstring=192.168.24.16,192.168.24.43
3)修改SQL节点配置
与修改数据节点类似,修改SQL节点配置需要打开C:\mysqlcluster\sqlnode\mysql下的my.ini文件,将其中mysqld的相关配置修改为如下内容:[mysqld] # Options for mysqld process: # run NDB storage engine ndbcluster # location of management server ndb-connectstring=192.168.24.16,192.168.24.43
3、多管理节点MySQL集群配置启动和测试
多管理节点MySQL集群的启动和测试与单管理节点MySQL集群的启动和测试没有区别,可以参考上一篇文章中的相关介绍。需要注意的是在启动MySQL集群的时候,除第一个启动的管理节点以外,其他管理节点会出现如下图所示的警告:
以上警告的意思是节点1和3,2和4的arbitrator在一台主机上,可能引起整个集群失败,这个警告可以不用放在心上继续操作即可。
到目前为止,咱们的多管理节点的MySQL集群就搭建完毕了,这样的集群的在正常情况下可以满足一般需求,但并不是说它就真的无懈可击,它从架构和实用度来讲还可以进行更多的优化和完善,具体都有哪些可以优化和完善的地方呢?敬请期待接下来的文章!

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

The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

The process of starting MySQL in Docker consists of the following steps: Pull the MySQL image to create and start the container, set the root user password, and map the port verification connection Create the database and the user grants all permissions to the database

Laravel is a PHP framework for easy building of web applications. It provides a range of powerful features including: Installation: Install the Laravel CLI globally with Composer and create applications in the project directory. Routing: Define the relationship between the URL and the handler in routes/web.php. View: Create a view in resources/views to render the application's interface. Database Integration: Provides out-of-the-box integration with databases such as MySQL and uses migration to create and modify tables. Model and Controller: The model represents the database entity and the controller processes HTTP requests.

I encountered a tricky problem when developing a small application: the need to quickly integrate a lightweight database operation library. After trying multiple libraries, I found that they either have too much functionality or are not very compatible. Eventually, I found minii/db, a simplified version based on Yii2 that solved my problem perfectly.

The key to installing MySQL elegantly is to add the official MySQL repository. The specific steps are as follows: Download the MySQL official GPG key to prevent phishing attacks. Add MySQL repository file: rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm Update yum repository cache: yum update installation MySQL: yum install mysql-server startup MySQL service: systemctl start mysqld set up booting

Article summary: This article provides detailed step-by-step instructions to guide readers on how to easily install the Laravel framework. Laravel is a powerful PHP framework that speeds up the development process of web applications. This tutorial covers the installation process from system requirements to configuring databases and setting up routing. By following these steps, readers can quickly and efficiently lay a solid foundation for their Laravel project.

MySQL and phpMyAdmin are powerful database management tools. 1) MySQL is used to create databases and tables, and to execute DML and SQL queries. 2) phpMyAdmin provides an intuitive interface for database management, table structure management, data operations and user permission management.

Installing MySQL on CentOS involves the following steps: Adding the appropriate MySQL yum source. Execute the yum install mysql-server command to install the MySQL server. Use the mysql_secure_installation command to make security settings, such as setting the root user password. Customize the MySQL configuration file as needed. Tune MySQL parameters and optimize databases for performance.
