mysql-js> dba.deploySandboxInstance(3310) A new MySQL sandbox instance will be created on this host in /root/mysql-sandboxes/3310
輸入密碼之后,一個3310端口的MySQL服務(wù)就啟動了。 Please enter a MySQL root password for the new instance: Deploying new MySQL instance... Instance localhost:3310 successfully deployed and started. Use shell.connect('root@localhost:3310'); to connect to the instance. 接著創(chuàng)建另外兩個節(jié)點 3320,3330 dba.deploySandboxInstance(3320) dba.deploySandboxInstance(3330) 我們切換到3310的MySQL實例,準備開始創(chuàng)建Cluster mysql-js> /connect root@localhost:3310 Creating a Session to 'root@localhost:3310' Enter password: Closing old connection... Classic Session successfully established. No default schema selected.
Please enter MySQL password for root: Bootstrapping system MySQL Router instance... MySQL Router has now been configured for the InnoDB cluster 'testCluster'. The following connection information can be used to connect to the cluster. Classic MySQL protocol connections to cluster 'testCluster': - Read/Write Connections: localhost:6446 - Read/Only Connections: localhost:6447 X protocol connections to cluster 'testCluster': - Read/Write Connections: localhost:64460 - Read/Only Connections: localhost:64470 可以從上面的日志看出來,分配的讀寫端口是6446,只讀端口是6447,還有x協(xié)議連接的端口為64460,64470 啟動MySQL Router # mysqlrouter & [1] 2913
mysql-js> cluster.rejoinInstance('root@localhost:3310') Rejoining the instance to the InnoDB cluster. Depending on the original problem that made the instance unavailable, the rejoin operation might not be successful and further manual steps will be needed to fix the underlying problem. Please monitor the output of the rejoin operation and take necessary action if the instance cannot rejoin. Please provide the password for 'root@localhost:3310': Rejoining instance to the cluster ... The instance 'root@localhost:3310' was successfully rejoined on the cluster. The instance 'localhost:3310' was successfully added to the MySQL Cluster. mysql-js>