support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h sql02.host.com password 'new-password'
Alternatively you can run:
./bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd ./mysql-test ; perl mysql-test-run.pl
Please report any problems with the ./bin/mysqlbug script!
[root@sql02 mysql]# /etc/init.d/mysqld start
Starting MySQL. SUCCESS!
[root@sql02 mysql]# /usr/local/mysql/bin/ndb_mgm
-- NDB Cluster -- Management Client --
ndb_mgm> show
Connected to Management Server at: 192.168.1.11:1186
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=2 @192.168.1.14 (mysql-5.1.44 ndb-7.1.4, Nodegroup: 0, Master)
id=3 @192.168.1.15 (mysql-5.1.44 ndb-7.1.4, Nodegroup: 0)
[ndb_mgmd(MGM)] 1 node(s)
id=1 @192.168.1.11 (mysql-5.1.44 ndb-7.1.4)
[mysqld(API)] 2 node(s)
id=4 @192.168.1.12 (mysql-5.1.44 ndb-7.1.4)
id=5 @192.168.1.13 (mysql-5.1.44 ndb-7.1.4)
4.8 测试
第一步,sql02创建测试数据库,sql01可以发现
[root@sql02 mysql]# /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> create database larrydb;
Query OK, 1 row affected (0.21 sec)
mysql>
[root@sql01 mysql]# /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 |
| larrydb |
| mysql |
| ndbinfo |
| test |
+--------------------+
5 rows in set (0.00 sec)
第二步,sql01创建测试表,插入测试数据,sql02可以发现变化
mysql> use larrydb;
Database changed
mysql> create table user(id int,name varchar(30));
Query OK, 0 rows affected (0.62 sec)
mysql> insert into user values(1,'larry');
Query OK, 1 row affected (0.03 sec)
sql02
mysql> select * from larrydb.user;
+------+-------+
| id | name |
+------+-------+
| 1 | larry |
+------+-------+
1 row in set (0.04 sec)
如果只能使用三台服务器,可以这样配置:sql节点和ndb节点放在一起。管理节点做如下配置:
#管理节点
[ndb_mgmd]
Id=1
HostName= 192.168.1.11
[ndbd]
Id= 2
HostName= 192.168.1.14
[ndbd]
Id= 3
HostName= 192.168.1.15
[mysqld]
Id= 4
[mysqld]
Id= 5
#其他节点做sql节点的配置即可