<p>The project <strong><em>Data Collector Service</em></strong> is the default project of this semester’s lab class. We aimed at creating a swarm of microservices that serve the purposes of <em>data collection</em> and <em>presentation</em>. The project was accomplished with the help of the Swarmlab hybrid and venus.</p>
</div>
</div>
</div>
</div>
<divclass="sect2">
<h3id="_tools_services">2. Tools / services</h3>
<divclass="sidebarblock">
<divclass="content">
<divclass="paragraph">
<p>Besides the <ahref="http://docs.swarmlab.io/">Swarmlab</a> lab service, the following tools were used.<br></p>
<p>To install every prerequisite included in <em>package.json</em>, run<br></p>
</div>
<divclass="literalblock">
<divclass="content">
<pre>npm install</pre>
</div>
</div>
</div>
</div>
</div>
<divclass="sect2">
<h3id="_the_project">3. The project</h3>
<divclass="sect3">
<h4id="_first_part_deploying_the_network">3.1. First part : Deploying the network</h4>
<divclass="sidebarblock">
<divclass="content">
<divclass="paragraph">
<p>For this part, we used the <em>linux</em> lab room of the <em>swarmlab</em> service. By uploading a number of containers, we create a swarm of machines. These machines can collect data of any type, but for the testing purposes of this project they will collect data from <em>/tmp/log-in</em> directory. The automated data collection is achieved with the tool <em>fluentd</em>. With <em>ansible</em>, we managed to orchestrate the swarm machines in order to act the same way.</p>
With this script, the system will be updated and ansible will be downloaded in the Manager machine. Then, the ansible playbook <em>fluentd.yml</em> will run so that the required settings will be installed on every other machine of the swarm.</td>
Run this script to set fluentd on every machine. The tool will collect data of the directory <em>/tmp/log-in</em>, where every machine of the swarm stores the intended data.</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<divclass="sect3">
<h4id="_second_part_storing_data_in_a_database">3.2. Second part: Storing data in a database</h4>
<divclass="sidebarblock">
<divclass="content">
<divclass="paragraph">
<p>Although, storing data in files is enought for testing the tool, for the needs of our, total, project we connected the swarm with a <em>mongoDB</em> replica. The databases was uploaded in the lab network via the <em>swarmlab</em> service and it works as the following image indicates.<br>
<p>In the <em>mongoDB</em> replica network, we find 3 machines running a <em>mongoDB</em> service. The Primary is the first tasked with storing data, incomming from the Data Collector service, and presenting them back. If Primary is not available, one of the other two will carry through the jobs needed.</p>
</div>
<divclass="paragraph">
<p>From the Primary, or any other machine, of the <em>mongoDB</em> replica network, follo the steps:</p>