MySQL cluster configuration

Source: Internet
Author: User
ArticleDirectory
    • I. Software Packages
I. Software Packages

A) MySQL-ndb-management-5.0.90-1.i386.rpm

B) MySQL-ndb-management-5.0.90-1.i386.rpm

C) mysql-5.0.27.tar.gz

2. Install [Management Nodes]

A) rpm-IVH MySQL-ndb-tools-5.0.90-1.i386.rpm

B) rpm-IVH MySQL-ndb-management-5.0.90-1.i386.rpm

C) mkdir/var/lib/MySQL-Cluster

D) CD/var/lib/MySQL-Cluster

E) touch config. ini

[Ndbd default]

Noofreplicas = 2

[Mysqld default]

[Ndb_mgmd default]

[TCP default]

# Managment Server

[Ndb_mgmd]

Hostname = 192.168.1.67

# Storage engines

[Ndbd]

Hostname = 192.168.1.91

Datadir =/usr/local/MySQL/Data

# Datadir =/var/lib/MySQL-Cluster

[Ndbd]

Hostname = 192.168.1.92

Datadir =/usr/local/MySQL/Data

# Datadir =/var/lib/MySQL-Cluster

[Mysqld]

[Mysqld]

F)/usr/bin/ndb_mgm-initial

G)/usr/bin/ndb_mgmd Shutdown

H)/usr/bin/ndb_mgmd-F/var/lib/MySQL-cluster/config. ini [start a management node]

3. Install [data nodes]

A) CD/var/local/software

B) tar zxvf mysql-5.0.27.tar.gz

C) CD mysql-5.0.27

D ). /configure -- prefix =/usr/local/MySQL -- localstatedir =/usr/local/MySQL/data -- disable-maintainer-mode -- With-mysqld-user = MySQL -- With-Unix -socket-Path =/tmp/MySQL. sock -- without-comment -- without-Debug -- With-dependencies -- With-ndbcluster;

E) Make & make install

F) Finger MySQL

G) useradd MySQL

H) CD scripts

I)./mysql_install_db

J) chown-r MYSQL: MySQL/usr/local/MySQL

K) chown-r MYSQL: MySQL/usr/local/MySQL/Data

L) CD/usr/local/src/mysql-5.0.27/support-files/

(M) CP my-medium.cnf/etc/My. CNF

N) killall mysqld

O)/usr/local/MySQL/bin/mysqld_safe -- user = MySQL -- skip-grant-tables -- skip-Networking &

#/Usr/local/MySQL/bin/MySQL-u root MySQL
Mysql> Update user SET Password = PASSWORD ('000000') where user = 'root ';
Mysql> flush privileges;
Mysql> quit

Modify the remote access permission of the root user:
# Killall mysqld
#/Usr/local/MySQL/bin/mysqld_safe-user = MySQL &
#/Usr/local/MySQL/bin/MySQL-u root-p123456 MySQL

Mysql> grant all privileges on *. * To 'root' @ '%' identified by 'root' with grant option;
Mysql> flush privileges;
Mysql> quit

VI/etc/My. CNF

[Mysqld]

Ndbcluster

NDB-connectstring = 192.168.1.67

[Mysql_cluster]

NDB-connectstring = 192.168.1.67

Killall mysqld

/Usr/local/MySQL/bin/mysqld_safe &

/Usr/local/MySQL/libexec/ndbd-initial (initialize data node)

4. View Management Nodes

A)/usr/bin/ndb_mgmd Shutdown

B)/usr/bin/ndb_mgmd-F/var/lib/MySQL-cluster/config. ini

C)/usr/bin/ndb_mgm

-- NDB Cluster -- management client --

Ndb_mgm> show

Connected to management server at: localhost: 1186

Cluster configuration

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

[Ndbd (NDB)] 2 node (s)

Id = 2 @ 192.168.1.91 (Version: 5.0.27, nodegroup: 0, Master)

Id = 3 @ 192.168.1.92 (Version: 5.0.27, nodegroup: 0)

[Ndb_mgmd (MGM)] 1 node (s)

Id = 1 @ 192.168.1.67 (Version: 5.0.90)

[Mysqld (API)] 2 node (s)

Id = 4 @ 192.168.1.92 (Version: 5.0.27)

Id = 5 @ 192.168.1.91 (Version: 5.0.27)

Ndb_mgm>

The above is displayed normally

V. Test node synchronization

A) In one of the data nodes,/usr/local/MySQL/bin/MySQL-uroot-P

B) Create Database member;
Use member;
Create Table admin (id int) engine = ndbcluster;
Insert into admin values (1 );

C) In another data node,/usr/local/MySQL/bin/MySQL-uroot-P

D) Create Database member;

E) Use member;

F) flush tables;

G) show tables;

H) the admin table is synchronized.

I) Select * from Admin

J) We can see that a record has been synchronized.

K) The cluster is normal.

Vi. Related commands

A)/usr/local/MySQL/libexec/ndbd-initial (initialize the data node)

B)/usr/bin/ndb_mgmd Shutdown (close the management node)

C)/usr/bin/ndb_mgmd-F/var/lib/MySQL-cluster/config. ini (start the management node)

D)/usr/bin/ndb_mgm to view Cluster Information

E) pS aux | grep MySQL check whether MySQL is started

F) pS aux | grep NDB check whether the management node is started

G) ndb_mgm-E "show ";

H) ndb_mgm> All stauts;

I) ndb_mgm> 2 status; (2 is the node number)

J) ndbd-no-wait-nodes = 2, 3

K) mysql> show engine NDB status;

L) ndb_mgm> clusterlog Info;

M) mysql> show status like 'ndb % ';

N) mysql> show warnings;

O) ndb_mgm> 2 stop;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.