Table of Contents
1、单管理节点MySQL集群和多管理节点MySQL集群
2、多管理节点MySQL集群配置
        1)修改管理节点配置
        2)修改数据节点配置
        3)修改SQL节点配置
3、多管理节点MySQL集群配置启动和测试
Home Database Mysql Tutorial 项目进阶 之 集群环境搭建(三)多管理节点MySQL集群

项目进阶 之 集群环境搭建(三)多管理节点MySQL集群

Jun 01, 2016 pm 01:17 PM
blog solution project

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 nodeHostName=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 nodeHostName=192.168.24.43 # Directory for management node log files DataDir=C:/mysql/bin/cluster-logs
Copy after login

        即修改之后的config.ini存在多个ndb_mgmd管理节点的相关配置。

        2)修改数据节点配置

        打开数据节点C:/mysqlcluster/datanode/mysql下的my.ini文件,将其中mysql_cluster的相关配置修改为如下内容:

[mysql_cluster]# Optionsfor data node process:#location of management serverndb-connectstring=192.168.24.16,192.168.24.43
Copy after login

        即修改之后的mysql_cluster节点下的ndb-connectstring对应多个管理节点的IP地址。(如果管理节点修改了服务端口号,则需要添加相应的端口号,例如:192.168.24.16:3306,192.168.24.43:3306)

        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
Copy after login

        即修改之后的mysqld节点下的ndb-connectstring对应多个管理节点的IP地址。

3、多管理节点MySQL集群配置启动和测试

        多管理节点MySQL集群的启动和测试与单管理节点MySQL集群的启动和测试没有区别,可以参考上一篇文章中的相关介绍。需要注意的是在启动MySQL集群的时候,除第一个启动的管理节点以外,其他管理节点会出现如下图所示的警告:


        以上警告的意思是节点1和3,2和4的arbitrator在一台主机上,可能引起整个集群失败,这个警告可以不用放在心上继续操作即可。
        到目前为止,咱们的多管理节点的MySQL集群就搭建完毕了,这样的集群的在正常情况下可以满足一般需求,但并不是说它就真的无懈可击,它从架构和实用度来讲还可以进行更多的优化和完善,具体都有哪些可以优化和完善的地方呢?敬请期待接下来的文章!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Solution for Win11 unable to install Chinese language pack Solution for Win11 unable to install Chinese language pack Mar 09, 2024 am 09:15 AM

Win11 is the latest operating system launched by Microsoft. Compared with previous versions, Win11 has greatly improved the interface design and user experience. However, some users reported that they encountered the problem of being unable to install the Chinese language pack after installing Win11, which caused trouble for them to use Chinese in the system. This article will provide some solutions to the problem that Win11 cannot install the Chinese language pack to help users use Chinese smoothly. First, we need to understand why the Chinese language pack cannot be installed. Generally speaking, Win11

An effective solution to solve the problem of garbled characters caused by Oracle character set modification An effective solution to solve the problem of garbled characters caused by Oracle character set modification Mar 03, 2024 am 09:57 AM

Title: An effective solution to solve the problem of garbled characters caused by Oracle character set modification. In Oracle database, when the character set is modified, the problem of garbled characters often occurs due to the presence of incompatible characters in the data. In order to solve this problem, we need to adopt some effective solutions. This article will introduce some specific solutions and code examples to solve the problem of garbled characters caused by Oracle character set modification. 1. Export data and reset the character set. First, we can export the data in the database by using the expdp command.

Can AI conquer Fermat's last theorem? Mathematician gave up 5 years of his career to turn 100 pages of proof into code Can AI conquer Fermat's last theorem? Mathematician gave up 5 years of his career to turn 100 pages of proof into code Apr 09, 2024 pm 03:20 PM

Fermat's last theorem, about to be conquered by AI? And the most meaningful part of the whole thing is that Fermat’s Last Theorem, which AI is about to solve, is precisely to prove that AI is useless. Once upon a time, mathematics belonged to the realm of pure human intelligence; now, this territory is being deciphered and trampled by advanced algorithms. Image Fermat's Last Theorem is a "notorious" puzzle that has puzzled mathematicians for centuries. It was proven in 1993, and now mathematicians have a big plan: to recreate the proof using computers. They hope that any logical errors in this version of the proof can be checked by a computer. Project address: https://github.com/riccardobrasca/flt

Oracle NVL function common problems and solutions Oracle NVL function common problems and solutions Mar 10, 2024 am 08:42 AM

Common problems and solutions for OracleNVL function Oracle database is a widely used relational database system, and it is often necessary to deal with null values ​​during data processing. In order to deal with the problems caused by null values, Oracle provides the NVL function to handle null values. This article will introduce common problems and solutions of NVL functions, and provide specific code examples. Question 1: Improper usage of NVL function. The basic syntax of NVL function is: NVL(expr1,default_value).

A closer look at PyCharm: a quick way to delete projects A closer look at PyCharm: a quick way to delete projects Feb 26, 2024 pm 04:21 PM

Title: Learn more about PyCharm: An efficient way to delete projects. In recent years, Python, as a powerful and flexible programming language, has been favored by more and more developers. In the development of Python projects, it is crucial to choose an efficient integrated development environment. As a powerful integrated development environment, PyCharm provides Python developers with many convenient functions and tools, including deleting project directories quickly and efficiently. The following will focus on how to use delete in PyCharm

Implementing Machine Learning Algorithms in C++: Common Challenges and Solutions Implementing Machine Learning Algorithms in C++: Common Challenges and Solutions Jun 03, 2024 pm 01:25 PM

Common challenges faced by machine learning algorithms in C++ include memory management, multi-threading, performance optimization, and maintainability. Solutions include using smart pointers, modern threading libraries, SIMD instructions and third-party libraries, as well as following coding style guidelines and using automation tools. Practical cases show how to use the Eigen library to implement linear regression algorithms, effectively manage memory and use high-performance matrix operations.

Common causes and solutions for Chinese garbled characters in MySQL installation Common causes and solutions for Chinese garbled characters in MySQL installation Mar 02, 2024 am 09:00 AM

Common reasons and solutions for Chinese garbled characters in MySQL installation MySQL is a commonly used relational database management system, but you may encounter the problem of Chinese garbled characters during use, which brings trouble to developers and system administrators. The problem of Chinese garbled characters is mainly caused by incorrect character set settings, inconsistent character sets between the database server and the client, etc. This article will introduce in detail the common causes and solutions of Chinese garbled characters in MySQL installation to help everyone better solve this problem. 1. Common reasons: character set setting

Revealing the method to solve PyCharm key failure Revealing the method to solve PyCharm key failure Feb 23, 2024 pm 10:51 PM

PyCharm is a powerful Python integrated development environment that is widely loved by developers. However, sometimes we may encounter key invalidation problems when using PyCharm, resulting in the inability to use the software normally. This article will reveal the solution to PyCharm key failure and provide specific code examples to help readers quickly solve this problem. Before we start solving the problem, we first need to understand why the key is invalid. PyCharm key failure is usually due to network problems or the software itself

See all articles