Fundamental expect to setup grouping MySQL is to have repetition - you server and applications will run easily regardless of the fact that one server goes down.
Note:
For better execution you ought to have a third server as an administration hub
however this can be closed down after the bunch begins. Additionally take note
of that closing down the administration server is not prescribed (see the
additional notes at the base of this archive for more data). You can not run a
MySQL Cluster with only two Dedicated servers And have genuine excess.
It is
conceivable to set up the bunch on two Dedicated Servers you won't get the
capacity to "slaughter" one server and for the group to proceed as
typical. For this you require a third server running the administration hub.
Presently
beneath I had given the case for three servers:
mysql1.domain.com
- 192.168.0.1
mysql2.domain.com
- 192.168.0.2
mysql3.domain.com
- 192.168.0.3
Servers
1 and 2 will be the two that end up "bunched". This would be ideal
for two servers behind a heap balancer or utilizing round robin DNS and is a
decent trade for replication. Server 3 needs to have just minor changes made to
it and does NOT require a MySQL introduce. It can be a low-end machine and can
be completing different errands.
STAGE 1:
Install MySQL on the initial two servers:
Complete
the accompanying strides on both mysql1 and mysql2:
album/usr/neighborhood/
dev.mysql.com/get/Downloads/MySQL-4.1/mysql-max-4.1.9-pc-linux-gnu-i686.tar.gz/
from/signal42.com/mirrors/mysql/
groupadd
mysql
useradd
- g mysql
tar -
zxvf mysql-max-4.1.9-pc-linux-gnu-i686.tar.gz
rm
mysql-max-4.1.9-pc-linux-gnu-i686.tar.gz
ln - s
mysql-max-4.1.9-pc-linux-gnu-i686 mysql
compact
disc mysql
scripts/mysql_install_db
- user=mysql
chown -
R root .
chown -
R mysql information
chgrp -
R mysql .
cp
bolster documents/mysql.server/and so on/rc.d/init.d/
chmod
+x/and so on/rc.d/init.d/mysql.server
chkconfig
- include mysql.server
Try not
to begin MySQL yet.
STAGE 2:
Install and arrange the administration server
You
require the accompanying documents from the canister/of the mysql catalog:
ndb_mgm and ndb_mgmd. Download the entire mysql-max tarball and separate them
from the container/index.
mkdir/usr/src/mysql-mgm
compact
disc/usr/src/mysql-mgm
dev.mysql.com/get/Downloads/MySQL-4.1/mysql-max-4.1.9-pc-linux-gnu-i686.tar.gz/
from/www.signal42.com/mirrors/mysql/
tar -
zxvf mysql-max-4.1.9-pc-linux-gnu-i686.tar.gz
rm
mysql-max-4.1.9-pc-linux-gnu-i686.tar.gz
disc
mysql-max-4.1.9-pc-linux-gnu-i686
mv
canister/ndb_mgm .
mv
canister/ndb_mgmd .
chmod +x
ndb_mg*
mv
ndb_mg*/usr/canister/
disc
rm -
rf/usr/src/mysql-mgm
You now
need to set up the config document for this administration:
mkdir/var/lib/mysql-group
disc/var/lib/mysql-group
vi [or
emacs or some other editor] config.ini
Presently,
embed the accompanying (changing the bits as demonstrated):
[NDBD
DEFAULT]
NoOfReplicas=2
[MYSQLD
DEFAULT]
[NDB_MGMD
DEFAULT]
[TCP
DEFAULT]
#
Managment Server
[NDB_MGMD]
HostName=192.168.0.3
# the IP of THIS SERVER
#
Storage Engines
[NDBD]
HostName=192.168.0.1
# the IP of the FIRST SERVER
DataDir=/var/lib/mysql-bunch
[NDBD]
HostName=192.168.0.2
# the IP of the SECOND SERVER
DataDir=/var/lib/mysql-bunch
# 2
MySQL Clients
# I for
one leave this clear to permit fast changes of the mysql customers;
# you
can enter the hostnames of the above two servers here. I propose you dont.
[MYSQLD]
[MYSQLD]
Presently,
begin the administration server:
ndb_mgmd
This is
the MySQL administration server, not administration console. You ought to along
these lines not expect any yield (we will begin the console later).
STAGE 3:
Configure the capacity/SQL servers and begin MySQL
On each
of the two stockpiling/SQL servers (192.168.0.1 and 192.168.0.2) enter the
accompanying (changing the bits as fitting):
vi/and
so forth/my.cnf
Enter i
to go to embed mode again and embed this on both servers (changing the IP
location to the IP of the administration server that you set up in stage 2):
[mysqld]
ndbcluster
ndb-connectstring=192.168.0.3
# the IP of the MANAGMENT (THIRD) SERVER
[mysql_cluster]
ndb-connectstring=192.168.0.3
# the IP of the MANAGMENT (THIRD) SERVER
Presently,
we make the information index and begin the capacity motor:
mkdir/var/lib/mysql-group
compact
disc/var/lib/mysql-bunch
/usr/nearby/mysql/container/ndbd
- introductory
/and so
on/rc.d/init.d/mysql.server begin
In the
event that you have done one server now do a reversal to the begin of stage 3
and rehash the very same system on the second server.
Note:
you ought to ONLY utilize - beginning on the off chance that you are either
beginning without any preparation or have changed the config.ini record on the
administration.
STAGE 4:
Check its working
You can
now come back to the administration server (mysql3) and enter the
administration console:
/usr/nearby/mysql/canister/ndb_mgm
Enter
the charge SHOW to see what is going on. A specimen yield resembles this:
[root@mysql3
mysql-cluster]#/usr/nearby/mysql/canister/ndb_mgm
- NDB
Cluster - Management Client -
ndb_mgm>
appear
Associated
with Management Server at: localhost:1186
Group
Configuration
- -
[ndbd(NDB)]
2 node(s)
id=2
@192.168.0.1 (Version: 4.1.9, Nodegroup: 0, Master)
id=3 @192.168.0.2
(Version: 4.1.9, Nodegroup: 0)
[ndb_mgmd(MGM)]
1 node(s)
id=1
@192.168.0.3 (Version: 4.1.9)
[mysqld(API)]
2 node(s)
id=4
(Version: 4.1.9)
id=5
(Version: 4.1.9)
ndb_mgm>
In the
event that you see
not
associated, tolerating unite from 192.168.0.[1/2/3]
in the
first or last two lines they you have an issue. It would be ideal if you email
me with as much detail as you can give and I can attempt to discover where you
have turned out badly and change this HOWTO to alter it.
In the
event that you are OK to here the time has come to test MySQL. On either server
mysql1 or mysql2 enter the accompanying orders: Note that we have no root
secret word yet.
mysql
use
test;
Make
TABLE ctest (i INT) ENGINE=NDBCLUSTER;
Embed
INTO ctest () VALUES (1);
SELECT *
FROM ctest;
You
ought to see 1 line returned (with the worth 1).
In the
event that this works,which will likely happen, go to the next server and run
the same SELECT and see what you get. Embed from that host and do a reversal to
host 1 and check whether it works. In the event that it works then congrats.
The last
test is to slaughter one server to see what happens. In the event that you have
physical access to the machine just unplug its system link and check whether
the other server continues going fine (attempt the SELECT question). In the
event that you dont have physical access do the accompanying:
ps aux |
grep ndbd
You get
a yield like this:
root
5578 0.0 0.3 6220 1964 ? S 03:14 0:00 ndbd
root
5579 0.0 20.4 492072 102828 ? R 03:14 0:04 ndbd
root
23532 0.0 0.1 3680 684 pts/1 S 07:59 0:00 grep ndbd
For this
situation disregard the summon "grep ndbd" (the last line) yet
slaughter the initial two procedures by issuing the charge execute - 9 pid:
murder -
9 5578 5579
At that
point attempt the select on the other server. While you are grinding away run a
SHOW summon on the administration hub to see that the server has passed on. To
restart it, simply issue
ndbd
Note: no
- beginning!
Further
notes about setup
I
emphatically prescribe that you read the greater part of this (and bookmark
this page). It will probably spare you a great deal of looking.
The
Management Server
I
emphatically suggest that you don't stop the administration server once it has
begun. This is for a few reasons:
* The
server may scarcely require and take any server assets
* If a
group falls over, you need to have the capacity to quite recently ssh in and
sort ndbd to detail it. You won't have any desire to begin messing around with
another server
* You
require the administration server up If you need to take reinforcements
* The
group log is sent to the administration server so to check what is happening in
the bunch or has happened since last this is an imperative instrument
* All
summons from the ndb_mgm customer is sent to the administration server and
hence no administration orders without administration server.
* The
administration server is required if there should arise an occurrence of bunch
reconfiguration (smashed server or system split). For the situation that it is
not running, "split-mind" situation will happen. The administration
server assertion part is required for this kind of setup to give better
adaptation to non-critical failure.
http://arnserver.com/
No comments:
Post a Comment