Blog Archives

Tungsten Replicator setting up and Gotchas

Tungsten Replicator site Clicky

So we have a big MYSQL server with mission critical data on it.

I want to replicate it accross to another MYSQL database, they are both ubuntu servers with Percona MYSQL database.

1. Preparation

Master – Install RUBY, JAVA,

Slave – Install RUBY, JAVA

edit the hosts files on both machines in etc/hosts and add the other servers in each one and reference the IP address – just makes things easier.

2. SSH

Make sure you set up SSH so that you can ssh from one server to the other WITHOUT using passwords.

3. PORTS

make sure all ports required 10000,10001 are available (particularly problematical PLESK, WEBMIN a whole host of things like these ports) on all machines. One server actually had a PLESK tool on it even though plesk was not installed!!

4. MYSQL

make sure everything is set up and restore a backup of the database before you start.

5. Helper scripts

Set up your tungsten. You’ll need to edit NODES_MASTER_SLAVE.sh to make sure your nodes are correct and USER_CONFIG as per the tungsten documentation.

install.sh – put in the tungsten folder e.g. tungsten-replicator-2.1.0-343

VERBOSE=1 ./cookbook/install_master_slave ./cookbook/NODES_MASTER_SLAVE.sh

tungsten.sh (actually I renamed this to tungsten and did a chmod +x tungsten)

if [ "$1" == "help" ] || [ "$1" == "" ]; then
 echo "Commands"
 ls installs/cookbook/tungsten/tungsten-replicator/bin/
else
installs/cookbook/tungsten/tungsten-replicator/bin/$1 $2 $3 $4 $5
fi

So you can type

./tungsten replicator status

To run commands.

Advertisements

Using Jasper Reports with Visual Web in Netbeans 6.5

Firstly Infragistics let us down – you can only use Infragistics for JSF with Netbeans 5.5 (Although the website just sasy “NETBEANS”) ,… Refund please.

So our requirements:-

Netbeans 6.5
Jasper Reports
Visual Web – Woodstock/Icefaces

1. DO NOT INSTALL the Jasper Reports Plugins into Netbeans 6.5 – it breaks Visual Web
2. to Edit Reports use the stand alone Jasper Reports applciation

Secondly we need to add Jasper Reports ENGINE only to the Netbeans project so that we can run the jasper reports without upsetting visual web.

Now we can install the icefaces plugins and use them with our project.

To do this, simply download the Jasper Reports JAR file and then create a library “JasperReports” and add it to your web project – this will give you the support you need.

Save your reports into the WEB folder and then use the other code I have on this blog to execute the reports you create in your external IReport application.

Important: http://facestutorials.icefaces.org/tutorial/woodstock/PortingGuidePart1.html < Read this first before adding icefaces to your project.

 Also you’ll find this 2 page crud useful as it contains both Icefaces and JSP pages. http://facestutorials.icefaces.org/tutorial/woodstock/TwoPageCrudTable_Part2.zip

 Page Locations

Your old JSP pages (Woodstock) will be located at http://localhost:8080/Project-war/faces/pagename.jsp

IceFaces Pages are at http://localhost:8080/Project-war/pagename.iface  

You will also find your project runs index.html which you should redirect to where you want by changing it to:-

<meta http-equiv=”refresh” content=”0;url=faces/Page1.jsp”>

Jasper Reports — those empty reports.

Jasper reports is a wonderful product .. and it does integrate really nicely with netbeans. But when it goes wrong you can get blank reports with no clue to what the problem is.

Here are some short observations when coding it up with java and JSF that might help you.

1. Watch your field names – I noticed that when you generated reports Jasper Reports writes a pretty odd query especially with SQL server 2000 at the back end (yes I know, some people still use it, although this one WILL be upgraded to MYSQL):-

SELECT
     tblZones.”ZoneDescription” AS tblZones_ZoneDescription
FROM
     “dbo”.”tblZones” tblZones
ORDER BY
  tblZones.”ZoneDescription

Now this is fine – so then the fields in the report are mapped to tblZones_ZoneDescription intead of just leaving it as is – so if you then have a custom query for the report make sure that you are using the right field names or you could get that “blank page thing”

2. Main/Subforms or header/details (you know, Purchase Order Header and lines) – getting sub forms to work is hard graft! – I will post a solution when we do it – but until then it’s easier to have a SINGLE query with a join have the lines in the detail and group by the header id.

3. When it all goes wrong – sometimes I’ve had it refusing to run the jasper reports report I created earlier in good Blue Peter fashion. Normally a restart of NetBeans does fix this – but sometimes I’ve found a CHKDSK.

4. BACK IT UP – EVERYONE who develops should use a repository system such as subversion or CVS it’s saved my life countless times.

Have fun!