Skip to main content
  • Place orders quickly and easily
  • View orders and track your shipping status
  • Create and access a list of your products
  • Manage your Dell EMC sites, products, and product-level contacts using Company Administration.

如何安裝和設定 MySQL 叢集

Summary: Dell TechCenter 上的 Dell 作業系統和應用程式解決方案 - Project Sputnik、Microsoft Windows、Red Hat Linux、SUSE、Ubuntu 等等

This article may have been automatically translated. If you have any feedback regarding its quality, please let us know using the form at the bottom of this page.

Article Content


Symptoms

如何安裝和設定 Windows 適用的 MySQL 叢集?

適用於:

Window64位作業系統

作者:

Carthik Annayan

問題:

如何安裝和配置 Windows MySQL 叢集?

解決方案:

如何實作 MySQL 叢集?我們現在將討論實現 MySQL 集群的步驟。在 MySQL 集群的典型 HA 環境中,我們至少需要 6 台伺服器在 MySQL 集群的每一層構建 HA。部署 MySQL 集群的最佳部分是它很容易,並且不需要很多先決條件。您只需要幾台伺服器、操作系統和幾個交換機。

節點的名稱如下:-

伺服器節點:- Servernode1.example.com 192.168.0.10、Servernode2.example.com 192.168.0.20

數據節點:- Datanode1.example.com 192.168.0.30、Datanode2.example.com 192.168.0.40

管理伺服器節點:- Mgmntnode1.example.com 192.168.0.50、Mgmntnode2.example.com 192.168.0.60

網路先決條件:-
  • 專用 >= 1GB/s 網路
  • 防止網路故障 (NIC x 2、搭接)
  • 使用專用網路進行叢集通訊
  • 管理節點沒有安全性層 (允許遠端關機....)
  • 僅啟用來自群集節點和管理員的埠 1186 訪問

儲存層 (資料節點):
  •  一個資料節點可以使用 8 個核心
  • CPU:2 個 x4 核心
  • 記憶體:您需要多少 10GB 的數據集將需要 20GB 的 RAM(由於冗餘)
  • 然後,每個節點將需要 2 個 x 10 / #of 個數據節點。(2 個資料節點 →10GB 的 RAM → 16GB 的 RAM 就可以了)
  • 磁碟空間:10 倍資料記憶體 + 備份空間 + 表空間 (如果是磁碟資料表)

SQL 層 (MySQL 伺服器):
  • CPU:2 – 16 核心
  • RAM:沒那麼重要 – 4GB 足夠(取決於連接和緩衝區)
Mgmntnode2 節點為選用。在管理節點提供HA也很重要,因為管理節點是管理所有數據節點和伺服器節點的中央控制台。但是,對於此實現,我們將僅考慮一個管理節點和MySQL Cluster 7.2的實現。

伺服器準備就緒後,第一個步驟是從下列位置下載 MySQL 叢集套裝 (http://www.mysql.com/downloads/cluster )。下載最符合您需求的套裝。MSI 或 zip 格式。對於此實現,我使用了 zip 格式。MySQL 叢集 (作業系統、架構) 的支援狀態可從 MySQL 支援矩陣 下一步是解壓縮下載的內容。

將 Zip 封存的內容解壓縮到伺服器節點上的「c:\mysql\cluster」在每個節點上執行此步驟,或將 zip 檔案下載到一個節點,然後將內容複製到其他節點。

若要從命令列存取可執行檔,請將「c:\mysql\cluster\bin」新增至 PATH 環境變數。

現在,在管理節點 (192.168.0.50) 中的以下資料夾「c:\mysql\cluster」下建立config.ini檔。

範例config.ini檔案

config.ini

[ndbd default]

noofreplicas=2

DataDir=c:/mysql/bin/cluster-data # 每個資料節點檔案

的目錄 DataMemory=80M

IndexMemory=18M

[ndb_mgmd]

hostname=192.168.0.50

NodeId = 1

DataDir=c:/mysql/bin/cluster-logs #Directory 管理節點記錄檔

[ndbd] # 資料節點 1
主機名稱 = 192.168.0.30

節點 Id=2

[ndbd] # 資料節點 2

主機名稱 = 192.168.0.40

節點 ID = 3

[mysqld] # 伺服器節點 1

主機名稱 = 192.168.0.10

節點 Id=101

[mysqld] # 伺服器節點 2


主機名 = 192.168.0.20

節點 Id=102

每個數據節點的 My.ïni 檔僅包含有關連接字串的資訊,即管理節點的 IP 位址。my.cnf 檔案位於 「c:\mysql\my.ini」
my.ini (Data Node1)

[mysql_cluster]

Ndb-connectstring=192.168.16.50

將相同的內容也放在 DataNode2 中。


最後,my.ini位於 ServerNode 的“c:\mysql\my.ini”中的 MySQL 伺服器節點內容。

[mysqld]

ndb-nodeid=101 ndbcluster

ndb-connectstring=192.168.16.50:1186 # 管理伺服器

的位置 連接埠 = 3306

Default-storage-engine=ndbcluster

組態檔案就緒後,節點必須按照下列順序啟動:管理節點、資料節點和 SQL Server 節點。

執行下列其中一項的命令如下所示。

管理節點 (192.168.0.50):-

ndb_mgmd -f /var/lib/mysql-cluster/config.ini --configdir=/var/lib/mysql-cluster/ --initial

資料節點 (192.168.0.30, 192.168.0.40):-

NDBD -C <管理節點 IP 位址>:1186 –初始

應在每個資料節點上發出此命令。

SQL 伺服器節點(192.168.0.10,192.168.0.20):-

C:\mysql\bin> mysqld –主控台

此命令應在每個 MySQL 伺服器節點上發出。

最後,若要檢查叢集是否啟動並執行中,請在管理伺服器的命令列上發出下列命令。ndb_mgmd可執行檔出現在「c:\mysql\bin」

的目錄中ndb_mgmd>顯示

Article Properties


Last Published Date

21 Feb 2021

Version

3

Article Type

Solution