In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains the "MySQL5.7 cluster building steps", the content of the article is simple and clear, easy to learn and understand, now please follow the editor's ideas slowly in depth, together to study and learn "MySQL5.7 cluster building steps" bar!
Take the time today to do a test to build the simplest MySQL Cluster.
Prepare 5 virtual machines, operating system version Redhat6.5,MySQL version mysql-cluster-gpl-7.5.5-linux-glibc2.5-x86_64.tar (5.7)
Management node mgm192.168.8.220SQL node 1192.168.8.221
SQL node 2192.168.8.222
DB node 1192.168.8.231
DB Node 2
192.168.8.232
I. preparatory work
Turn off the firewall:
Service iptables stop
Chkconfig iptables off
Turn off selinux:
Vi / etc/selinux/config
Change SELINUX=enforce to disabled
Extract mysql-cluster-gpl-7.5.5-linux-glibc2.5-x86_64.tar to / usr/local/mysql (5 nodes)
Second, configuration management node
Cp / usr/local/mysql/bin/ndb_mgm* / usr/local/bin
Cd / usr/local/bin
Chmod + x ndb_mgm*
Cd / usr/local/mysql
Vi config.ini
[ndbd default]
NoOfReplicas=2
DataMemory=80M
IndexMemory=18M
[ndb_mgmd]
NodeId=1
Hostname=192.168.8.220
Datadir=/mysql/data
[ndbd]
NodeId=2
Hostname=192.168.8.231
Datadir=/mysql/data
[ndbd]
NodeId=3
Hostname=192.168.8.232
Datadir=/mysql/data
[mysqld]
NodeId=4
Hostname=192.168.8.221
[mysqld]
NodeId=5
Hostname=192.168.8.222
Start mgm
Ndb_mgmd-f / usr/local/mysql/config.ini
Enter the mgm view status:
[root@mgm usr] # ndb_mgm
-NDB Cluster-Management Client--
Ndb_mgm > show
Configure data nodes (two nodes)
Modify the configuration file
Vi / etc/my.cnf
Add the following configuration:
User=mysql
Basedir=/usr/local/mysql
Datadir=/mysql/data
Default-storage-engine=InnoDB
# skip-grant-tables
Socket=/tmp/mysqld.sock
[client]
Default-character-set=utf8
Socket=/tmp/mysqld.sock
[mysql]
Socket=/tmp/mysqld.sock
Default-character-set=utf8
[mysql_cluster]
Ndb-connectstring=192.168.8.220
Cd / usr/local/mysql/bin
. / mysql_install_db-- user=mysql-- basedir=/usr/local/mysql-- datadir=/mysql/data
2017-11-02 08:06:03 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld-initialize
2017-11-02 08:06:20 [WARNING] The bootstrap log isn't empty:
2017-11-02 08:06:20 [WARNING] 2017-11-02T00:06:04.435385Z 0 [Warning]-- bootstrap is deprecated. Please consider using-initialize instead
2017-11-02T00:06:04.457329Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2017-11-02T00:06:04.457350Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
Note that the new version-initialize replaces mysql_install_db, and this does not affect it.
/ usr/local/mysql/bin/ndbd-- initial
2017-11-02 08:10:11 [ndbd] INFO-- Angel connected to '192.168.220 purl 1186'
2017-11-02 08:10:11 [ndbd] INFO-- Angel allocated nodeid: 3
4. Configure SQL node
Modify the configuration file
Vi / etc/my.cnf
Add the following configuration:
User=mysql
Basedir=/usr/local/mysql
Datadir=/mysql/data
Default-storage-engine=InnoDB
# skip-grant-tables
Socket=/tmp/mysql.sock
Ndbcluster
Ndb-connectstring=192.168.8.220
[client]
Default-character-set=utf8
Socket=/tmp/mysql.sock
[mysql]
Socket=/tmp/mysql.sock
Default-character-set=utf8
[mysql_cluster]
# ndb-connectstring=192.168.8.220
Cd / usr/local/mysql/bin
. / mysql_install_db-- user=mysql-- basedir=/usr/local/mysql-- datadir=/mysql/data
2017-11-02 08:06:03 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld-initialize
2017-11-02 08:06:20 [WARNING] The bootstrap log isn't empty:
2017-11-02 08:06:20 [WARNING] 2017-11-02T00:06:04.435385Z 0 [Warning]-- bootstrap is deprecated. Please consider using-initialize instead
2017-11-02T00:06:04.457329Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2017-11-02T00:06:04.457350Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
Note that the new version-initialize replaces mysql_install_db, and this does not affect it.
Start the database on the SQL node and change the root password
5. Cluster testing
You can query it by adding database test,SQL Node 2 to the SQL node, and add, delete, modify and query.
Start the cluster
1) start the management node
Run the following command in shell:
Ndb_mgmd-f / usr/local/mysql/config.ini
You can also use ndb_mgm to listen on the client, as follows:
Ndb_mgm
2) start the data node
For the first time, you need to add the-- initial parameter to initialize the NDB node. This parameter cannot be added during later startup, otherwise the ndbd program will clear all previously established data and log files for recovery.
/ usr/local/mysql/bin/ndbd-- initial
If it is not the first time to start, execute the following command.
/ usr/local/mysql/bin/ndbd
3) start the SQL node
If the MySQL service is not running, run the following command in shell:
/ usr/local/mysql/bin/mysqld_safe-user=mysql &
7. Shut down the cluster
1) to shut down the management node and data node, you only need to execute it in the management node (ClusterMgm--134):
Shell > / usr/local/mysql/bin/ndb_mgm-e shutdown
Display
Connected to Management Server at: localhost:1186
NDB Cluster node (s) have shutdown.
Disconnecting to allow management server to shutdown.
2) then close the Sql node (135136) and run in the two nodes:
Shell > / etc/init.d/mysql stop
Shutting down MySQL... SUCCESS!
Thank you for your reading. The above is the content of "MySQL5.7 Cluster Building steps". After the study of this article, I believe you have a deeper understanding of the MySQL5.7 cluster building steps, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.