Uncategorized

Unix Useful

Remove Files Older than x Days Unix remove log files older than x days.. Type : find /path/to/files* -mtime +5 -exec rm {} \; Find Size of Directories To find the size of a set of directories :- Type : du -sh .  < current location / directory > reports size in MB/ i.e. cd…

Uncategorized

Linux User Management Scripts

Below some parameterised user management scripts for creating Unix users, and associated HDFS paths. create_user.sh #!/bin/bash # Call this script with 2 parameters, i.e. create_user.sh username password usage() { echo “Usage pass in username and password i.e. : create_user.sh username password” } if [ $# -ne 2 ] ; then usage else echo “Username is…

Uncategorized

Spark Graph – Write to Hive Table

A simple script below which uses Spark/Scala to generate a graph output, then write the contents of the connected nodes to a Hive table. Command Line – execute Spark job calling Scala file spark-shell –conf “spark.ui.port=1081” –driver-memory 20G –executor-memory 20G  -i graph_test.scala <graph_test.scala> import org.apache.spark._ import org.apache.spark.rdd.RDD import org.apache.spark.graphx.Edge import org.apache.spark.graphx.Graph import org.apache.spark.graphx.GraphLoader import org.apache.spark.SparkContext…

Uncategorized

Oracle – Big Compute

Below, a shell script which takes a file from a Object Store Container Copies the file locally Creates a Hive table from the content #!/bin/bash  CONTAINER=sc-oc-vm-dev-ace-01 DIRECTORY= PRICINGREPORT=”PriceReport_$(date +”%Y-%m-%d”).csv” LIVEAPPSDATA=”RMSLiveAppsData_$(date +”%Y-%m-%d”).csv” FILELINECOUNT=0 echo “Object Storage Container Name :” $CONTAINER echo “LiveApps Pricing Data File :” $PRICINGREPORT echo “LiveApps Data File :” $LIVEAPPSDATA echo “—————————————————————–“ echo…

Uncategorized

Spark Tips

Useful Spark Commands You can run Spark jobs via the command line. Some examples below, including just starting and configuring a session. Also how to query a hive table, and write back a Spark Data Frame to Hive table. Some useful hints below:- Start a Spark Session $>spark-shell Welcome to ____ __ / __/__ ___…

Uncategorized

OBIEE – monitor agent SQL

Some useful SQL below, to quickly find status and any warnings/error messages from a running OBIEE Agent select i.job_id, i.instance_id, J.name AS Agent_Name, i.status status_code, to_char(i.begin_ts,’DD/MM/YYYY HH24:MI:SS’) begin_ts, i.status as STATUS, case i.status when 0 then ‘Completed’ when 1 then ‘Running’ when 2 then ‘Failed’ when 3 then ‘Cancelled’ when 4 then ‘Timed-out’ when 5…

Uncategorized

OBIEE Apex

There are often times when you want to update values presented to a user on a dashboard page, but “writeback” is not a secure solution and offers no validation A workaround, is to embed an APEX form/application and pass values via a java script called with in an OBIEE analysis. Steps to Achieve this :-…