tar -zxvf apache-tomcat-5.5.25.tar.gzQ-N w(b h X o X { | x
[ o E4g*|#B O x,s下載的這個.tar.gz是編譯後的文件,只需要解壓即可。
M%_ t;s k Q l0`2F R GBSD愛好者樂園(t K t m N P1k
3. 配置BSD愛好者樂園 B n N w/{ l:y s ^
比如解壓後的文件都放在:/home/mahaibo/mysql-5.0.45-Linux-i686目錄下。BSD愛好者樂園;u ` q%v U j u r"D"U h }數據節點(ndbd),管理節點(mgmd),服務節點(MySQLd) 三個啟動順序是BSD愛好者樂園 B5P q6M$e \0l s*O
BSD愛好者樂園 A8Y B1o1T B$q6m
mgmd ---> ndbd ---> MySQLd
J P p r/H,R8q ^
l&b l r T可以在同一台電腦上做個簡單的配置和測試。以在同一台電腦上不同端口為例。實際中肯定是需要分布在不同的服務器上的。
/u q&w u ^ E6y/t7h d
+? C:`'V3@2@,~"F%ZA: 配置mgmd,並啟動BSD愛好者樂園)K)a!x*n1O.f+Y r.p U
BSD愛好者樂園 ^ i1L u C6O:J
在/home/mahaibo/MySQL-5.0.45-Linux-i686建立一個mgmd.cnf和mgmd的數據目錄mgmddata ,編輯mgmd.cnf文件:
# Options affecting ndbd processes on all data nodes: [NDBD DEFAULT] NoOfReplicas=1 # Number of replicas DataMemory=80M # How much memory to allocate for data storage IndexMemory=18M # How much memory to allocate for index storage # For DataMemory and IndexMemory, we have used the # default values. Since the "world" database takes up # only about 500KB, this should be more than enough for # this example Cluster setup. # TCP/IP options: [TCP DEFAULT] #portnumber=2202 # This the default; however, you can use any # port that is free for all the hosts in cluster # Note: It is recommended beginning with MySQL 5.0 that # you do not specify the portnumber at all and simply allow # the default value to be used instead # Management process options: [NDB_MGMD] hostname=127.0.0.1 # Hostname or IP address of MGM node ,mgmd's hostname datadir=/home/mahaibo/mysql-5.0.45-Linux-i686/mgmddata # Directory for MGM node logfiles PortNumber=2203 #default value: 1186 # Options for data node "A": [NDBD] # (one [NDBD] section per data node) hostname=127.0.0.1 # Hostname or IP address ,allow to Access datadir=/home/mahaibo/mysql-5.0.45-linux-i686/mgmddata # Directory for this data node's datafiles # Options for data node "B": [NDBD] hostname=127.0.0.1 # Hostname or IP address datadir=/home/mahaibo/mysql-5.0.45-Linux-i686/mgmddata # Directory for this data node's datafiles [MYSQLD] hostname=127.0.0.1 # Hostname or IP address # (additional MySQLd connections can be # specifIEd for this node for various # purposes such as running ndb_restore)
3^ l z J6E6q"I _可以看到配置了2個數據節點ndbd,也就是說改管理節點可以管理小於或等於2個數據節點。管理節點mgmd的端口為2203。
}!U ^ r%@(eBSD愛好者樂園 y'C0~(t+b
啟動mgmd服務:
bin/ndb_mgmd -f mgmd.cnfBSD愛好者樂園,O U n x p7P c
K s D"g ? l r啟動後,登錄mgmd的客戶端mgm可以查看具體信息:
C8t!c)k3E ?bin/ndb_mgm 127.0.0.1 2203 //因為mgmd服務用的端口是2203,所以要通過該端口鏈接
[mahaibo@client mysql-5.0.45-Linux-i686]$ bin/ndb_mgm 127.0.0.1 2203 -- NDB Cluster -- Management ClIEnt -- ndb_mgm> show Connected to Management Server at: 127.0.0.1:2203 Cluster Configuration --------------------- [ndbd(NDB)] 2 node(s) id=2 (not connected, accepting connect from 127.0.0.1) id=3 (not connected, accepting connect from 127.0.0.1) [ndb_mgmd(MGM)] 1 node(s) id=1 @127.0.0.1 (Version: 5.0.45) [MySQLd(API)] 1 node(s) id=4 (not connected, accepting connect from 127.0.0.1) ndb_mgm>BSD愛好者樂園5g V*t8g/C6b2S,s+?
[mysqld] DataDir=/home/mahaibo/mysql-5.0.45-Linux-i686/ndbd1data//數據目錄 skip-locking key_buffer = 16M max_allowed_packet = 1M table_cache = 64 sort_buffer_size = 512K net_buffer_length = 8K read_buffer_size = 256K read_rnd_buffer_size = 512K myisam_sort_buffer_size = 8M ndbcluster ndb-connectstring=127.0.0.1:2203 [MySQL_cluster] ndb-connectstring=127.0.0.1:2203 // 連接mgmd服務的ip與端口
y1v m S g T i啟動第一個ndbd數據節點
k Y z q ~4}7_ Mbin/ndbd --defaults-file=ndbd1.cnf --initialBSD愛好者樂園 m ~3R0b V
D4f n A:h9n i第一次啟動需要加--initial參數。BSD愛好者樂園 j F#N e*Y%E J ~ ^ k(T v @+M T @ ]第2個數據節點(ndbd)也需要做同樣的配置和啟動操作。分別建立ndbd2.cnf ,ndBD2data數據目錄BSD愛好者樂園 t O C A)D X b
ndBD2.cnf的配置和ndbd1.cnf的配置幾乎是一樣的,只是數據目錄不一樣。BSD愛好者樂園#d _ O k @'V;i
啟動第2個數據節點ndbd:BSD愛好者樂園4c w q P ^ s+y [(E
bin/ndbd --defaults-file=ndBD2.cnf --initialBSD愛好者樂園0t-} K b(M P
u a-P P"}這時,如果登錄到mgmd管理節點的客戶端mgm,BSD愛好者樂園2t A w&g }6|+G n w$n
[mahaibo@clIEnt MySQL-5.0.45-Linux-i686]$ bin/ndb_mgm
127.0.0.1 2203 -- NDB Cluster -- Management ClIEnt -- ndb_mgm>
show Connected to Management Server at: 127.0.0.1:2203 Cluster Configuration
--------------------- [ndbd(NDB)] 2 node(s) id=2
@127.0.0.1 (Version: 5.0.45, Nodegroup: 0, Master) id=3
@127.0.0.1 (Version: 5.0.45, Nodegroup: 1) [ndb_mgmd(MGM)] 1 node(s) id=1
@127.0.0.1 (Version: 5.0.45) [MySQLd(API)] 1 node(s) id=4 (not connected,
accepting connect from 127.0.0.1) ndb_mgm>
~/s } z5X A V可以看到ndbd的2個節點都是連接狀態了,而不是not connected狀態了,但是MySQLd還是not connected狀態。