Mysql集羣

      

     http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-overview.html

mysql cluster是一個基於NDB cluster存儲引擎的完整的分佈式數據庫系統,不僅具有高可用性,而且自動切分數據,冗餘數據等高級功能。

主要組成部分:

1.sql層的sql服務器節點,主要做數據訪問,通常稱作mysql server

2.storage層的NDB數據節點,主要功能是保存cluster數據,即NDBcluster

3.manage節點主機,主要管理整個集羣中各個節點的管理工作,包括集羣配置,關閉啓動,常規維護,數據備份恢復等

實驗環境:

操作系統:rhel

所需軟件包:mysql-cluster-gpl-7.1.4b-linux-x86_64-glibc23.tar.gz

manage節點:192.168.1.20 NDB.lu.com

        sql1節點:192.168.1.21 sql1.lu.com

        sql2節點:192.168.1.22 sql2.lu.com

       ndb1節點: 192.168.1.23 DB1.lu.com

      ndb2節點: 192.168.1.24 DB2.lu.com

預期效果,對sql1進行寫動作,在sql2中查詢,得到更新的數據。


結果:

[root@sql1 ~]# /usr/local/mysql/bin/mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.1.44-ndb-7.1.4b-cluster-gpl-log MySQL Cluster Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use test;
Database changed
mysql> create table user(id int,name varchar(30));
Query OK, 0 rows affected (0.58 sec)

mysql> insert into user values(1,'lu');
Query OK, 1 row affected (0.03 sec)



[root@sql2 ~]# /usr/local/mysql/bin/mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.44-ndb-7.1.4b-cluster-gpl-log MySQL Cluster Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| ndbinfo            |
| test               |
+--------------------+
4 rows in set (0.00 sec)

mysql> use test;
Database changed
mysql> select * from user;
Empty set (0.06 sec)

mysql> select * from user;
+------+------+
| id   | name |
+------+------+
|    1 | lu   |
+------+------+
1 row in set (0.00 sec)



[root@NDB ~]# /usr/local/mysql/bin/ndb_mgm
-- NDB Cluster -- Management Client --
ndb_mgm> show
Cluster Configuration
---------------------
[ndbd(NDB)]    2 node(s)
id=2    @192.168.1.23  (mysql-5.1.44 ndb-7.1.4, Nodegroup: 0, Master)
id=3    @192.168.1.24  (mysql-5.1.44 ndb-7.1.4, Nodegroup: 0)

[ndb_mgmd(MGM)]    1 node(s)
id=1    @192.168.1.20  (mysql-5.1.44 ndb-7.1.4)

[mysqld(API)]    4 node(s)
id=4    @192.168.1.21  (mysql-5.1.44 ndb-7.1.4)
id=5    @192.168.1.22  (mysql-5.1.44 ndb-7.1.4)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章