#AWS #EC2 #EBS #Automount #CentOS

Automatically Mount an EBS Volume Upon Starting an Amazon EC2 Linux Instance

Brief note to create an EBS volume then mount it while CentOS 6.3 on EC2 at boot. Show the space available on that filesystem before we mount the volume: # df -h Filesystem Size Used Avail Use% Mounted on /dev/xvde1 7.9G 4.0G 3.5G 54% / tmpfs 296M 0 296M 0% /dev/shm After we attach the EBS volume to an EC2 instance: # fdisk -l Disk /dev/xvde: 9663 MB, 9663676416 bytes 255 heads, 63 sectors/track, 1174 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00076be1 Device Boot Start End Blocks Id System /dev/xvde1 * 1 1045 8387584 83 Linux /dev/xvde2 1045 1175 1048576 82 Linux swap / Solaris Disk /dev/xvdt: 107. ...

Author 2 min
#MongoDB #Morphia #Java #NoSQL

Using MongoDB with Morphia

Morphia - The JVM Object Document Mapper for MongoDB. MongoDB is an extremely useful document-based database in NoSQL field. There are various drivers and client libraries in MongoDB Ecosystem and detailed manual to facilitate the developers to get into it shortly. In the beginning, we use MongoDB Java driver to manipulate CRUD operations on databases. Everything is running well but lots of BasicDBObject cause the code lack of readability and fluency. ...

Author 3 min
#MongoDB

Converting ISODate from MongoDB

I’m confused about the insertion operation with Date object via mongo-java-driver that always short of 8 hours where my place of residence is Taiwan (GMT+8). According to the enclosed references, we can observe that the incoming Date object will be set to ISO_8601_DATE_FORMAT as shown in the following code snippet. if (o instanceof Date) { Date d = (Date) o; SimpleDateFormat format = new SimpleDateFormat(ISO_8601_DATE_FORMAT); serialize(new BasicDBObject("$date", format.format(d)), buf); return; } An example next demonstrates that the given Date will plus 8 hours in the GMT+8 time zone. ...

Author 1 min
#Java #Jersey #Maven

Jersey Test Framework with Maven

Introduction This memo records the issues while executing the unit-test with Jersey Test framework. We use the Jersey framework to implement the RESTful Web services and employ the Maven to manage the dependencies in project. First of all, we add the jersey-test-framework-grizzly2 dependency to enable the test framework in pom.xml; Second, we deploy the application using Jersey specific servlet in web.xml. Finally, we have the following java files within Maven Archetype – maven-archetype-webapp: ...

Author 4 min
#Java #Jersey #Restful

A Jersey POJOMapping Example in Mapping Form Parameters

Jersey, RESTful Web Services in Java. In Java Servlet circumstance, we usually harvest the form parameters by using request.getParameter(“FORM_FIELD_NAME”) syntax. Now we can do it more elegant while enabling Jsersey’s POJOMapping features. The following example demonstrates the account registration scenario. Here we have a Account class, i.e., Account.java: public class Account { private String email; @JsonProperty("email") public String getEmail() { return email; } public void setEmail(String email) { this. ...

Author 2 min
#Hadoop #CentOS

Running Hadoop on CentOS 6 (Multi-Node Cluster)

This demonstration has been tested with the following software versions and network settings: Oracle VM VirtualBox 4.1.22 r80657 CentOS-6.3_x86_64 with Minimal Installation Hadoop 1.0.3 Hostname IP Address Roles hdp01 192.168.1.39 NameNode, JobTracker and DataNode hdp02 192.168.1.40 DataNode, TaskTracker hdp03 192.168.1.41 DataNode, TaskTracker Candidate CentOS VMs After installing the CentOS in VirtualBox, patch up system by applying all updates and install wget tool for future use. ...

Author 3 min