100% found this document useful (2 votes)
856 views10 pages

Project Setup

MySQL Clustering consists of two replication models - Asynchronous and Synchronous. Initial Setup aims at helping developers to setup the project. Code setup aims to Make the project more efficient.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
856 views10 pages

Project Setup

MySQL Clustering consists of two replication models - Asynchronous and Synchronous. Initial Setup aims at helping developers to setup the project. Code setup aims to Make the project more efficient.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Project Setup MySQL Clustering

Project Setup
The following procedure aims at helping developers to setup the project. The entire
setup is broken into two different parts – Initial setup and Code setup.

The project consists of two replication models – Asynchronous and Synchronous. The
following steps are common to both the models, unless explicitly mentioned.

Initial Setup
1. The project assumes that there are four systems, each with a different Operating
System – Windows Vista, Windows Server 2003, Fedora 10 and OpenSolaris
2008.11.
2. Install the four Operating Systems on four independent machines, or on four
different virtual machines of VirtualBox.
3. Make sure each Operating System has a unique IP address and all the four
systems are in a network.
4. Ping each system from the other three systems to check the integrity of the
network.

If using VirtualBox to setup the four Operating Systems, the following guide can
be used to setup the network –

Networking In VirtualBox

5. Install the MySQL server on all the four databases.


6. For the Asynchronous replication model, the following guides can be used –

Installing MySQL Community Server 5.1 – Windows


Installing MySQL Community Server 5.1 – Fedora
Installing MySQL Community Server 5.1 – OpenSolaris

For the Synchronous replication model, the following guides can be used –

Installing MySQL Cluster 7.0 – Windows


Installing MySQL Cluster 7.0– Fedora
Project Setup MySQL Clustering

Installing MySQL Cluster 7.0– OpenSolaris

7. Setup the replication process.


8. For the Asynchronous replication model, the following guide can be used –

Asynchronous Replication

For the Synchronous replication model, the following guide can be used –

Synchronous Replication

9. Make sure the replication process is running as it should.


10. Create the required databases and tables in the databases.
11. For the Asynchronous replication model, run the following SQL script in the
MySQL master –

01 create

If the replication process is running, the databases and tables will be created at
the slaves also.
12. For the Synchronous replication model, stop the slaves and run the following SQL
script at one of the MySQL nodes in the cluster –

01 create_ndb

At the slaves, run the following script –

01 create

Resynchronize the master properties in the slave and start the slaves.
13. That is it for the initial setup.

Moving to the code setup, there are two important ways in which these applications can
be executed – from the developer’s perspective using IDEs and from the end-user’s
perspective. The following procedures will describe both of them.
Project Setup MySQL Clustering

Code Setup – Developer Perspective


Required Tools – Java SE Development Kit, NetBeans 6.5 with all packs installed,
GlassFish v2, Visual Studio 2008 and a Web browser.

TelEx_WebService

1. Open the project TelEx_WebService in NetBeans 6.5.


2. If a Reference Problem comes up, close the dialog, right-click the project and
select “Resolve Reference Problems” and select the mysqljdbc.jar file (Included in
the web services directory of the project).
3. Make the following changes in the respective files.

IP addresses of databases 
TelEx_WebService -> Web Services -> TelEx (line 17)
TelEx_WebService -> Source Packages -> <default_package> ->
hibernate.cfg.xml [XML] (line 7)

User Names 
TelEx_WebService -> Web Services -> TelEx (line 18)

Passwords 
TelEx_WebService -> Web Services -> TelEx (line 19)

4. Right-click the project and select Deploy.


5. Right-click TelEx_WebService -> Web Services -> TelEx and select properties, a
URL is displayed below the name of the Web Service. This is the URL of the WSDL
file corresponding to the web service. Note down the URL. The number after
localhost in this URL is the port number and localhost denotes the location of the
GlassFish app server. localhost can be replaced with the IP address of the system
containing the GlassFish app server.

TelEx_ASPWebService

6. Open the project TelEx_ASPWebService in NetBeans 6.5.


Project Setup MySQL Clustering

7. Make the following changes in the respective files.

IP addresses and port numbers 


TelEx_ASPWebService -> Web Services -> TelEx_ASPWebService (line 14)

8. Add TelEx_WebService reference. (Procedure explained below)


9. Right-click the project and select Deploy.

TelEx_Swing

10. Open the project TelEx_Swing in NetBeans 6.5.


11. Make the following changes in the respective files.

IP addresses of databases 
TelEx_Swing -> Source Packages -> telex_swing -> TelEx_SwingView.java
[Source Code] (lines 1614, 1615, 1616 and 1617)

User Names 
TelEx_Swing -> Source Packages -> telex_swing -> TelEx_SwingView.java
[Source Code] (lines 1620, 1621, 1622 and 1623)

Passwords 
TelEx_Swing -> Source Packages -> telex_swing -> TelEx_SwingView.java
[Source Code] (lines 1620, 1621, 1622 and 1623)

12. Add TelEx_WebService reference. (Procedure explained below)


13. Right-click TelEx_Swing and select Run.

TelEx_VisualWebJSF

14. Open the project TelEx_VisualWebJSF in NetBeans 6.5.


15. Make the following changes in the respective files.

IP address and port of the app server 


TelEx_VisualWebJSF -> Web Pages -> main.html (lines 11, 12, 13, 16, 17 and 18)
Project Setup MySQL Clustering

TelEx_VisualWebJSF -> Web Pages -> options.jsp [JSP] (lines 17, 18, 19, 20, 25,
26, 27 and 28)
TelEx_VisualWebJSF -> Web Pages -> operations.jsp [JSP] (lines 24, 25, 26, 27,
29 and 32)
TelEx_VisualWebJSF -> Web Pages -> operations.jsp [Java] (line 34)
TelEx_VisualWebJSF -> Web Pages -> operationsUpdate.jsp [JSP] (lines 24, 25,
26, 27 and 29)
TelEx_VisualWebJSF -> Web Pages -> operationsUpdate.jsp [Java] (line 34)
TelEx_VisualWebJSF -> Web Pages -> success.jsp [JSP] (line 24)

IP addresses of databases 
TelEx_VisualWebJSF -> Web Pages -> success.jsp [Java] (lines 93, 94, 95 and 96)

User Names 
TelEx_VisualWebJSF -> Web Pages -> success.jsp [Java] (lines 99, 100, 101 and
102)

Passwords 
TelEx_VisualWebJSF -> Web Pages -> success.jsp [Java] (lines 105, 106, 107 and
108)

16. Add TelEx_WebService reference. (Procedure explained below)


17. Right-click TelEx_VisualWebJSF and select Run.

TelEx_J2MEWeb

18. Open the project TelEx_J2MEWeb in NetBeans 6.5.


19. Add TelEx_WebService reference. (Procedure explained below)
20. Right-click the project and select Deploy.

TelEx_J2ME

21. Open the project TelEx_Swing in NetBeans 6.5.


22. Make the following changes in the respective files.
Project Setup MySQL Clustering

IP address and port of the app server 


TelEx_J2ME -> Source Packages -> telex -> J2MEClient.java (line 34)
IP addresses of databases 
TelEx_Swing -> Source Packages -> telex -> TelEx_J2ME.java [Source Code] (lines
949, 950, 951 and 952)

User Names 
TelEx_Swing -> Source Packages -> telex -> TelEx_J2ME.java [Source Code] (lines
955, 956, 957 and 958)

Passwords 
TelEx_Swing -> Source Packages -> telex -> TelEx_J2ME.java [Source Code] (lines
961, 962, 963 and 964)

23. Allow all Mobile applications to connect to the internet without asking for
permission. (Procedure explained below)
24. Right-click TelEx_Swing and select Run.

TelEx_ASP.net

25. Open the project TelEx_ASP.net in Visual Studio 2008.


26. Move to telex_ASP.net -> Web References -> TelExWeb and change the Web
reference URL to the one obtained in step 5.
27. Make the following changes in the respective files.

IP address and port of the IIS server 


TelEx_ASP.net -> Main.aspx (lines 13, 14, 15, 17, 20, 21 and 22)
TelEx_ASP.net -> Options.aspx (line 10)
TelEx_ASP.net -> Summary.aspx (lines 58, 59, 60, 62, 63 and 64)
TelEx_ASP.net -> RecordSingle.aspx (line 43)
TelEx_ASP.net -> RecordDouble.aspx (line 42)
TelEx_ASP.net -> Operations.aspx.cs (lines 151 and 202)
TelEx_ASP.net -> Success.aspx.cs (lines 44 and 61)

IP addresses of databases 
Project Setup MySQL Clustering

TelEx_ASP.net -> Success.aspx.cs (lines 24, 25, 26 and 27)

User Names 
TelEx_ASP.net -> Success.aspx.cs (lines 30, 31, 32 and 33)

Passwords 
TelEx_ASP.net -> Success.aspx.cs (lines 36, 37, 38 and 39)

28. Right-click TelEx_ASP.net -> Main.aspx and select View in Browser.

Adding Web Service Reference

1. Right-click the project to which the web service reference is being added, and
select New -> Web Service Client.
2. While specifying the location, either link it via a project present in NetBeans 6.5,
i.e. TelEx_WebService -> TelEx. Or specify the WSDL URL obtained in step 5 of the
previous procedure.
3. The Web Service uses classes which are linked directly to the databases by an
ORM model. Because of this, there is a clash between the data-type of Date. The
Web Service layer and XML prefer to use the XMLGregorianCalendar whereas
Hibernate uses the pure Date object.
4. This problem has to be solved manually. In the Project Folder, search for
Teldetails.class and delete it. Search for Teldetails.java and make the following
changes –

replace “javax.xml.datatype.XMLGregorainCalendar” with “java.util.Date”


replace every instance of “XMLGregoraianCalendar” in the file with “Date”

5. Now the Web Service can be called from the project.

Allowing mobile applications to connect to the internet without asking for permission

1. Start the Sun Java Wireless Toolkit “KToolbar” application.


2. Select Edit, Preferences and locate the Security category and select the following
settings
Project Setup MySQL Clustering

Security policy – MSA


Security Domain – manufacturer

3. Save these preferences.


Project Setup MySQL Clustering

Code Setup – End-User Perspective


Required Client-Side Tools – The Java SE Development Kit and a Web browser.
Required Server-Side Tools – GlassFish v2 App Server and the IIS Server.

The above mentioned Developer’s perspective is useful in situations where the source
code is available or where the URLs of the Web Services Layer keep changing frequently.
However in several situations, the entire process can be tedious and is difficult for the
end users to follow. So instead of distributing the source codes, they are made available
for the client in simpler ways involving –

• Distributable binaries in the form of Java archive. This method brings all the
classes used in the application as a single java archive (.jar) and this archive can
be distributed to the clients. This method is used in Java Swing and Java Micro
Edition.
• Web Applications. Here the web page is made available to the clients, generally
through a network (Mainly Internet). Any client knowing the URL of the web page
can connect to it. This process is used in Java Server Faces and ASP.net. However,
this method requires servers to be constantly running remotely.

Pre-Requisites

1. Setup the databases and configure the initial setup as mentioned above.
2. Deploy the Web Services layer on the GlassFish v2 App Server.
3. The IP addresses of the Databases and Web Service should remain static and
should not change often. However if required, the databases and the app server
can be associated with URLs such that even if the IPs change, proper re-direction
should take place.

4. For the GUIs involving Java Swing and the Java Micro Edition, the same procedure
as described above should be followed. On compiling the project, a java archive is
created in the dist subfolder of the project folder. This java archive can be
distributed to various clients.

5. For the GUIs involving Java Server Faces and ASP.net, the same procedure as
described above should be followed.
Project Setup MySQL Clustering

6. However at the end, any client can connect either to the GlassFish v2 app server
(for JSF) or the IIS server (for ASP.net) through the appropriate URLs to access the
applications.

You might also like