In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
In this issue, Xiaobian will bring you about how to configure Mysql clusters in Debian6. The article is rich in content and analyzes and narrates from a professional perspective. After reading this article, I hope you can gain something.
Debian6 Configure Mysql Cluster
Mysql Version: mysql-cluster-gpl-7.1.14-linux-i686-glibc23.tar.gz
Operating System: Debian 6.0
192.168.225.131 (MGMD)
192.168.225.133 (NDBD)
192.168.225.134 (NDBD)
192.168.225.135 (MySQLD)
192.168.225.136 (MySQLD)
www.2cto.com
1. Install-cluster on each VM
root@debian:/home/john# groupadd mysql
root@debian:/home/john# useradd -g mysql mysql
root@debian:/home/john# tar zxf mysql-cluster-gpl-7.1.14-linux-i686-glibc23.tar.gz
root@debian:/home/john# mv zxf mysql-cluster-gpl-7.1.14-linux-i686-glibc23 /usr/local/mysql
root@debian:/home/john# chown mysql:mysql /usr/local/mysql
root@debian:/home/john# rm mysql-cluster-gpl-7.1.14-linux-i686-glibc23.tar.gz
2. Configure MGMD (Management Node 192,168.225.131)
Create the file/var/lib/mysql-cluster/config.ini (can be any location or name)
[NDBD DEFAULT]
NoOfReplicas=2
DataMemory=100M
IndexMemory=100M
[TCP DEFAULT]
portnumber=2202
[NDB_MGMD]
id=1
hostname=192.168.225.131
datadir=/var/lib/mysql-cluster
[NDBD]
id=2
hostname=192.168.225.133
datadir=/usr/local/mysql/ndbdata
www.2cto.com
[NDBD]
id=3
hostname=192.168.225.134
datadir=/usr/local/mysql/ndbdata
[mysqld]
id=4
hostname=192.168.225.135
[mysqld]
id=5
hostname=192.168.225.136
3. Configure NDBD(data node 192.168.225.133, 192.168.225.134)
Create the file/etc/my.cnf with the following content
[mysqld]
datadir=/usr/local/mysql/ndbdata
[mysql_cluster]
ndb-connectstring = 192.168.225.131 #points to mgmd
4. Configure MySQLD(SQL node 192.168.225.135, 192.168.225.136)
Create the file/etc/my.cnf with the following content
[mysqld]
ndbcluster
ndb-connectstring=192.168.225.131
www.2cto.com
[mysql_cluster]
ndb-connectstring=192.168.225.131
Installing System tables
root@debian:/usr/local/mysql/scripts# mysql_install_db --user=mysql --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
5. After the above configuration is completed, start the management node 192.168.225.131
root@debian:/usr/local/mysql/bin# ./ ndb_mgmd -f /var/lib/mysql-cluster/config.ini
root@debian:/usr/local/mysql/bin# ./ ndb_mgmd
ndb_mgm> show
When starting up, id= 2, 3, 4, 5 should all be not connected.
6. Start NDB node and MySQL node
Start NDB node
root@debian:/usr/local/mysql/bin# ./ ndbd
Start MySQL node
root@debian:/usr/local/mysql/bin# ./ mysqld_safe &
If there is a startup error here, check to see if System tables is installed correctly in Step 4.
7. Test (MySQLD node 192.168.225.135, 192.168.225.136)
root@debian:/usr/local/mysql/bin# ln -s /usr/local/mysql/bin/mysql /usr/bin
root@debian:/usr/local/mysql/bin# mysql -uroot test
mysql> create table job(id int auto_increment,name varchar(100)) engine=ndbcluster default charset utf8;
engine=ndbcluster cannot be less, otherwise the nodes cannot be synchronized.
Create tables and insert data in both nodes, test results Node data synchronized... OK
www.2cto.com
8. Subsequent Stop Node Restart Node
Stop the ndbd node
If all data nodes ndbd stop, SQL node mysqld will automatically lose connection, but mysqld process is still alive, resulting in the recovery of ndbd, mysqld can not automatically recover
At this point, you need to kill the mysqld process first, and then restart the mysqld node.
Notable places
The requested URL/scripts/mysql_install_db --user=mysql was not found on this server.
Parameters--basedir=/usr/local/mysql --datadir=/usr/local/mysql/data & (this is very important)
The above is how to configure Mysql cluster in Debian6 shared by Xiaobian. If you happen to have similar doubts, you may wish to refer to the above analysis for understanding. If you want to know more about it, please pay attention to the industry information channel.
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.