Installation Guide

 

Installation Guide 

 

JCL properties file

Figure 1 - JCL properties file

JCL distorparell property indicates a fundamental characteristic of JCL – it is portable. A code for JCL lambari version can run over a cluster with JCL pacu version without refactoring. A true value indicates pacu version and the opposite a lambari version. Servermainport is the logical port where JCL server receives requests. The server IP must be defined in servermainadd property.

JCL super-peer must be configured. The Super Peer port that receives requests from hosts is defined in SuperPeerMainPort property.

JCL host must be also configured, so hostport and simpleserverport properties must be configured. RouterMainPortis the logical port where JCL server acceptsrequests from jclUsersand submits to JCL Super-peer and vice-versa.

Sometimes, we work in computer with more than one network card (NIC). In this situation, it is necessary to specify whichNIC the JCL will try to get the IP. To force the JCL to get the IP from a specific NIC, the developer must define its name.

A timeout must be defined to close some network communications among JCL user, server, super-peer and host components. It is defined 5 seconds (5000 milliseconds), so the developer can change this value.

When a Super-peer is used, it makes some network tunnels with the server. Using this strategy, no extra configuration is necessary, such asNAT or firewall configurations. The number of tunnels is defined in routerLink property. It is configured to have 5 tunnels, i.e. five Super-peers tunnels in a JCL cluster, so the developer can increase this number. It is important to know that tunnels generate bottlenecks in the server component, since all communications are bypassed by the server.

PBA is an optimization of JCL, where buffers of execute calls are put together and submitted in a unique JCL message to a JCL host. Such an optimization is very useful in JCL applications with several loops and recursive calls. Enablepba, pbasize and delta properties define PBA utilization. PBA is not enabled by default, so the developer must set to true and then change the number of calls in a buffer. The value configured to buffer size is 50 calls and delta 0.

JCL has a scheduler implemented in two complementary phases. The first phase, the number of task sent to a host is equal to the number of cores in such a host. The second phase, each host tries to help its neighbors, i.e. after the last task is completed, the scheduler tries to get a task from another host. The second phase of JCL scheduler can be enabled or disabled by setting TwoStep property.It is configured to be true, i.e. to adopt the collaborative behavior in scheduling.

JCL is elastic, i.e. it configures its workload periodically, so if the developer decides to reduce JCL to 50% of a machine JCL use 50% of number of cores without restarting. Usecore property is defined for such a purpose and its default value is 100% of the machine cores, i.e JCL working threads equal number of cores. Enabledinamicup property enables JCL user component to receive control data from JCL hosts. There are two timeouts definitions to discover a server and a host in a JCL cluster – properties findservertimeout and findhosttimeout. Finally, a verbose property.

DeviceType property indicates which services will be enabled on the Host. The possible values are:

      1. Only storage service;

      2. Only processing service;

      3. Storage and processing services;

      4. Only sensing service;

      5. Sensing and storage services;

      6. Sensing and processing services;

      7. Sensing, storage and processing services;

Encryption property is responsible for enabling or disabling cryptography on the messages sent by the Host to other JCL components. The properties mqttBrokerAdd and mqttBrokerPort allows the user to specify a MQTT Broker to send sensing data of IoT Hosts.

If you are interested in lambari JCL version, you just need to configure JCL-User jar file in your Java project and let’s understand how to develop in JCL with JCL programming guide. The downloaded zip file has several folders. The jcl_JARS_pacu folder has all necessary files used to run Lambari or Pacu versions, including JCL version with super-peers, useful for multi-cluster environments. Figure 2 illustrates how your eclipse Java project must be similar.

Figure 2. JCL project with examples to start developing in JCL

 

 JCL Pacu Version

 

We will install first the Pacu examples and next we assume it’s easy to start your own Java projects, since it is identical to lambari version explained in Figure 2.

First, download Pacu examples in JCL site. The downloaded zip file has several folders. Figure 3 illustrates such folders.

Figure 3. JCL Pacu folders

 

The jcl_JARS_pacu folder has all necessary files used to run Pacu version. The user first executes the JCL server. JCL server adopts the jcl_conf property file explained before. The developer must install only one server per cluster, i.e., per set of JCL hosts and super-peers. JCL requires the server port and IP configurations. Configure jcl_conf file before start it. Basically, set the IP of the server and a port to start listening. To run a JCL server just execute Server.bat (Windows) or Server.sh (Linux). A message “JCL Server ok!” must be printed in your prompt. Figure 4 illustrates this step.

 

Figure 4. How to run JCL Server

 

After server installation, we can run as many JCL hosts as you and your friends can have. Each machine must have a single JCL host. Copy the same downloaded zip file to each machine of your cluster.

The jcl_config folder must be configured. The properties file on each Host must be configured with Server machine IP and port. Without this IMPORTANT REQUIREMENT JCL Pacu version does not work, since the Hosts will not find the Server in the cluster. To run a JCL host, just execute Host.bat (Windows) or Host.sh (Linux). A message is presented in your prompt similar to:

machine with 4 cores

JCL started - mac: E0-B9-A5-3E-8B-13

In multi-cluster environments, there will be several machines managed by a super-peer and several super-peers managed by a server. This hierarchical structure is very useful for smart houses, universities, but also smart cities. The IoT is multi-cluster, where there is a cluster to swimming pool, monitoring this environment and communicating with a cloud to store the sensing data. The same ca be done for rooms and the garden, so JCL with super-peers is normal.

To install a super-peer, just configure it to access the server, i.e. configure the jcl_conf property file for that as you did for Hosts. After a super-peer, install several Hosts, but configure them to communicate with a super-peer and not the server, since the server is sometimes not reachable. Note that, a super-peer becomes a server for a small logical or physical network.

Finally, you must create a JCL Pacu application. Use the IDE Eclipse and import the java project in folder jcl_example1_pacu. Figure 2 illustrates the example to learn the basis of JCL Pacu or Lambari versions.

If you want to start all JCL components, just start a JCL server, after start a JCL super-peer, pointing it to JCL server, and finally start a JCL host, pointing it to JCL super-peer. You can start one server and how many super-peers and hosts you want. Note that, the network where the server is installed requires at least one Host or one Super-peer to work fine.

IMPORTANT: JCL bat and sh files are used to start Server, Super-peers and Hosts. You can configure Java heap before start these JCL components. By default, JCL configures 2GB of heap for Hosts and 1GB of heap for server and super-peer. Figure 5 illustrates the bat file for Host. For instance, JCL BIG Sorting requires at least 8GB per JCL host, since it executes Terabytes of data. Raspberry Pi clusters, Edisons or cubieboard clusters, on the other hand, normally requires 128 or 256MB for Java heap. Just DO NOT FORGET TO CONFIGURE JAVA HEAP ACCORDING TO YOUR NEEDS!!

Figure 5. Configure Java heap for each cluster machine

 

Creating a new project and start programming from the scratch

 

After you understand how to use Pacu, how to code the first JCL examples, it is time to start your own project.

In Eclipse, you can create a new Java project by clicking in File=>New=>JavaProject. Insert a name and you have your first empty project. Next, download Pacu Jar file in JCL site.

You should copy jclUser.jar to a folder in your project (usually the folder “lib” or “libs”). Such a jar file is injcl_JARS_pacu folder.

Figure 6. Copying jclUser.jar to lib folder

 

Then right click your project -> Build Path -> Configure Build Path.

 

Figure 7. Configuring Build Path

 

A window will be open. Click the “Add JARs…” button:

 

Figure 8. Add Jar to Build Path

 

Select the JAR file in the folder and click “OK”.

 

Figure 9. Adding jclUser.jar to Build Path

 

The next window illustrates that your project has jclHost.jar associated with it.

 

Figure 10. jclUser.jar added to Build Path

 

JCL IoT Installation Guide

 

HThe IoT version of JCL can be executed on boards with Linux support, Android devices and on Arduino MEGA. We show how to install the JCL-Host component on each platform.

 

Android

To install the JCL-Host on an Android device, it is necessary to install the JCL_Android.apk located in the JCL_Android/JCL_RELEASE folder. The installation occur in an intuitive way, such as any other Android application. The main screen of JCL-Host is composed by three tabs as shown in Figure 11. The main tab ("Compatibility") is responsible for starting the Host and also for bringing information about the supported sensors by the device.

 

Figure 11 - Main screen of JCL-Host on Android

 

The second tab ("Sensors configuration") allows the user to enable/disable sensors though the graphic interface in runtime, i.e, without programming code. Figure 12 illustrates this tab.

 

Figure 12 - Sensor list

It is only necessary to click on the desired sensor to enable it. A screen will pop-up as shown in Figure 13 where the user must inform the interval for collect sensing data in milisseconds and also the maximum number of registers that will be stored for that sensor. Figure 14 shows the modification of the interface when the sensors are enabled.

 

Figure 13 - Enabling a sensor

 

Figure 14 - Screen after configuring a sensor

Figure 15 ilustrates the third tab ("Host configuration"). It is similar to the config.properties file existing on the Java Hosts. Through this tab, the user inform the IP address and port of the JCL Server, of the MQTT server, the nickname of the device and others. These configurations must be defined before starting the Android Host.

Figure 15 - Host configuration tab

 Arduino

To install the JCL-Host on an Arduino MEGA, it is necessary to install the JCL_Arduino library located in the JCL_Arduino/libraries folder. JCL uses some external libraries for regular expression (https://github.com/nickgammon/Regexp), MQTT client (https://github.com/knolleary/pubsubclient), cryptography (https://github.com/DavyLandman/AESLib) and hash generation (https://github.com/Cathedrow/Cryptosuite). The libraries folder contains all these libraries and also the JCL library. The simpler way to install all necessary libraries to run JCL is to copy all the content of the libraries folder to the libraries folder of the Arduino installation. After that, one can import the JCL library to a sketch. Figure 16 shows an example of a sketch to start the JCL-Host on the Arduino. It is important to note that it was tested using the Ethernet W5100 shield.

 

Figure 16 - Arduino sketch example

Boards with Linux support

The JCL-Host used on the boards with Linux support is the same used in traditional computers and notebooks. Therefore, the installation process is the same presented in the beggining of this guide. However, to use sensing and actuating features, JCL uses the MRAA library (https://iotdk.intel.com/docs/master/mraa/). So it is necessary to compile this library on the board to use IoT features. The manual for compiling the library can be found at https://iotdk.intel.com/docs/master/mraa/building.html. After that, before starting the Host it is necessary to indicate the path where the MRAA library was compiled in the board though the directive Djava.library.path. This can be done by openning the Host.sh file and specifying the path as in the above example:

java -Djava.library.path=/home/root/mraa/build/src/java -jar JCL_Host-1.0.jar

 

How to develop your first JCL application? The answer is on Java Cá&Lá Programming Guide, compatible with Lambari and Pacu JCL versions.