Hadoop Map-reduce

Map step: mapper.py It will read data from STDIN, split it into words and output a list of lines mapping words to their (intermediate) counts to STDOUT. The Map script will not compute an (intermediate) sum of a word’s occurrences…

MySQL : Functions

DELETE WITH LIMIT helps when there are duplicate records in the DB and you want to keep only few records from them and wanted to delete the rest of all.       LIMIT with DELETE Query :-   mysql>…

MySQL : Replication Error 1062

One of the common error in MySQL Replication is ‘Duplicate Entry’ – Error 1062. This pop-ups only if there are any manual intervention. The SQL Thread stops with this error. Just check the record in the error on both master…

MongoDB Authentication

[root@my-host-name bin]$ cat /etc/mongod.conf # MongoDB Configuration File # # General Settings journal = true fork = true quiet = true directoryperdb = true smallfiles = true # Logging verbose = true logappend = true oplogSize = 50 #logpath =…

yum install “package” is Not working ?!!

How do we copy ‘Yum Repositories’ from one server to another :- Imagine, you have java package not available in your SERVER#1 and you know it is available with SERVER#2. Then you can copy the require yum repositories configs from…

MongoDB Diagnostic Tools/Utilities

MongoDb Inc. currently don’t have one-tool-for-any-troubleshooting-scenario. However, they have a number of tools that help with different aspects of trouble shooting. The best practice is (like in many other Monitoring/Troubleshooting apps) to have a holistic (NOC) view on overall system…

MySQL- SUBSTRING_INDEX – Select Patterns

Consider, a MySQL table having values in a column like below: SELECT location  FROM geo LIMIT 3; “location” “India.Karnataka.Shimoga.Gopala” “India.Karnataka.Bengaluru.BTM” “India.Karnataka.Chikmaglore.Koppa” My requirement is to take only 4th value from each of the rows(such as, Gopala,BTM,Koppa). I don’t want to…

Linux’s AWK

Linux: Adding Numbers in a File Here’s a Linux command to add numbers inside a file: [root@myserver misc]# cat num.test 1 2 3 4 5 This is a sample file with only 5 lines. Think of a file with millions…

Linux sorting, crontab & concat

Linux: Sorting a File Here’s simple ‘sort’ command that will remove the duplicate entry from any file and sort in ascending order:Consider a file with few numbers: [root@myhost tmp]# cat testSort.txt 23 4 56 001 34 3 To sort it:…

MySQL’s INTO OUTFILE for loading file

MySQL: SELECT / LOAD in Batch Here’s are the MySQL commands to extract data from  table and to load data into tables. Unlike other DBMS, MySQL offers SELECT..INTO.. and LOAD DATA.. commands are quite faster and convenient. Data would be…