Merge branch 'Markdown' of https://github.com/mariadb-corporation/MaxScale into Markdown
This commit is contained in:
@ -47,35 +47,25 @@ MySQL 5.5.38 as SQL node2
|
|||||||
Cluster configuration file is /var/lib/mysql-cluster/config.ini, copied on all servers
|
Cluster configuration file is /var/lib/mysql-cluster/config.ini, copied on all servers
|
||||||
|
|
||||||
[ndbd default]
|
[ndbd default]
|
||||||
|
|
||||||
NoOfReplicas=2
|
NoOfReplicas=2
|
||||||
|
|
||||||
DataMemory=60M
|
DataMemory=60M
|
||||||
|
|
||||||
IndexMemory=16M
|
IndexMemory=16M
|
||||||
|
|
||||||
[ndb_mgmd]
|
[ndb_mgmd]
|
||||||
|
|
||||||
hostname=178.62.38.199
|
hostname=178.62.38.199
|
||||||
|
|
||||||
id=21
|
id=21
|
||||||
|
|
||||||
datadir=/var/lib/mysql-cluster
|
datadir=/var/lib/mysql-cluster
|
||||||
|
|
||||||
[mysqld]
|
[mysqld]
|
||||||
|
|
||||||
hostname=178.62.38.199
|
hostname=178.62.38.199
|
||||||
|
|
||||||
[mysqld]
|
[mysqld]
|
||||||
|
|
||||||
hostname=162.243.90.81
|
hostname=162.243.90.81
|
||||||
|
|
||||||
[ndbd]
|
[ndbd]
|
||||||
|
|
||||||
hostname=178.62.38.199
|
hostname=178.62.38.199
|
||||||
|
|
||||||
[ndbd]
|
[ndbd]
|
||||||
|
|
||||||
hostname=162.243.90.81
|
hostname=162.243.90.81
|
||||||
|
|
||||||
Note, it’s possible to specify all node ids and datadir as well for each cluster component
|
Note, it’s possible to specify all node ids and datadir as well for each cluster component
|
||||||
@ -83,27 +73,18 @@ Note, it’s possible to specify all node ids and datadir as well for each clust
|
|||||||
Example:
|
Example:
|
||||||
|
|
||||||
[ndbd]
|
[ndbd]
|
||||||
|
|
||||||
hostname=162.243.90.81
|
hostname=162.243.90.81
|
||||||
|
|
||||||
id=43
|
id=43
|
||||||
|
|
||||||
datadir=/usr/local/mysql/data
|
datadir=/usr/local/mysql/data
|
||||||
|
|
||||||
and /etc/my.cnf, copied as well in all servers
|
and /etc/my.cnf, copied as well in all servers
|
||||||
|
|
||||||
[mysqld]
|
[mysqld]
|
||||||
|
|
||||||
ndbcluster
|
ndbcluster
|
||||||
|
|
||||||
ndb-connectstring=178.62.38.199
|
ndb-connectstring=178.62.38.199
|
||||||
|
|
||||||
innodb_buffer_pool_size=16M
|
innodb_buffer_pool_size=16M
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[mysql_cluster]
|
[mysql_cluster]
|
||||||
|
|
||||||
ndb-connectstring=178.62.38.199
|
ndb-connectstring=178.62.38.199
|
||||||
|
|
||||||
## Startup of MySQL Cluster
|
## Startup of MySQL Cluster
|
||||||
@ -179,13 +160,11 @@ Query OK, 0 rows affected (3.28 sec)
|
|||||||
mysql> show create table t1;
|
mysql> show create table t1;
|
||||||
|
|
||||||
+------- +-------------------------------------------------------------------------------------------+
|
+------- +-------------------------------------------------------------------------------------------+
|
||||||
|
|
||||||
| Table | Create Table |
|
| Table | Create Table |
|
||||||
|
|
||||||
+-------+-------------------------------------------------------------------------------------------+
|
+-------+-------------------------------------------------------------------------------------------+
|
||||||
|
|
||||||
| t1 | CREATE TABLE `t1` (
|
| t1 | CREATE TABLE `t1` (
|
||||||
|
|
||||||
`a` int(11) DEFAULT NULL
|
`a` int(11) DEFAULT NULL
|
||||||
|
|
||||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 |
|
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 |
|
||||||
@ -205,13 +184,9 @@ Query OK, 1 row affected (0.15 sec)
|
|||||||
mysql> select count(1) from t1;
|
mysql> select count(1) from t1;
|
||||||
|
|
||||||
+----------+
|
+----------+
|
||||||
|
|
||||||
| count(1) |
|
| count(1) |
|
||||||
|
|
||||||
+----------+
|
+----------+
|
||||||
|
|
||||||
| 1 |
|
| 1 |
|
||||||
|
|
||||||
+----------+
|
+----------+
|
||||||
|
|
||||||
1 row in set (0.07 sec)
|
1 row in set (0.07 sec)
|
||||||
@ -223,13 +198,9 @@ mysql> select count(1) from t1;
|
|||||||
mysql> select count(1) from test.t1;
|
mysql> select count(1) from test.t1;
|
||||||
|
|
||||||
+----------+
|
+----------+
|
||||||
|
|
||||||
| count(1) |
|
| count(1) |
|
||||||
|
|
||||||
+----------+
|
+----------+
|
||||||
|
|
||||||
| 1 |
|
| 1 |
|
||||||
|
|
||||||
+----------+
|
+----------+
|
||||||
|
|
||||||
1 row in set (0.08 sec)
|
1 row in set (0.08 sec)
|
||||||
@ -239,67 +210,41 @@ mysql> select count(1) from test.t1;
|
|||||||
Add these sections in MaxScale.cnf config file:
|
Add these sections in MaxScale.cnf config file:
|
||||||
|
|
||||||
[Cluster Service]
|
[Cluster Service]
|
||||||
|
|
||||||
type=service
|
type=service
|
||||||
|
|
||||||
router=readconnroute
|
router=readconnroute
|
||||||
|
|
||||||
router_options=ndb
|
router_options=ndb
|
||||||
|
|
||||||
servers=server1,server2
|
servers=server1,server2
|
||||||
|
|
||||||
user=test
|
user=test
|
||||||
|
|
||||||
passwd=test
|
passwd=test
|
||||||
|
|
||||||
version_string=5.5.37-CLUSTER
|
version_string=5.5.37-CLUSTER
|
||||||
|
|
||||||
[Cluster Listener]
|
[Cluster Listener]
|
||||||
|
|
||||||
type=listener
|
type=listener
|
||||||
|
|
||||||
service=Cluster Service
|
service=Cluster Service
|
||||||
|
|
||||||
protocol=MySQLClient
|
protocol=MySQLClient
|
||||||
|
|
||||||
port=4906
|
port=4906
|
||||||
|
|
||||||
[NDB Cluster Monitor]
|
[NDB Cluster Monitor]
|
||||||
|
|
||||||
type=monitor
|
type=monitor
|
||||||
|
|
||||||
module=ndbclustermon
|
module=ndbclustermon
|
||||||
|
|
||||||
servers=server1,server2
|
servers=server1,server2
|
||||||
|
|
||||||
user=monitor
|
user=monitor
|
||||||
|
|
||||||
passwd=monitor
|
passwd=monitor
|
||||||
|
|
||||||
monitor_interval=8000
|
monitor_interval=8000
|
||||||
|
|
||||||
[server1]
|
[server1]
|
||||||
|
|
||||||
## SQL node1
|
#SQL node1
|
||||||
|
|
||||||
type=server
|
type=server
|
||||||
|
|
||||||
address=127.0.0.1
|
address=127.0.0.1
|
||||||
|
|
||||||
port=3306
|
port=3306
|
||||||
|
|
||||||
protocol=MySQLBackend
|
protocol=MySQLBackend
|
||||||
|
|
||||||
[server2]
|
[server2]
|
||||||
|
#SQL node2
|
||||||
##SQL node2
|
|
||||||
|
|
||||||
type=server
|
type=server
|
||||||
|
|
||||||
address=162.243.90.81
|
address=162.243.90.81
|
||||||
|
|
||||||
port=3306
|
port=3306
|
||||||
|
|
||||||
protocol=MySQLBackend
|
protocol=MySQLBackend
|
||||||
|
|
||||||
Assuming MaxScale is installed in server1, start it
|
Assuming MaxScale is installed in server1, start it
|
||||||
@ -315,11 +260,8 @@ MaxScale> show monitors
|
|||||||
Monitor: 0x387b880
|
Monitor: 0x387b880
|
||||||
|
|
||||||
Name: NDB Cluster Monitor
|
Name: NDB Cluster Monitor
|
||||||
|
|
||||||
Monitor running
|
Monitor running
|
||||||
|
|
||||||
Sampling interval: 8000 milliseconds
|
Sampling interval: 8000 milliseconds
|
||||||
|
|
||||||
Monitored servers: 127.0.0.1:3306, 162.243.90.81:3306
|
Monitored servers: 127.0.0.1:3306, 162.243.90.81:3306
|
||||||
|
|
||||||
MaxScale> show servers
|
MaxScale> show servers
|
||||||
@ -327,49 +269,29 @@ MaxScale> show servers
|
|||||||
Server 0x3873b40 (server1)
|
Server 0x3873b40 (server1)
|
||||||
|
|
||||||
Server: 127.0.0.1
|
Server: 127.0.0.1
|
||||||
|
|
||||||
Status: NDB, Running
|
Status: NDB, Running
|
||||||
|
|
||||||
Protocol: MySQLBackend
|
Protocol: MySQLBackend
|
||||||
|
|
||||||
Port: 3306
|
Port: 3306
|
||||||
|
|
||||||
Server Version: 5.5.38-ndb-7.2.17-cluster-gpl
|
Server Version: 5.5.38-ndb-7.2.17-cluster-gpl
|
||||||
|
|
||||||
Node Id: 22
|
Node Id: 22
|
||||||
|
|
||||||
Master Id: -1
|
Master Id: -1
|
||||||
|
|
||||||
Repl Depth: 0
|
Repl Depth: 0
|
||||||
|
|
||||||
Number of connections: 0
|
Number of connections: 0
|
||||||
|
|
||||||
Current no. of conns: 0
|
Current no. of conns: 0
|
||||||
|
|
||||||
Current no. of operations: 0
|
Current no. of operations: 0
|
||||||
|
|
||||||
Server 0x3873a40 (server2)
|
Server 0x3873a40 (server2)
|
||||||
|
|
||||||
Server: 162.243.90.81
|
Server: 162.243.90.81
|
||||||
|
|
||||||
Status: NDB, Running
|
Status: NDB, Running
|
||||||
|
|
||||||
Protocol: MySQLBackend
|
Protocol: MySQLBackend
|
||||||
|
|
||||||
Port: 3306
|
Port: 3306
|
||||||
|
|
||||||
Server Version: 5.5.38-ndb-7.2.17-cluster-gpl
|
Server Version: 5.5.38-ndb-7.2.17-cluster-gpl
|
||||||
|
|
||||||
Node Id: 23
|
Node Id: 23
|
||||||
|
|
||||||
Master Id: -1
|
Master Id: -1
|
||||||
|
|
||||||
Repl Depth: 0
|
Repl Depth: 0
|
||||||
|
|
||||||
Number of connections: 0
|
Number of connections: 0
|
||||||
|
|
||||||
Current no. of conns: 0
|
Current no. of conns: 0
|
||||||
|
|
||||||
Current no. of operations: 0
|
Current no. of operations: 0
|
||||||
|
|
||||||
It’s now possible to run basic tests with the read connection load balancing for the two configured SQL nodes
|
It’s now possible to run basic tests with the read connection load balancing for the two configured SQL nodes
|
||||||
@ -379,25 +301,17 @@ It’s now possible to run basic tests with the read connection load balancing
|
|||||||
[root@server1 ~]# mysql -h 127.0.0.1 -P 4906 -u test -ptest -e "SHOW STATUS LIKE 'Ndb_cluster_node_id'"
|
[root@server1 ~]# mysql -h 127.0.0.1 -P 4906 -u test -ptest -e "SHOW STATUS LIKE 'Ndb_cluster_node_id'"
|
||||||
|
|
||||||
+---------------------+-------+
|
+---------------------+-------+
|
||||||
|
|
||||||
| Variable_name | Value |
|
| Variable_name | Value |
|
||||||
|
|
||||||
+---------------------+-------+
|
+---------------------+-------+
|
||||||
|
|
||||||
| Ndb_cluster_node_id | 23 |
|
| Ndb_cluster_node_id | 23 |
|
||||||
|
|
||||||
+---------------------+-------+
|
+---------------------+-------+
|
||||||
|
|
||||||
[root@server1 ~]# mysql -h 127.0.0.1 -P 4906 -u test -ptest -e "SHOW STATUS LIKE 'Ndb_cluster_node_id'"
|
[root@server1 ~]# mysql -h 127.0.0.1 -P 4906 -u test -ptest -e "SHOW STATUS LIKE 'Ndb_cluster_node_id'"
|
||||||
|
|
||||||
+---------------------+-------+
|
+---------------------+-------+
|
||||||
|
|
||||||
| Variable_name | Value |
|
| Variable_name | Value |
|
||||||
|
|
||||||
+---------------------+-------+
|
+---------------------+-------+
|
||||||
|
|
||||||
| Ndb_cluster_node_id | 22 |
|
| Ndb_cluster_node_id | 22 |
|
||||||
|
|
||||||
+---------------------+-------+
|
+---------------------+-------+
|
||||||
|
|
||||||
The MaxScale connection load balancing is working.
|
The MaxScale connection load balancing is working.
|
||||||
@ -407,13 +321,9 @@ The MaxScale connection load balancing is working.
|
|||||||
[root@server1 ~] mysql -h 127.0.0.1 -P 4906 -utest -ptest -e "SELECT COUNT(1) FROM test.t1"
|
[root@server1 ~] mysql -h 127.0.0.1 -P 4906 -utest -ptest -e "SELECT COUNT(1) FROM test.t1"
|
||||||
|
|
||||||
+----------+
|
+----------+
|
||||||
|
|
||||||
| COUNT(1) |
|
| COUNT(1) |
|
||||||
|
|
||||||
+----------+
|
+----------+
|
||||||
|
|
||||||
| 1 |
|
| 1 |
|
||||||
|
|
||||||
+----------+
|
+----------+
|
||||||
|
|
||||||
(3) test an insert statement
|
(3) test an insert statement
|
||||||
@ -425,12 +335,8 @@ mysql -h 127.0.0.1 -P 4906 -utest -ptest -e "INSERT INTO test.t1 VALUES (19)"
|
|||||||
[root@server1 ~] mysql -h 127.0.0.1 -P 4906 -utest -ptest -e "SELECT COUNT(1) FROM test.t1"
|
[root@server1 ~] mysql -h 127.0.0.1 -P 4906 -utest -ptest -e "SELECT COUNT(1) FROM test.t1"
|
||||||
|
|
||||||
+----------+
|
+----------+
|
||||||
|
|
||||||
| COUNT(1) |
|
| COUNT(1) |
|
||||||
|
|
||||||
+----------+
|
+----------+
|
||||||
|
|
||||||
| 2 |
|
| 2 |
|
||||||
|
|
||||||
+----------+
|
+----------+
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user