MYSQLcluster分布式筹建笔记
MYSQLcluster分布式搭建笔记 一 、注意事项 ? 数据节点 和 sql 节点是否能链接管理节点 ? 注意端口号 telnet 关闭防火墙: Service iptables stop; Sql 节点启动时 注意权限 ? 二、软件安装: (一)管理节点 MGM 配置管理节点 首先在合适的位置,创建一个管
MYSQLcluster分布式搭建笔记一、注意事项
?
数据节点和 sql节点是否能链接管理节点? 注意端口号 telnet
关闭防火墙:Service iptables stop;
Sql 节点启动时注意权限
?
二、软件安装:
(一)管理节点MGM
配置管理节点
首先在合适的位置,创建一个管理节点的配置文件,步骤如下:
[root@localhost ~]# mkdir /var/lib/mysql-cluster
[root@localhost ~]# cd /var/lib/mysql-cluster
[root@localhost mysql-cluster]# vi config.ini
配置文件config.ini内容如下:
?[ndbd default]
NoOfReplicas=1
DataMemory=80M
IndexMemory=18M
?
[ndb_mgmd]
hostname=192.168.2.253
datadir=/var/lib/mysql-cluster
?
[ndbd]
hostname=192.168.2.253
datadir=/usr/local/mysql/data
?
[mysqld]
hostname=192.168.2.254
?
?
安装管理节点,不需要mysqld二进制文件,只需要MySQL Cluster服务端程序(ndb_mgmd)和监听客户端程序(ndb_mgm)。这两个文件都在下载的MySQL-cluster文件解压后的bin文件夹中。执行如下步骤,在集群的管理节点上安装ndb_mgmd 和 ndb_mgm。
1、改变地址到/var/tmp目录下,解压MySQL-Cluster压缩文件,取出ndb_mgm和ndb_mgmd复制到/usr/local/bin 目录下。
[root@localhost ~]# cd /usr/local/
[root@localhost local]# tar –xzvf mysql-cluster-gpl-7.1.13-linux-i686-glibc23.tar.gz
[root@localhost local]# cd mysql-cluster-gpl-7.1.13-linux-i686-glibc23
[root@localhost mysql-cluster-gpl-7.1.13-linux-i686-glibc23]# cp bin/ndb_mgm* /usr/local/bin
?
?
2、改变路径为拷贝到的目录下,并确保这两个文件可执行。
[root@localhost tm local p]# cd /usr/local/bin
[root@localhost bin]# chmod +x ndb_mgm*
3、在/usr/local下创建mysql文件夹。
[root@localhost ~]# cd /usr/local
[root@localhost local]# mkdir mysql
?
(二)、数据节点NDBD和SQL节点
?
在每一个SQl点中的/etc目录下找到my.cnf文件,并做如下配置:
?
[client]
socket=/usr/local/mysql/sock/mysql.sock
?
[mysqld]
ndbcluster
datadir=/usr/local/mysql
socket=/usr/local/mysql/sock/mysql.sock
ndb-connectstring=192.168.56.88
?
[mysql_cluster]
ndb-connectstring=192.168.56.88?
?
?
在每一个数据节点中的/etc目录下找到my.cnf文件,并做如下配置:
?
?
在每一个数据节点NDBD和SQL节点的机器上,用root用户执行下面的步骤。
?
1、检查/etc/passwd 和 /etc/group 文件,是否存在mysql组和mysql用户,如果没有,用下面的命令创建一个mysql组,并在改组中添加mysql用户。
[root@localhost ~]# groupadd mysql
[root@localhost ~]# useradd –g mysql mysql
?
2、改变文件夹位置到mysql压缩包的存放位置,解压文件,准备安装,步骤如下:
?
[root@localhost ~]# cd /usr/local/
?[root@localhost local]# tar –xzvf mysql-cluster-gpl-7.1.13-linux-i686-glibc23.tar.gz
?
?
3、改变位置到local文件夹,改变mysql解压后的文件夹名称为mysql,然后执行提供的脚本,创建系统数据库。
?[root@localhost local]# mv mysql-cluster-gpl-7.1.13-linux-i686-glibc23/ mysql/
[root@localhost local]# cd mysql
?
[root@localhost mysql]# ?mkdir sock
[root@localhost mysql]# scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql ?--socket=/usr/local/mysql/sock/mysql.sock
?
?
4、为MySQL服务及数据目录设置必要的服务。
[root@localhost mysql]# chown -R root .
[root@localhost mysql]# chown -R mysql.mysql /usr/local/mysql/data
[root@localhost mysql]# chown -R mysql.mysql /usr/local/mysql/sock
[root@localhost mysql]#chgrp -R mysql .
[root@localhost mysql]# ls -l
?
?
5、复制MySQL的启动脚本到如下的文件夹,确保可以执行。并设置为当系统启动时,同时启动MySQL。
[root@localhost mysql]# cp support-files/mysql.server /etc/rc.d/init.d/
[root@localhost mysql]# chmod +x /etc/rc.d/init.d/mysql.server
[root@localhost mysql]# chkconfig --add mysql.server
?
?
三、Cluster环境启动
?
注意启动顺序:首先是管理节点,然后是NDBD节点,最后是SQL节点。
1、[MGM]
[root@localhost ~]#ndb_mgmd -f /var/lib/mysql-cluster/config.ini
?
2、[NDBD]
首次启动,则需要添加--initial参数,以便进行NDB节点的初始化工作。在以后的启动过程中,则是不能添加该参数的,否则ndbd程序会清除在之前建立的所有用于恢复的数据文件和日志文件。
[root@localhost ~]#/usr/local/mysql/bin/ndbd --initial
如果不是首次启动,则执行下面的命令。
[root@localhost ~]# /usr/local/mysql/bin/ndbd
?
?
3、[SQLD]
?/usr/local/mysql/bin/mysqld_safe --user=mysql &
?
??
?
有可能出现上图问题,是系统数据库创建问题,只需再次创建系统数据库,方法如下:
[root@localhost mysql]# scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql
?
/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql? --socket=/usr/local/mysql/sock/mysql.sock
?
/usr/local/mysql/bin/mysql_upgrade? --user=mysql
?
netstat -ntulpa
?
再次启动
/usr/local/mysql/bin/mysqld_safe --user=mysql &
?
?
?
查看管理节点,启动成功:
?
?/etc/rc.d/init.d/mysqld stop
/etc/rc.d/init.d/mysqld start

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

AI Hentai Generator
Generate AI Hentai for free.

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



How to delete Xiaohongshu notes? Notes can be edited in the Xiaohongshu APP. Most users don’t know how to delete Xiaohongshu notes. Next, the editor brings users pictures and texts on how to delete Xiaohongshu notes. Tutorial, interested users come and take a look! Xiaohongshu usage tutorial How to delete Xiaohongshu notes 1. First open the Xiaohongshu APP and enter the main page, select [Me] in the lower right corner to enter the special area; 2. Then in the My area, click on the note page shown in the picture below , select the note you want to delete; 3. Enter the note page, click [three dots] in the upper right corner; 4. Finally, the function bar will expand at the bottom, click [Delete] to complete.

Notes deleted from Xiaohongshu cannot be recovered. As a knowledge sharing and shopping platform, Xiaohongshu provides users with the function of recording notes and collecting useful information. According to Xiaohongshu’s official statement, deleted notes cannot be recovered. The Xiaohongshu platform does not provide a dedicated note recovery function. This means that once a note is deleted in Xiaohongshu, whether it is accidentally deleted or for other reasons, it is generally impossible to retrieve the deleted content from the platform. If you encounter special circumstances, you can try to contact Xiaohongshu’s customer service team to see if they can help solve the problem.

As a Xiaohongshu user, we have all encountered the situation where published notes suddenly disappeared, which is undoubtedly confusing and worrying. In this case, what should we do? This article will focus on the topic of "What to do if the notes published by Xiaohongshu are missing" and give you a detailed answer. 1. What should I do if the notes published by Xiaohongshu are missing? First, don't panic. If you find that your notes are missing, staying calm is key and don't panic. This may be caused by platform system failure or operational errors. Checking release records is easy. Just open the Xiaohongshu App and click "Me" → "Publish" → "All Publications" to view your own publishing records. Here you can easily find previously published notes. 3.Repost. If found

Link AppleNotes on iPhone using the Add Link feature. Notes: You can only create links between Apple Notes on iPhone if you have iOS17 installed. Open the Notes app on your iPhone. Now, open the note where you want to add the link. You can also choose to create a new note. Click anywhere on the screen. This will show you a menu. Click the arrow on the right to see the "Add link" option. click it. Now you can type the name of the note or the web page URL. Then, click Done in the upper right corner and the added link will appear in the note. If you want to add a link to a word, just double-click the word to select it, select "Add Link" and press

How to add product links in notes in Xiaohongshu? In the Xiaohongshu app, users can not only browse various contents but also shop, so there is a lot of content about shopping recommendations and good product sharing in this app. If If you are an expert on this app, you can also share some shopping experiences, find merchants for cooperation, add links in notes, etc. Many people are willing to use this app for shopping, because it is not only convenient, but also has many Experts will make some recommendations. You can browse interesting content and see if there are any clothing products that suit you. Let’s take a look at how to add product links to notes! How to add product links to Xiaohongshu Notes Open the app on the desktop of your mobile phone. Click on the app homepage

How to use Redis to achieve distributed data synchronization With the development of Internet technology and the increasingly complex application scenarios, the concept of distributed systems is increasingly widely adopted. In distributed systems, data synchronization is an important issue. As a high-performance in-memory database, Redis can not only be used to store data, but can also be used to achieve distributed data synchronization. For distributed data synchronization, there are generally two common modes: publish/subscribe (Publish/Subscribe) mode and master-slave replication (Master-slave).

As a lifestyle sharing platform, Xiaohongshu covers notes in various fields such as food, travel, and beauty. Many users want to share their notes on Xiaohongshu but don’t know how to do it. In this article, we will detail the process of posting notes on Xiaohongshu and explore how to block specific users on the platform. 1. How to publish notes tutorial on Xiaohongshu? 1. Register and log in: First, you need to download the Xiaohongshu APP on your mobile phone and complete the registration and login. It is very important to complete your personal information in the personal center. By uploading your avatar, filling in your nickname and personal introduction, you can make it easier for other users to understand your information, and also help them pay better attention to your notes. 3. Select the publishing channel: At the bottom of the homepage, click the "Send Notes" button and select the channel you want to publish.

How Redis implements distributed session management requires specific code examples. Distributed session management is one of the hot topics on the Internet today. In the face of high concurrency and large data volumes, traditional session management methods are gradually becoming inadequate. As a high-performance key-value database, Redis provides a distributed session management solution. This article will introduce how to use Redis to implement distributed session management and give specific code examples. 1. Introduction to Redis as a distributed session storage. The traditional session management method is to store session information.
