Skip to main content

MySQL Clustering



MySQL Cluster is a technology for automatically shared database management system. i.e this technology create two or more replicas of the same data base in different nodes.  Basically mysql clustering is asynchronous communication technology.
The basics steps for establish mysql clustering is given below:
Step 1:
 Download supported version of mysql clustering installation zip file from       http://www.mysql.com/downloads/cluster/
Step 2:
  Extract the zip file and copy the contents inside the folder to  c:\Users\user1\mysqlc
Step 3:
Run the command prompt window as administrator role, And execute the following commands for create clustering directories
  
C:\Users\user1> mkdir my_cluster my_cluster\ndb_data my_cluster\mysqld_data my_cluster\conf
C:\Users\user1> mkdir my_cluster\mysqld_data\mysql my_cluster\mysqld_data\ndbinfo my_cluster\mysqld_data\performance_schema
Step 4:
Create configuration files for clustering; here I am using two systems (192.168.168.20,192.168.168.21)
Config.ini
[ndbd default]
noofreplicas=2

[ndbd]
hostname=192.168.168.20
NodeId=4

[ndbd]
hostname=192.168.168.21
NodeId=3

[ndb_mgmd]
NodeId = 102
hostname=192.168.168.20
[ndb_mgmd]
NodeId = 101
hostname=192.168.168.21

[mysqld]
NodeId=52
hostname=192.168.168.20

[mysqld]
NodeId=51
hostname=192.168.168.21


my.cnf  (This file is for the system with IP address 192.168.168.21)

[mysqld]
ndb-nodeid=51
ndbcluster
datadir=c:\\Users\\user1\\my_cluster\\mysqld_data
basedir=c:\\Users\\user1\\mysqlc
port=5000
server-id=51
log-bin

my.cnf  (This file is for the system with IP address 192.168.168.20)

[mysqld]
ndb-nodeid=52
ndbcluster
datadir=c:\\Users\\user1\\my_cluster\\mysqld_data
basedir=c:\\Users\\user1\\mysqlc
port=5000
server-id=52
log-bin

 ** Save both files(config.inf & my.cnf) in the location ‘C:\Users\User1\my_cluster\conf’

Step 5:
Execute the following command for copy the contents from mysqlc to clustering folders
C:\Users\user1>copy mysqlc\data\mysql my_cluster\mysqld_data\mysql
C:\Users\user1>copy mysqlc\data\ndbinfo my_cluster\mysqld_data\ndbinfo
C:\Users\user1>copy mysqlc\data\performance_schema my_cluster\mysqld_data\performance_schema

Note : Execute steps 1-5 in both systems

Step 6:
  Here we start the clustering process. Before that execute the code in both systems
   C:\Users\user1>cd my_cluster

  C:\Users\user1\my_cluster>start /B c:\Users\user1\mysqlc\bin\ndb_mgmd -f conf\config.ini --initial --
     configdir=c:\Users\user1\my_cluster\conf
After that execute the following code in 192.168.168.20

C:\Users\user1\my_cluster>start /B c:\Users\user1\mysqlc\bin\ndbd -c 192.168.168.20:1186

And then execute the following code in 192.168.168.21
C:\Users\user1\my_cluster>start /B c:\Users\user1\mysqlc\bin\ndbd -c 192.168.168.21:1186
For connecting API in between the  systems  execute the following command in both systems.
c:\Users\user1\my_cluster>start /B c:\Users\user1\mysqlc\bin\mysqld --defaults-file=conf\my.cnf

After this execution, we execute the the below command in both systems
 c:\Users\user1\mysqlc\bin\ndb_mgm -e show

then we get the following output


 










Step 7 :
Now the setup is completed, so we can start the mysql command  prompt  as
c:\Users\user1\my_cluster>c:\Users\user1\mysqlc\bin\mysql -h 127.0.0.1 -P5000 -u root
mysql> create database clusterdb;use clusterdb;
mysql> create table simples (id int not null primary key) engine=ndb;
mysql> insert into simples values (1),(2),(3),(4);








Popular posts from this blog

Tuning postgresql for better performance - ADempiere ERP

PostgreSQL is a highly customizable relational database management system (RDBMS) with a dazzling array of configuration options.   The postgresql.conf file is located in the \PostgreSQL\9.x\Data folder. You can tune the following sections of the postgresql.conf file to get the best performance.     CONNECTIONS AND AUTHENTICATION In this section change the following entries to the following: max_connections = 350 authentication_timeout = 7min RESOURCE USAGE (except WAL) In this section change the following entries to the following: shared_buffers = 256MB : PG Backends that need to access tables first look for needed blocks in this cache. If they are already there, they can continue processing right away. The change can be made with a   postmaster  command-line flag or by changing the value of   shared_buffers temp_buffers = 32MB max_prepared_transactions = 20 work_mem = 1024MB maintenance_work_mem = 1024MB QUERY TUNING effect...

Installation of Adempiere ERP on Windows

              This installation instruction is intended for initial installations where the database, application server and client all run on the same machine. For more complex installations, see   Installation Steps . An installation can take as little as 15 or 20 minutes if you start with the required downloads and do everything correctly. Other alternatives you might want to investigate are the   Windows Installer   or VMWare/VirtualBox AVA packages. However, the following method will give you much more control over the installation including upgrades with the latest patches and scripts. Before you begin, download each of the following packages: §   Java SE Development Kit   - Get the latest from   http://java.sun.com/javase/downloads/index.jsp . You only need the   JDK   without JavaFX, EE or NetBeans bundles. §   Postgre SQL   - Get the latest Windows install from   http://www.po...

Send Email Through Adempiere ERP

Send Email Through Adempiere E-Mail Configuration in Adempiere Mail Server This will specify the mail server to use Default: mailserver.(domain portion of %{serverFQDN}) Example: smtp.gmail.com Admin Email Use the default administrative mail address and it can be overwritten on client level Default: adempiere@(domain portion of %{ serverFQDN}) Example: teksalahadempiere@gmail.com Mail User Here we specify user of the default mail account Default: adempiere Example: teksalahadempiere Mail Password The password of the default mail account Default: adempiere Example: ********** 1    2.     Configuring Email in the client window The Client Definition Tab defines a unique client Step 1 .Login as admin Step  2 . Go to Menu -> System Admin -> Client Rules -> Client. In tab client fill fields’ mail host, request email request user and request user password. Finally press Test Em...