Find and share helpful community-sourced technical articles
Recently active
How to make Mysql Database as Hive’s instance:Install Mysql if not available:brew updatebrew doctorbrew upgradebrew install mysqlmysql.server restartmysql_secure_installationlogin to mysql -> mysql –u root –pEnter password:Happy Mysql learning….Mysql is already installed on Hortonworks sandbox. Steps:Confirm with mysql –u root –pImport an already available database into Mysql:Ref: https://dev.mysql.com/doc/employee/en/employees-installation.htmlshell> tar -xjf $HOME/Downloads/employees_db-full-1.0.6.tar.bz2 shell> cd employees_db/shell> mysql -t < employees.sqlWith this installation of employee db in mysql is complete.Configuration of Mysql Instance with Hive:From HIVE create Mysql metastore[root@host]# mysqladmin -u root create hivedbmysql> USE hivedb;mysql> CREATE USER 'hive'@'localhost' IDENTIFIED BY 'hive';mysql> GRANT ALL PRIVILEGES ON *.* TO 'hive'@'localhost';With this we confirm that mysql database is the Hive’s new metastore.Suppose to perform a full im
This article was inspired by How to configure knox with existing ssl certificate and a client engagement to give more clarity into the actual commands that you need run to setup Apache Knox for SSL and LDAP with existing certificates.Pre-requisitesYou need to get procure the following items from your security department before you begin:Your LDAP or AD Digital Certificate: <ldap>.crtThe company's Digital CA Cert: <company_ca>.crtThe certificate/ key pair for the gateway node: <gateway_node>.crt and <gateway_node>.pemThe passphrase for the above gateway node key.Your Knox Master Secret--------------------------------------------------------------------What if?You don't know the Knox Master Secret? Then you can change it as follows cd $gatewaybin/knoxcli.cmd create-master --force-- Delete Keystores and restart Knox> rm data/security/keystores/gateway.jks> rm data/security/keystores__gateway-credentials.jceks You don't have a signed cert from a trusted CA
Documentation referred: https://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.3.2/bk_installing_manually_book/content/configure-ranger_policy_admin_ha.htmlEnvironment Information: [ hivenv ] >> Cluster namehivenv-ambari-server.hwxblr.com >> 10.0.1.26 >> Ambari Server hn1.hwxblr.com >> 10.0.1.21 >> Existing Ranger Admin hn3.hwxblr.com >> 10.0.1.23 >> Load Balancer hn2.hwxblr.com >> 10.0.1.25 >> Additional Ranger Admin # hadoop version Hadoop 2.7.1.2.3.2.0-2950 Subversion git@github.com:hortonworks/hadoop.git -r5cc60e0003e33aa98205f18bccaeaf36cb193cc Compiled by jenkins on 2015-09-30T18:08Z Compiled with protoc 2.5.0 From source with checksum 69a3bf8c667267c2c252a54fbbf23d This command was run using /usr/hdp/2.3.2.0-2950/hadoop/lib/hadoop-common-2.7.1.2.3.2.0-2950.jar # uname -a Linux hn1.hwxblr.com 3.10.0-327.13.1.el7.x86_64 #1 SMP Thu Mar 31 16:04:38 UTC 2016x86_64 x86_64 x86_64 GNU/Linux # cat /etc/redhat-releas
One of the most common questions I come across when trying to help debug MapReduce jobs is: "How do I change the Log4j level for my job?" Many times, a user has a JAR with a class that implements Tool that they invoke using the hadoop jar command. The desire is to change the log level without changing any code or global configuration files:hadoop jar MyApplication.jar com.myorg.application.ApplicationJob <args ...>There is an extremely large amount of misinformation because how to do this has drastically changed from the 0.20.x and 1.x Apache Hadoop days. Most posts will inform you of some solution involving environment variables or passing Java opts to the mappers/reducers. In practice, there is actually a very straightforward solution.To change the Mapper Log4j level, set mapreduce.map.log.level. To change the Reducer Log4j level, set mapreduce.reduce.log.level. If for some reason you need to change the Log4j level on the MapReduce ApplicationMaster (e.g. to debug InputSplit
Sqoop can be used to bring data from RDBMS, but a limitation of sqoop is that data in HDFS is stored in one folder. If a partitioned table needs to be created in Hive for further queries, users need to create Hive script to distribute data to appropriate partitions. There is no direct option of creating partition tables based in Hive directly from sqoop.However, we can use sqoop features of putting output in a specific directory to simulate a partitioned table structure in HDFS. Since any partitioned table has a HDFS structure where each partition is <table name>/<partition column name=value> , we can use following sqoop structure to select appropriate data for each partition and move it to correct HDFS structure. sqoop --table <table1> --where <where clause for pt=0> --target-dir /home/user1/table1/pt=0 sqoop --table <table1> --where <where clause for pt=1> --target-dir /home/user1/table1/pt=1Now, an external HIVE table can be created that is poin
SQOOP CONNECTIONS:Sqoop is a tool designed to transfer data between Hadoop and relational databases. You can use Sqoop to import data from a relational database management system (RDBMS) such as MySQL or Oracle into the Hadoop Distributed File System (HDFS), transform the data in Hadoop MapReduce, and then export the data back into an RDBMS.Reference: sqoop user guide:https://sqoop.apache.org/docs/1.4.0-incubating/SqoopUserGuide.htmlJDBC ORACLE: Examples for Import:sqoop-import --connect jdbc:oracle:thin:@db.test.com:PORT:INSTANCE_NAME --table DW_DATAMART.HCM_EMPLOYEE_D --fields-terminated-by '\t' --lines-terminated-by '\n' --username SSANKU -Psqoop-import --connect jdbc:oracle:thin:@db.test.com:PORT:INSTANCE_NAME --table DW_DATAMART.HCM_EMPLOYEE_D --fields-terminated-by '\t' --lines-terminated-by '\n' --username SSANKU -PJDBC ORACLE: Example for Select:The eval tool allows users to quickly run simple SQL queries against a database; results are printed to the console. This allows user
Goals Get familiar with psql command line CLI interface for HAWQ Understanding how to access and list the options available for command line interface Accessing help from within the CLI NOTES Requirement for above is to ensure that there is either a sandbox configured with HAWQ A SSH interface to the sandbox either via HOST/remote OSX Or Putty when working with Windows Connecting to the Guest Sandbox Machine Depending upon the setup i.e., VirtualBox or VMWare Fusion for HAWQ & HDP, you can choose the connection method. For connecting via VMWare Fusion, you need to be aware of the IP address allocated to your virtual box. Connecting via VMWare Fusion HW13382:ODBC srai$ ssh root@172.16.105.137 -p 22root@172.16.105.137's password: Last login: Mon Jun 20 15:31:20 2016 from 172.16.105.1[root@sandbox ~]# Connecting via Virtualbox HW13382:ODBC srai$ ssh root@localhost -p 2222root@172.16.105.137's password: Last login: Mon Jun 20 15:31:29 2016 from 172.16.105.1[root@sandbox ~]#
Often times, maintaining a hadoop cluster for longer periods on cloud is an expensive task. Sometimes engineers might also encounter situations of not having immediate access to cloud environment, in order to quickly spin up their own cluster and play arround. As an easy alternative, vagrant with virtual box as a provider, HDP cluster can be set up on your own laptop.Step 1 - Install prerequisites Download and install from here Vagrant. Download and install Oracle VirtualBox as the Vagrant Provider.Step 2 - Generation of Vagrantfile Create a working directory for Vagrant file generation and initiating the deployment vis vagrant$ mkdir hdp22$ cd hdp22Following command will generate the Vagrantfile in current directory. This file will define VMs that are to be on the cluster.$ vagrant init $ vi VagrantfileStep 3 - Configuration of VMs in VagrantfileLets configure Vagrant to use CentOS 6.6/ CentOS 6.7 as the base box$ config.vm.box = "bento/centos-6.7" or $ config.vm.box = "chef/cento
WebHCat# this will execute a hive query and save result to hdfs file in your home directory called outputcurl -s -d execute="select+*+from+sample_08;" \ -d statusdir="output" \ 'http://localhost:50111/templeton/v1/hive?user.name=root'# if you ls on the directory, it will have two files, stderr and stdouthdfs dfs -ls output# if the job succeeded, you can cat the stdout file and view the resultshdfs dfs -cat output/stdout WebHDFS# list the output directory, notice the webhdfs portcurl -i "http://sandbox.hortonworks.com:50070/webhdfs/v1/user/root/output/?op=LISTSTATUS"# read the output filecurl -i -L "http://sandbox.hortonworks.com:50070/webhdfs/v1/user/root/output/stdout?op=OPEN"# rename a file, if you get dr. who error, add &user.name=root or any other user in the contextcurl -i -X PUT "sandbox.hortonworks.com:50070/webhdfs/v1/user/root/output/stdout?op=RENAME&user.name=root&destination=/user/root/newname"# read the output of the new filecurl -i -L "http://sandbox.horto
Choosing an approach for Kerberos implementation on Hadoop cluster is critical from a long term maintenance point. Enterprises have their own security policies and guidelines and a successful kerberos implementation needs to adhere to enterprise security architecture. There are multiple guides available on how to implement Kerberos but I couldn't find information on which approach to choose and Pros and Cons associated with each approach.In a Hortonworks Hadoop cluster, there are 3 different ways of generating keytabs and principals and managing them.a. Use an MIT KDC specific to Hadoop cluster - automated keytab management using AmbariKDC specific to Hadoop cluster can be installed and maintained on one of the Hadoop nodes. All users/keytabs required for kerberos implementation are automatically managed using Ambari.Pros:Enterprise security teams not involved with KDC setup. Hadoop administrators have complete control of KDC installation.Automated keytab management using Ambari. No ne
In this case, after we set up Hive and other MySQL-dependent services, we decided to hand MySQL responsibilities over to the DBA team so they could carry out specialized management including configuring an HA set-up. We therefore no longer wanted Ambari to run the MySQL server.The MySQL server was shut down and uninstalled from the host outside of Ambari, before we could do this cleanly via Ambari. Because of this, we had to carry out some extra steps to delete the component from Ambari. The following is mostly based on this HCC article by @Kuldeep Kulkarni. The version of Ambari in this case is 2.2.2.1.Deletion of the component from the host appears to have worked. localhost:~ nl$ curl -u admin:admin -X DELETE -H 'X-Requested-By:admin' http://localhost:8080/api/v1/clusters/mycluster/hosts/host005.hadoop.example.com/host_components/MYSQL_SERVERlocalhost:~ nl$ However, MySQL being stopped and uninstalled outside of Ambari appears to have caused an inconsistency, preventing the second AP
In order to distcp between two HDFS HA cluster (for example A and B), using nameservice id or to setup falcon clusters having namenode ha, these settings are needed. Assuming nameservice for cluster A and B is HAA and HAB respectively. One need to set following properties in hdfs-site.xml Add value of the nameservices of both clusters in dfs.nameservices. This needs to be done in both the clusters.dfs.nameservices=HAA,HABAdd property dfs.internal.nameservices In cluster A: dfs.internal.nameservices = HAA In cluster B: dfs.internal.nameservices = HAB Add dfs.ha.namenodes.<nameservice>.dfs.ha.namenodes.HAB=nn1,nn2dfs.ha.namenodes.HAA=nn1,nn2Add property dfs.namenode.rpc-address.<nameservice>.<nn>. dfs.namenode.rpc-address.HAB.nn1 = <NN1_fqdn>:8020dfs.namenode.rpc-address.HAB.nn2 = <NN2_fqdn>:8020dfs.namenode.rpc-address.HAA.nn1 = <NN1_fqdn>:8020 dfs.namenode.rpc-address.HAA.nn2 = <NN2_fqdn>:8020 Add property dfs.client.failover.proxy.provid
Lipstick InstallationResources:http://www.graphviz.org/Download_linux_rhel.phphttps://github.com/Netflix/Lipstick/wiki/Getting-StartedCommandssudo yum list available 'graphviz*'sudo yum -y install 'graphviz*'./gradlew assembleI always like to rename gradlew, avengers; then./gradlew run-appHit your browser to view:http://localhost:9292/Make sure you add that port/open firewall/etc...2016-06-17 02:36:44,558 [main] INFO org.apache.pig.tools.pigstats.mapreduce.SimplePigStats - Script Statistics:HadoopVersionPigVersionUserIdStartedAtFinishedAtFeatures2.4.0root2016-06-17 02:36:402016-06-17 02:36:44HASH_JOIN,FILTER,LIMITSuccess!Job Stats (time in seconds):JobIdMapsReducesMaxMapTimeMinMapTImeAvgMapTimeMedianMapTimeMaxReduceTimeMinReduceTimeAvgReduceTimeMedianReducetimeAliasFeatureOutputsjob_local2036219587_000121n/an/an/an/an/an/an/an/afruit_names_join,fruits,limited,namesHASH_JOINjob_local406327028_000211n/an/an/an/an/an/an/an/afruit_namesfile:/tmp/temp195796189/tmp-2027262369,Input(s):Succe
While using Order By operator in Pig Latin,If we have not mentioned ASC or DESC , by default it sorts by ASC order.ex- grunt >OrderedData = order studentDetails by age;This will sort by default in ASC order.Otherwise We can mention here as below:OrderedData = order studentDetails by age DESC;OrderedData = order studentDetails by age ASC;
Sometimes it's easy to share files:https://forums.virtualbox.org/viewtopic.php?t=15679You just pick a directory, set Auto-mount "Yes" and Access to "Full" and hit OK.For some of us, depending on versions of VirtualBox, the VM and host operating system; things might not work. It also can get broken when host operating system or VM updates.Log into the VM as root and try this (if it's HDP sandbox or another running Centos).cd /opt/VBoxGuestAdditions-*/init sudo ./vboxadd setupmodprobe -a vboxguest vboxsf vboxvideorm -rf /media/sf_Downloadsmkdir /media/sf_Downloadsmount -t vboxsf Downloads /media/sf_DownloadsFor me that worked and my Downloads directory was shared so I could move files to my Sandbox and off for development.There are some other things you can try and certainly rebooting everyone helps. For me, this worked fine.
First of all, you need a Hadoop user with correct permission with Ranger (I will use mine : mlanciau), some HDFS quota (if configured), and some YARN queue (I hope it is configured)For this example, I am using default Jenkins configuration with SSH plugin and the TeraSort benchmark suite.1. Configure SSH remote hosts in Jenkins by entering your credential (of course you can use different config)2. Create a new item (on the main portal), I called it Hadoop performance, then click on it and configure3. Click on "This project is parameterised" and add these 2 parameters (you may want to change the parameter ;-))4. Go to build and click on add a step to the build and choose Execute shell script on remote host using ssh5. Then use below information to configure the different scripts (you may want to configure your own user) hdfs dfs -rm -r -skipTrash /user/mlanciau/teragen ; echo 'deleting directory'hdfs dfs -rm -r -skipTrash /user/mlanciau/terasort ; echo 'deleting directory'hdfs dfs -rm -
A customer recently asked about the security capabilities of HIVE with regards to masking and encrypting specific fields within a HIVE table. After some research, I found that there are 4 such UDFs already available in the HIVE 1.3 release. Unfortunately, the customer was using HDP 2.3.0, which ships with HIVE 0.14, and thus they did NOT have access to these UDFs.https://cwiki.apache.org/confluence/display/Hive/L...Being the impatient type, and not wanting to reinvent the wheel, I created a simple github project to back-port these UDFs into, which can be found here: https://github.com/davidkj69/Backported-UDFsThen, I harvested the code from the Apache HIVE 1.3 trunk and added it to the repo, changed the library versions to Hive 0.14, and ran mvn build to generate the Backported-UDFs-0.0.1.jar, which I loaded onto HDFS in the /user/davidk directory. I then was able to test all of the functions as follows: hive> add jar Backported-UDFs-0.0.1.jar; hive> CREATE function sha1 AS 'org
Most code for current big data projects and for the code you are going to write is going to be JVM based (Java and Scala mostly). There is certainly a ton of R, Python, Shell and other languages. For this tutorial we will focus on JVM tools.The great thing about that is that Java and Scala Static Code Analysis Tools will work for analyzing your code. JUnit test are great for testing the basic code and making sure you isolate out functionality from Hadoop and Spark specific interfacing. General Java Tools for Testing http://junit.org/ http://checkstyle.sourceforge.net/http://pmd.github.io/pmd-5.4.2/pmd-java/rules/index.htmlTesting Hadoop (A Great Overview) https://github.com/mfjohnson/HadoopTestinghttps://www.infoq.com/articles/HadoopMRUnitExample:I have a Hive UDF written in Java that I can test via Junit to ensure that the main functionality works.(See: UtilTest)import static org.junit.Assert.assertEquals;import org.junit.Test; /** * Test method for * {@link com.data
H100 Unable to submit statement show databases like '*': org.apache.thrift.transport.TTransportException: java.net.SocketException: Broken pipe"The Ambari view throws the following error: H100 Unable to submit statement show databases like '*': org.apache.thrift.transport.TTransportException:java.net.SocketTimeoutException: Read timed out And I can no longer view database or run queries in the Ambari view. The problem appears to resolve itself after some time, but then will reappear after running a sequence of queries in the Hive view.1) This should be fixed in Ambari 2.22) Browser Refresh fixed it: When connection was open for too long then there was a broken pipe when you tried to access the hive view. When you did a restart to opened a fresh connection and was able to connect.
When working with HDP 2.3.2 sandbox... and running standard sqoop job which moves data from MySQL to Hive.. I ran into the following error:15/11/25 17:00:30 ERROR manager.SqlManager: Error reading from database: java.sql.SQLException: Streaming result set com.mysql.jdbc.RowDataDynamic@135b2072 is still active. No statements may be issued when any streaming result sets are open and in use on a given connection. Ensure that you have called .close() on any active streaming result sets before attempting more queries.java.sql.SQLException: Streaming result set com.mysql.jdbc.RowDataDynamic@135b2072 is still active. No statements may be issued when any streaming result sets are open and in use on a given connection. Ensure that you have called .close() on any active streaming result sets before attempting more queries.This was overcome by adding --driver com.mysql.jdbc.Driver to the end of my sqoop create job command, as such:sqoop job -create job1 --import --verbose --connect 'jdbc:mysql://
I was going to just do a REST call to the web service used in my NiFi. My example is on github with full scripts an source code. So I created a semi-useful quick prototype Hive UDF in Java called ProfanityRemover that converts many non-business friendly terms into asterisks (*). It's a small list for performance purposes (like 2,000 with some variations for spacing), but blocks the common ones. It does have a higher than you would like incidence of false positives. To this right you could use a commercial API or write some machine learning. Warning! src/main/resources and src/test/resources in github contain a list of offensive words. Building a Hive UDF To Build an Eclipse Project mvn eclipse:eclipse To Build ./build.sh To Build for Command-Line Usage (outside of Hive) ./buildfirst.sh (or) mvn clean compile assembly:single generates target/deprofaner-1.0-jar-with-dependencies.jar Copy deprofaner*jar to directory to run from or /usr/hdp/current/hive-client/lib/ mkdi
GoalsSetup HDB 2.0 on HDP 2.4.0.0 SandboxAccess HDB 2.0 via pgAdmin3 for interactive accessNotesThis effort is to get up and running with HDB 2.0 on Hortonworks 2.4.0.0 Tryout Sandbox. This steps mentioned here are not intended for production usage and should be merely used as reference.HDB, a.k.a HAWQ will eventually be integrated as a service similar to other addons like Hive, Hbase etceteraThis setup was completed using HDP 2.4.0.0 sandbox which can be downloaded hereArticle assumes that Sandbox is up and running on VMWare Fusion or Virtual boxReference for this article https://cwiki.apache.org/confluence/display/HAWQ/Build+and+InstallFor the purpose of convenience, we will use HAWQ as the term for HDB 2.0Installing HAWQ on HDP 2.4.0.0 HAWQ 2.0 is one of the latest release from Pivotal and can be configured in other version of HDP 2.x as reflected in the articles here:https://community.hortonworks.com/content/kbentry/20420/install-apache-hawq-on-hdp-234.html https://community.horton
In this example we will see how to use a self-signed certificate for initial trials to setup ambari console access over HTTPS. Remember that the self signed certificates are not suitable for production environments. So if your organization does not provide you with an SSL server certificate, you must request a new certificate that is signed by a CA. Users can use several methods to obtain a new signed certificate. For example, users can use Microsoft Internet Information Services (IIS) Manager to request an SSL server certificate from a CA. For testing purposes, you can obtain a free temporary certificate based on an untrusted root from many CAs. To know more about it refer to : https://en.wikipedia.org/wiki/Certificate_authority. This article is divided into 4 sections. Section-1). Generating keys self signed certificates. Section-2). Configuring Ambari Server to use the certificates. Section-3). Common troubleshooting steps.Section-4). Setting up the Ambari Server t
HAWQ is the Greenplum Database/Warehouse engine implemented on top of Hadoop Filesystem. To know GreenplumIt gives an edge to understand how relations are stored within Postgres OR Greenplum database (since Greenplum is based on Postgres, of course with certain optimizations to make it work in parallel and have a master/slave architecture). Unlike hive, a schema is an object within a database. In HAWQs world, this is the setup. HAWQ Cluster - Combination of HAWQ Master, Standby Master and Segment Hosts. All these machines are physical MASTER: Is a postgres master process, linux process, that can share the space with name node depending on the configuration and capacity of the Namenode. STANDBY: Is a replica of MASTER process which includes the logs and metadata information, transferred via log shipping ensuring near realtime replication. Can share the space with Standby/Secondary Namenode host. SEGMENT: Also known as compute nodes, are physical hosts which can host one or m
Atlas Quickstart creates a number of Tags. You may also have created some tags with the REST API. You may want to list the definition of a single Tag or Trait, or you may want a list of all Tags/Traits in Atlas. The following command will list all TRAITS or Tagscurl -iv -d -H "Content-Type: application/json" -X GET http://sandbox.hortonworks.com:21000/api/atlas/types?type=TRAITThe following response shows that I have seven Traits/Tags defined:{"results":["Dimension","ETL","Fact","JdbcAccess","Metric","PII","EXPIRES_ON"],"count":7,"requestId":"qtp1770708318-84 - 6efad306-cb19-4d12-8fd4-31f664e771eb"}The following command returns the definition of a Tag/Trait named, EXPIRES_ON:curl -iv -d -H "Content-Type: application/json" -X GET http://sandbox.hortonworks.com:21000/api/atlas/types/EXPIRES_ONFollowing is the response:{"typeName":"EXPIRES_ON","definition":"{\n \"enumTypes\":[\n \n ],\n \"structTypes\":[\n \n ],\n \"traitTypes\":[\n {\n \"superTypes\":[\n \n
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.