31.07.2013 Views

MySQL Cluster Tutorial - cdn.oreillystatic.com

MySQL Cluster Tutorial - cdn.oreillystatic.com

MySQL Cluster Tutorial - cdn.oreillystatic.com

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ndb_mgm> show<br />

Connected to Management Server at: localhost:1186<br />

<strong>Cluster</strong> Configuration<br />

---------------------<br />

[ndbd(NDB)] 2 node(s)<br />

id=1 @127.0.0.1 (mysql-5.1.34 ndb-7.0.6, Nodegroup: 0, Master)<br />

id=2 @192.168.0.4 (mysql-5.1.34 ndb-7.0.6, Nodegroup: 0)<br />

[ndb_mgmd(MGM)] 2 node(s)<br />

id=101 @127.0.0.1 (mysql-5.1.34 ndb-7.0.6)<br />

id=102 @127.0.0.1 (mysql-5.1.34 ndb-7.0.6)<br />

[mysqld(API)] 2 node(s)<br />

id=51 @192.168.0.3 (mysql-5.1.34 ndb-7.0.6)<br />

id=52 @192.168.0.4 (mysql-5.1.34 ndb-7.0.6)<br />

Create a <strong>Cluster</strong> table<br />

192.168.0.3: mysql -h localhost -P 3306<br />

mysql> use test<br />

Database changed<br />

mysql> create table assets (name varchar(30) not null primary key,<br />

-> value int) engine=ndb;<br />

Query OK, 0 rows affected (0.99 sec)<br />

mysql> insert into assets values ('Car','1900');<br />

Query OK, 1 row affected (0.03 sec)<br />

mysql> select * from assets;<br />

+------+-------+<br />

| name | value |<br />

+------+-------+<br />

| Car | 1900 |<br />

+------+-------+<br />

1 row in set (0.00 sec)<br />

Now check that the same data can be accessed from the second <strong>MySQL</strong> Server:<br />

192.168.0.3: mysql -h 192.168.0.4 -P 3306<br />

mysql> use test<br />

Database changed<br />

mysql> select * from assets;<br />

+------+-------+<br />

| name | value |<br />

+------+-------+<br />

| Car | 1900 |<br />

+------+-------+<br />

1 row in set (0.00 sec)<br />

Copyright © 2010, Oracle and/or its affiliates. All rights reserved. 15/81

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!