Triển khai MySQL Cluster trên Windows Server - Part 2

thanhdc

Junior – IT Sơ cấp
Aug 10, 2014
124
3
18
Triển khai MySQL Cluster trên Windows Server - Part 2:

Khởi động MySQL Cluster Manager agent trên tất cả 4 Server (black, green, blue, brown)
Mở cửa sổ cmd thứ nhất và chạy lệnh mcmd&


Kết nối tới MySQL Cluster Manager agent:
Mở cửa sổ cmd thứ 2 và chạy lệnh: mcm -a IPAddr:1862 hoặc đơn giản chỉ cần chạy lệnh mcm thì mặc định nó sẽ kết nối tới MySQL Clsuter Manager agent đang chạy trên Local.


-Sau đây mình sẽ tạo site, package, cluster. Chỉ cần kết nối tới một MySQL Cluster Manager agent bất kỳ trong hệ thống và tạo site, package, cluster
Mình sẽ kết nối tới MySQL Cluster Manager agent đang chạy trên con black và chạy các lệnh sau:
+ Tạo site:
create site -h 192.168.1.104,192.168.1.105,192.168.1.106,192.168.1.107 mysite;


+ Tạo package:


add package -b c:/mcm/cluster pkg_svuit


+ Tạo Cluster:

  • black: 192.168.1.104 (mysqld + mgmt node)
  • green: 192.168.1.105 (mysqld + mgmt node)
  • blue: 192.168.1.106 (data node)
  • brown: 192.168.1.107 (data node)
create cluster -P pkg_svuit -R ndbd@192.168.1.104,ndbd@192.168.1.105,ndb_mgmd@192.168.1.106,ndb_mgmd@192.168.1.107,mysqld@192.168.1.106,mysqld@192.168.1.107 mycluster;


+ Show thông tin MySQL Cluster vừa tạo:
bạn có thể chạy lệnh show status -r mycluster; trên cả 4 server để xemt thông tin cluster đã tạo.
Hiện tại các node đang ở trạng thái added (trạng thái mới được thêm vào) và chưa được khởi động





+ Start MySQL Cluster:
Chạy lệnh start cluster mycluster; để khởi động MySQL Cluster (lưu ý chỉ cần chạy lệnh này trên 1 MySQL Cluster Manager agent bất kỳ), ở đây mình sẽ chạy trên Server black.
Sau khi chạy lệnh này sẽ mất một khoản thời gian để MySQL Cluster khởi động tất cả các node...

Các node sẽ chuyển từ trạng thái added>> starting>> running


Khi tất cả các node ở trạng thái running thì MySQL Cluster đã khởi động xong...



+ Show thông tin các node:
Trên các node Management Node, chạy lệnh ndb_mgm, sau đó chạy lệnh show



+ Show thông tin của site:


+ Backup MySQL Cluster:
backup cluster mycluster;
list backups mycluster;



+ Xem thông ID của node tiếp theo nếu được thêm vào hệ thống và port của MySQL Cluster
list nextnodeids mycluster;
get -d port:mysqld mycluster;



+ List process MySQL cluster:

+ Start/Stop Process MySQL Cluster:
vd: mcm> stop process 51 mycluster




mcm> start process 51 mycluster;




+ Stop/Start MySql Cluster:
Nếu bạn muốn Shutdown MySQL thì chạy các lệnh sau:
stop cluster mycluster;





+Stop MySQL Cluster Manager:
stop agents mysite;





Code:
[B]Danh sách các lệnh:[/B]
[COLOR=#000000][FONT=Courier New]mcm> list commands;[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]+---------------------------------------------------------------------+[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| Help                                                                |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]+---------------------------------------------------------------------+[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| COMMANDS                                                            |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]|                                                                     |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| abort backup         Abort an ongoing cluster backup.               |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| add hosts            Add hosts to site.                             |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| add package          Add a package alias.                           |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| add process          Add cluster process.                           |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| backup cluster       Backup a cluster.                              |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| change log-level     Change the log-level                           |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| change process       Change process type.                           |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| create cluster       Create a cluster.                              |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| create site          Create a site.                                 |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| delete cluster       Delete a cluster.                              |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| delete package       Delete a package.                              |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| delete site          Delete a site.                                 |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| get                  Get configuration variables.                   |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| list backups         List backup images.                            |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| list clusters        List all clusters.                             |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| list commands        List the help text.                            |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| list hosts           List hosts in site.                            |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| list nextnodeids     List next nodeids to be allocated.             |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| list packages        List all packages.                             |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| list processes       List processes.                                |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| list sites           List all sites.                                |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| reset                Reset configuration variables.                 |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| restart cluster      Restart a cluster.                             |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| restore cluster      Restore a cluster.                             |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| set                  Set configuration variables.                   |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| show status          Show cluster, process or operation status.     |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| start cluster        Start a cluster.                               |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| start process        Start a cluster process.                       |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| stop agents          Stop agents in site.                           |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| stop cluster         Stop a cluster.                                |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| stop process         Stop a cluster process.                        |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| upgrade cluster      Upgrade a cluster.                             |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| version              Print version information.                     |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]|                                                                     |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| GLOBAL OPTIONS                                                      |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| Options that can be used with all commands                          |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]|                                                                     |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]|       --help|-?            Print detailed help.                     |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]|                                                                     |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]| Use '<COMMAND> --help' to see verbose help for individual commands. |[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]+---------------------------------------------------------------------+[/FONT][/COLOR]
[COLOR=#000000][FONT=Courier New]42 rows in set (0.00 sec)[/FONT][/COLOR]

+ Xem thông tin các kết nối:
ESTABLISHED:






Xem thông tin các port LISTENING:
0.0.0.0:18620 - MySQL Cluster Manager agent

0.0.0.0:49152
0.0.0.0:49153
0.0.0.0:49154
0.0.0.0:49171
0.0.0.0:49172
0.0.0.0:49173
192.168.1.104:49285
192.168.1.104:49286
192.168.1.104:49287


0.0.0.0:18620 - MySQL Cluster Manager agent

0.0.0.0:49152
0.0.0.0:49153
0.0.0.0:49154
0.0.0.0:49171
0.0.0.0:49172
0.0.0.0:49173
192.168.1.105:49249
192.168.1.105:49250



0.0.0.0:3306 - MySQL Server
0.0.0.0:18620 - MySQL Cluster Manager agent
0.0.0.0:1186 - Management Server

0.0.0.0:49152
0.0.0.0:49153
0.0.0.0:49154
0.0.0.0:49171
0.0.0.0:49172
0.0.0.0:49173

0.0.0.0:3306 - MySQL Server
0.0.0.0:18620 - MySQL Cluster Manager agent
0.0.0.0:1186 - Management Server

0.0.0.0:49152
0.0.0.0:49153
0.0.0.0:49154
0.0.0.0:49171
0.0.0.0:49172
0.0.0.0:49173

 
Last edited:

About us

  • Securityzone.vn là một trang web chuyên về an ninh mạng và công nghệ thông tin. Trang web này cung cấp các bài viết, tin tức, video, diễn đàn và các dịch vụ liên quan đến lĩnh vực này. Securityzone.vn là một trong những cộng đồng IT lớn và uy tín tại Việt Nam, thu hút nhiều người quan tâm và tham gia. Securityzone.vn cũng là nơi để các chuyên gia, nhà nghiên cứu, sinh viên và người yêu thích an ninh mạng có thể trao đổi, học hỏi và chia sẻ kiến thức, kinh nghiệm và giải pháp về các vấn đề bảo mật trong thời đại số.

Quick Navigation

User Menu