Skip to main content

Posts

Using MySQL as a Hive backend database

Hive let us use a SQL like (HiveQL) style to analyse large datasets with ad-hoc queries, and comes as a service on top of hdfs. It is easy to use and most SQL programmers can instant write some queries. The lack of the installation are the included derby DB, which is running on the node locally. For that Hive is not really multiuser-capable. To use Hive with more than one user you have to setup a backend database. The database will hold all metainformations regarding your tables, partitions, splits and rows. For that the database should be safe (maybe replication) or a HVA installation. I use 2 MySQL servers in a ESX Cluster environment with enabled binary logs (Active/Standby). Setup a server and install mysql-server version 5.1 and up. To get absolute safe you can setup a MySQL cluster ;) Let us configure the mysql-database: # cat /etc/my.cnf [mysqld_safe] socket      = /var/lib/mysql/mysql.sock [mysqld] user        = mysql pid-file ...

Secondary namenode data loss

Yes, that happen if you not configure your installation well. I got some mails from our customers regarding that problem.  The secondary namenode hadoop.tmp.dir have to redefined in core-site.xml to a directory outside of /tmp, because the most linux-servers cleanup /tmp when a server reboot. That causes a lost of last edit logs and fsimage, in fact the namenode could not be replayed at a server crash. Simply add a new property into core-site.xml: <property> <name>hadoop.tmp.dir</name> <value>/path/for/node/${ user.name }</value> </proper ty> restart the secondary namenode and you'll be save.  The same you should do with your hbase-configuration (hbase-site.xml): <property> <name>hbase.tmp.dir</name> <value>/path/for/node/${ user.name }</value> </proper ty>

Use hive to catch grabber

Get the logs from the farm via flume & syslog, mapreduce them in hive for  IP, how often / second, bytes, item and compare with "human" profiles. Get the data on the fly via sqlstream, processes back into Oracle and from there a loadbalancer could get the IPs for a smooth redirect and I process the data into a graphing system (connection from that IP): Hourly I check geolocation, whois, provider. Using pig.latin. Ready for first testing in our labs. And, of course, not a really performant task (yet) ;-)

Get an Hadoop cluster running in 20 minutes

Since Cloudera was starting to build a complete stack it is more easy to get a cluster up and running. They build rpm's for Redhat based systems, I use CentOS, the newest CDH build is CDH2, which comes with a lot nice addons. Thanks for the work, guys! What hardware we should use? Simple, moderate servers are pretty nice for. 2 CPU, 8 GB RAM, 4x750GB HDD will be enough. The master should have 4 CPU, 8 or more GB RAM and 100 GB RAID 5, we need that hardware twice.Why? The master is the most important server, hosting the namenode, jobtracker and, if you setup, ganglia. The hardware you use depends on your usecases, what I describe there works for eventanalysis and weblogs. But it will be a good start to see what power hadoop can deliver. The systems are located in the same rack so we can rack awareness moving in background. Use lvm and create a large directory, I use /opt/hadoop: # df -h /opt/hadoop/ Filesystem            Size  Used Avail Use...