Tuesday, June 12, 2012

Collect varnish log using syslog-ng

Start the varnishd daemon,
image
then run varnishlog to see the heartbeat checking
image

run varnishncsa to get the apache like request log if you send some request
image

image

if using ab to send a lot request, you will see more log entries without surprise.
add one program to the source list,
image
then you will see the request log in the destination file.
image

How-to: Configure and Install Syslog-ng on centos 5 tutorial

Download and grab one version which has too tar files, one is lib called eventlog, another one is syslog.
image

compile and install eventlog lib which is required by syslog-ng,
image

once done, you can find the bit under /usr/local/share/pkgconfig
image

now export the path to the variable, PKG_CONFIG_PATH and configure syslog
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
otherwise you get error when you configure the syslog,
image

then ./configure && make && make install
you can run /usr/local/sbin/syslong-ng –V to show the version  information.
By default, syslog-ng.conf is located under /usr/share/etc

then change the conf file as the following, we will parse two sources one is from file, another from the syslog client. we will use nc as the testing client,

@version: 3.3
@include "scl.conf"
source localudp  {
        file('/tmp/inputtest.txt');
        udp();
};
destination f_local {
        file("/var/log/messages.txt");
};
log {
        source(localudp);

        destination(f_local);
};

then start the server in forground, syslog-ng –F
touch and put some words in the input file, you can tell the message was dumped to the destination.
image

test some stuff using nc,
image

Monday, June 11, 2012

How-to: using talend open studio for big data tutorial-3, write data to hbase

once we get data back by running a hive query, the result is always relatively small, so let’s dump it out to hbase. drag one component called hbaseoutput , and config the zookeeper info. that’s what you need to know about the hbase. ( it will figure out which hmaster is active, and which region server to serve the storage.)
image

Here table will be mapped to keyspace, and we create one random key, both two columns will be mapped the “profile” column family.
click advanced settings tabl to add this cf to the metadata
image

the it looks like this,
image

Let’s run it,
image

7 rows are insterted to the hbase and the table was created by talend also. and data is there!
image


So we did a simple big data etl job, load data from DB to hdfs, then write hive query to do the analysis, and result is pushed to hbase for application query.

hope this helps.

How-to: using talend open studio for big data tutorial-2, read Hive data

Once the data was loaded to HDFS, let’s create hive external table by using the hive shell.
   fist make sure data is there,
   image

Then using the hive shell to create one external table named customers
   

CREATE EXTERNAL TABLE customers(id INT, name STRING,
level STRING)
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\;'
STORED AS TEXTFILE
LOCATION '/usr/talend';

image
in order for the talend to connect to the hive, we need to start one hive thrift server.
image

 

Now let’s create one flow to read the data in hive. pick up the version ,and the thrift server ip/port, then put a hive query.
image

once import step, click the edit scheme and just add one column with type as object. then we will parse the result and map to our schema.
image

Click the advanced tab, to enable the parse query results, using the column we just created as object type.
image

drag the parserecordset component to the surface and conenct the mainout of hiverow to it, click edit schemas to do the mapping.
image

then match the values,
image

the the job looks like the following,
image

if we need to output the row, just put one logrow and connect, the final layout,
image

Now click to run this job, from the console it tell you whether it has connected to the hive server successfully, if failed, why.
image
on the hive server, it will show you it receive one query and parse it to mapreduce on the fly,
image
once done, you can see the results from the run console.
image

once done, we can export the result to Hbase to enable real-time application query. check it here,

How-to: using talend open studio for big data tutorial-1

Big data has been a hot-topic now, and Talend is very popular in the open source ETL community. however, there was not enough support for big data. recently, talend released a new product with the open source support called Talend Open Studio for Big Data. you can download it and play in your environment, it has built-in support for Big data. I will put several test cases here , then you can get an impression what does the product offer.
image
1. FROM DB to HDFS

for the db purpose , I just use the row generator to simulate the rows in db, put some simple logic to create one row serious with 3 columns, ID, name and level,

image

        Then drag and drop the hdfsoutput coponent to the surface, connect the major output of the row generator to the hdfs. for the hdfs, just specify the name node address, and the folder to hold the file
image
    then click to run the job, it will create a file for you which contains all the rows we generated in a CSV format.
image

remember to pickup the right version of you hadoop environment, and when done, you can tell the time taken to transfer the rows between two systems.
image

Once we export the data from traditional db to hdfs, we can run hive query to get the results , that’s the next case to test.

Thursday, May 31, 2012

Fatal error: Call to undefined function session_start() in Php 6

you may get this error you are not a PHP guy ,

Fatal error: Call to undefined function session_start()
run phpinfo session is enabled.

image

then what’s wrong? the answer is short. this functio has been removed since php 5.4, so your php is too new for this code.
image

 
Locations of visitors to this page