Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure Mysql 5.0.22 cluster under RedHat AS4-U2

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces how to configure Mysql 5.0.22 cluster under RedHat AS4-U2. The article is very detailed and has certain reference value. Interested friends must read it!

I. experimental environment

1. Linux operating system version. RedHat AS4-U2

2. Mysql database version mysql-max-5.0.22-linux-i686-glibc23.tar.gz

Red Hat AS4-U2 is installed on three PCs. First, make sure that no package with mysql is installed in the system. If there is one, rpm -e .

PC1 IP:192.168.10.196

PC2 IP:192.168.10.197

PC3 IP:192.168.10.198

II. Installation steps

1. The following commands need to be executed on PC1 and PC2. Please execute them in sequence:

mv mysql-max-5.0.22-linux-i686-glibc23.tar.gz /usr/local/

cd /usr/local/

tar zxvf mysql-max-5.0.22-linux-i686-glibc23.tar.gz

rm mysql-max-5.0.22-linux-i686-glibc23.tar.gz

mv mysql-max-5.0.22-linux-i686-glibc23 mysql

groupadd mysql

useradd -g mysql mysql

cd mysql

scripts/mysql_install_db --user=mysql

chown -R mysql:mysql .

cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf

vi /etc/my.cnf

Find the line myisam_sort_buffer_size = 8M and add the following two lines to the end:

ndbcluster

ndb-connectstring=192.168.10.198

Then add the following six lines to the last line of my.cnf:

[ndbd]

connect-string=192.168.10.198

[ndb_mgm]

connect-string=192.168.10.198

[ndb_mgmd]

config-file=/var/lib/mysql-cluster

After modification, save and launch!

mkdir /var/lib/mysql-cluster

2. Execute the following commands on PC3, in that order:

mv mysql-max-5.0.22-linux-i686-glibc23.tar.gz /usr/local/

cd /usr/local/

tar zxvf mysql-max-5.0.22-linux-i686-glibc23.tar.gz

rm mysql-max-5.0.22-linux-i686-glibc23.tar.gz

mv mysql-max-5.0.22-linux-i686-glibc23 mysql

groupadd mysql

useradd -g mysql mysql

cd mysql

scripts/mysql_install_db --user=mysql

chown -R mysql:mysql .

cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf

vi /etc/my.cnf

Find the line myisam_sort_buffer_size = 8M and add the following two lines to the end:

ndbcluster

ndb-connectstring=192.168.10.198

Then add the following six lines to the last line of my.cnf:

[ndbd]

connect-string=192.168.10.198

[ndb_mgm]

connect-string=192.168.10.198

[ndb_mgmd]

config-file=/var/lib/mysql-cluster

After modification, save and launch!

mkdir /var/lib/mysql-cluster

cd /var/lib/mysql-cluster

touch config.ini

vi config.ini Type in the following information: (not half a character is wrong)

[NDBD DEFAULT]

NoOfReplicas= 2

DataDir= /var/lib/mysql-cluster

[NDB_MGMD]

Hostname= 192.168.10.198

DataDir= /var/lib/mysql-cluster

[NDBD]

HostName= 192.168.10.197

[NDBD]

HostName= 192.168.10.196

[MYSQLD]

[MYSQLD]

[MYSQLD]

Save exit!

3. So far the entire configuration steps are complete, the following need to set up some quick commands:

On PC1 and PC2, you need to enter the following commands:

cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld

chmod +x /etc/rc.d/init.d/mysqld

chkconfig -add mysqld

ln -s /usr/local/mysql/bin/ndbd /usr/bin/ndbd

vi /etc/rc.local

Add a line of ndbd and save exit

On PC3, you need to enter the following commands:

cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld

chmod +x /etc/rc.d/init.d/mysqld

chkconfig -add mysqld

ln -s /usr/local/mysql/bin/ndb_mgm /usr/bin/ndb_mgm

ln -s /usr/local/mysql/bin/ndb_mgmd /usr/bin/ndb_mgmd

Add the following line after vi /etc/rc.local

/usr/local/mysql/bin/ndb_mgmd -f /var/lib/mysql-cluster/config.ini

Save exit!

III. start the service

The commands PC3 needs to execute are as follows:

/usr/local/mysql/bin/ndb_mgmd -f /var/lib/mysql-cluster/config.ini

service mysqld start

The commands PC1 and PC2 need to execute are as follows:

/usr/local/mysql/bin/ndbd --initial Note: Use the--initial parameter only when starting ndbd for the first time

service mysqld start

IV. tests and inspections

The commands PC3 needs to execute are as follows:

ndb_mgm

Execute the following command and display the following message to indicate normal operation!

[root@lzj local]# ndb_mgm

-- NDB Cluster -- Management Client --

ndb_mgm> show

Connected to Management Server at: 192.168.10.198:1186

Cluster Configuration

---------------------

[ndbd(NDB)] 2 node(s)

id=2 @192.168.10.197 (Version: 5.0.22, Nodegroup: 0, Master)

id=3 @192.168.10.196 (Version: 5.0.22, Nodegroup: 0)

[ndb_mgmd(MGM)] 1 node(s)

id=1 @192.168.10.198 (Version: 5.0.22)

[mysqld(API)] 3 node(s)

id=4 @192.168.10.198 (Version: 5.0.22)

id=5 @192.168.10.197 (Version: 5.0.22)

id=6 @192.168.10.196 (Version: 5.0.22)

ndb_mgm>

When testing, you need to create a table to see if the mysql of the three machines can be synchronized.

v. precautions

1. During startup of mysql cluster, the management node server must be started in advance, and other nodes must be started after the management node is successfully started.

2. When shutting down the entire cluster, it is best to shut down the management node last

3. After the management node goes down, one of the remaining hosts goes down again, thus losing the meaning of clustering. The management node is preferably on call 24 hours a day

The above is "How to configure Mysql 5.0.22 cluster under RedHat AS4-U2". Thank you for reading all the contents of this article! Hope to share the content to help everyone, more relevant knowledge, welcome to 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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report