Posts

Showing posts from 2012

Important Java Keytool commands

The Most Common Java Keytool Keystore Commands Java Keytool is a key and certificate management utility. It  allows users to manage their own public/private key pairs and certificates . It also allows users to cache certificates. Java Keytool stores the keys and certificates in what is called a keystore. By default the Java keystore is implemented as a file. It protects private keys with a password. A  Keytool keystore contains the private key and any certificates necessary to complete a chain of trust and establish the trustworthiness of the primary certificate. Each certificate in a Java keystore is associated with a unique alias. When creating a Java keystore you will first create the .jks file that will initially only contain the private key. You will then generate a  CSR  and have a certificate generated from it. Then you will import the certificate to the keystore including any root certificates. Java Keytool also several other functions that allow you to view the detail

MySQL as Hive metadata store

Hive is a data warehouse system for Hadoop that facilitates easy data summarization, ad-hoc queries, and the analysis of large datasets stored in Hadoop compatible file systems. Hive provides a mechanism to project structure onto this data and query the data using a SQL-like language called HiveQL. At the same time this language also allows traditional map/reduce programmers to plug in their custom mappers and reducers when it is inconvenient or inefficient to express this logic in HiveQL. By Default Hive uses a Derby database to store its metadata. But in most of the clustered production environments it need to have more stable and shareable store to share the metadata between cluster nodes. For Hive to enable those multiuser , remote access features it has to configure MySQL database as its metadata store. Following will give you a step by step way to configure it successfully.  Software versions Hadoop  : 1.0.3 Hive       : 0.9.0 Step 1 : Create hive-site.xml in ${HIVE_HO

Parsing XML using Java

The idea here is to parse the employees.xml file with content as below <?xml version="1.0" encoding="UTF-8"?> <Personnel>   <Employee type="permanent">         <Name>Seagull</Name>         <Id>3674</Id>         <Age>34</Age>    </Employee>   <Employee type="contract">         <Name>Robin</Name>         <Id>3675</Id>         <Age>25</Age>     </Employee>   <Employee type="permanent">         <Name>Crow</Name>         <Id>3676</Id>         <Age>28</Age>     </Employee> </Personnel> From the parsed content create a list of Employee objects and print it to the console. The output would be something like Employee Details - Name:Seagull, Type:permanent, Id:3674, Age:34. Employee Details - Name:Robin, Type:contract, Id:3675, Age:25. Employee Details - Name:Crow,