Monday, November 9, 2015


Connect R with MYSQL database

  • Monday, November 9, 2015
  • R is simple and has more features.
    In this post we can see how write R code to connect Mysql DB which is installed in azure platform.

    I am using R studio .

     RJDBC package to connect Mysql.
    First install RJDBC  by using following command in R studio

    Here we are insert records in table and fetch the result by R script

    DB name is Department
    Table name is Maths


    mydb = dbConnect(MySQL(), user='root', password='root', host='', dbname="Department")

    To insert value in Maths table

    query1=dbGetQuery(mydb, "INSERT INTO Maths (StudentName, City) VALUES ('Saswath','Bangalore');")

    To fetch values from table Maths

    table_values <-dbGetQuery(mydb, "select * from Maths")


    You will get 

    Saswath   Bangalore

    then finally close the connection by


    Results are stored in Dataframe table_values , Now you can write r dataframe code .  RJDBC is easy and simple to connect R with mysql.


    Wednesday, November 4, 2015


    Ubuntu remote login xrdp failed error

  • Wednesday, November 4, 2015
  •  Remote Desktop Connection xrdp_mm_process_login_response: login failed in ubuntu Resolved:

     Today i got issues with my Remote login . I cant able to login from my windows machine to Ubuntu installed in  Azure cloud machine got following error.

    connecting to sesman ip port 3350
    sesman connect ok
    sending login info to sesman
    xrdp_mm_process_login_response: login failed

    I restarted the Ubuntu machine and recheck my username and password credentials, no luck . I guess there is problem with xrdp then find the solution . 
    Ubuntu supports multiple session,The issue could be X11 session created by xrdp.
     So i checked session in below path
    #cd /tmp/.X11-unix
    do #ls -lrt
    You can see results like
    srwxrwxrwx 1 root   root   0 Nov  4 05:20 X0
    srwxrwxrwx 1 userjay userjay 0 Nov  4 05:20 X10
    srwxrwxrwx 1 userjay userjay 0 Nov  4 05:36 X11
    srwxrwxrwx 1 userjay userjay 0 Nov  4 05:38 X12
    srwxrwxrwx 1 userjay userjay 0 Nov  4 05:39 X13
    srwxrwxrwx 1 userjay userjay 0 Nov  4 05:40 X14
    srwxrwxrwx 1 userjay userjay 0 Nov  4 05:66 X15
    srwxrwxrwx 1 userjay userjay 0 Nov  4 05:55 X16
    srwxrwxrwx 1 userjay userjay 0 Nov  4 05:56 X17
    srwxrwxrwx 1 userjay userjay 0 Nov  4 05:57 X18
    srwxrwxrwx 1 userjay userjay 0 Nov  4 05:59 X19
    Then i deleted X11,X12...X19 and restarted ubuntu now i can login to the  ubuntu machine.
    To delete use below command
    rm X11
    rm X12


    Saturday, October 19, 2013


    Hadoop-2.2.0 YARN Installation in Ubuntu Single node cluster

  • Saturday, October 19, 2013
  • Install Hadoop-2-2-0   YARN in ubuntu 


    •        Ubuntu OS
    •        JDK

    1.  hadoop -2.2.0 (YARN)  Download Hadoop-2.2.0 from here
    2.Extract Hadoop-2.2.0.tar.gz by following command
              $tar -xvf hadoop-2.2.0.tar.gz 

    create home  Directory for hadoop  I created hadoop/yarn under home  
    $mkdir -p /home/hadoop/yarn
    and move hadoop-2.2.0 folder  in to /home/hadoop/yarn
    For example if hadoop-2.2.0  is in Download folder
                   $sudo mv /home/Download  /home/hadoop/yarn
                   $sudo chmod -R 755 to /home/hadoop/yarn/hadoop-2.2.0

    set these following properties in ./bashrc
    export HADOOP_HOME=home/hadoop/yarn/hadoop-2.2.0
    export HADOOP_MAPRED_HOME=home/hadoop/yarn/hadoop-2.2.0
    export HADOOP_COMMON_HOME=home/hadoop/yarn/hadoop-2.2.0
    export HADOOP_HDFS_HOME=home/hadoop/yarn/hadoop-2.2.0
    export YARN_HOME=home/hadoop/yarn/hadoop-2.2.0
    export HADOOP_CONF_DIR=home/hadoop/yarn/hadoop-2.2.0/etc/hadoop
    Next create two directories for namenode and datanode
    by following command

         $mkdir -p yarn/yarn_data/hdfs/namenode
         $mkdir -p yarn/yarn_data/hdfs/datanode

    enter  to hadoop-2.2.0 by 
           $cd /home/hadoop/yarn/hadoop-2.2.0
    Finally set hadoop configuration in following files
    Use gedit its very simple than other editors

     $sudo gedit etc/hadoop/yarn-site.xml 
     $sudo gedit etc/hadoop/core-site.xml 
     $sudo gedit etc/hadoop/hdfs-site.xml 
    <value>file:/home/jaikumar123/hadoop/yarn/hadoop-2.2.0/yarn/yarn_data/hdfs/namenode      </value>
      <value>file:/home/jaikumar123/hadoop/yarn/hadoop-2.2.0/yarn/yarn_data/hdfs/datanode </value>
       $sudo gedit etc/hadoop/mapred-site.xml
    <?xml version="1.0"?>
     Format the namenode

        $sudo bin/hadoop namenode -format

    start hadoop daemon  services
        $sbin/ start namenode
        $sbin/ start datanode

    yarn daemon service
        $sbin/ start resourcemanager
        $sbin/ start nodemanager
        $sbin/ start historyserver

    if you have problem with  user privilege  switch in to root and try again
    Check Daemons are they started ...

        6450 JobHistoryServer
        6485 Jps
        6242 DataNode
        6377 NodeManager
        6155 NameNode
        6310 ResourceManager
    open resourcemanager page following URL in your browser