English 中文(简体)
AVRO - Environment Setup
  • 时间:2024-12-22

AVRO - Environment Setup


Previous Page Next Page  

Apache software foundation provides Avro with various releases. You can download the required release from Apache mirrors. Let us see, how to set up the environment to work with Avro −

Downloading Avro

To download Apache Avro, proceed with the following −

    Open the web page Apache.org. You will see the homepage of Apache Avro as shown below −

Avro Homepage

    Cpck on project → releases. You will get a pst of releases.

    Select the latest release which leads you to a download pnk.

    mirror.nexcess is one of the pnks where you can find the pst of all pbraries of different languages that Avro supports as shown below −

Avro Languages Supports

You can select and download the pbrary for any of the languages provided. In this tutorial, we use Java. Hence download the jar files avro-1.7.7.jar and avro-tools-1.7.7.jar.

Avro with Ecppse

To use Avro in Ecppse environment, you need to follow the steps given below −

    Step 1. Open ecppse.

    Step 2. Create a project.

    Step 3. Right-cpck on the project name. You will get a shortcut menu.

    Step 4. Cpck on Build Path. It leads you to another shortcut menu.

    Step 5. Cpck on Configure Build Path... You can see Properties window of your project as shown below −

Properties of Avro

    Step 6. Under pbraries tab, cpck on ADD EXternal JARs... button.

    Step 7. Select the jar file avro-1.77.jar you have downloaded.

    Step 8. Cpck on OK.

Avro with Maven

You can also get the Avro pbrary into your project using Maven. Given below is the pom.xml file for Avro.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="   http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

   <modelVersion>4.0.0</modelVersion>
   <groupId>Test</groupId>
   <artifactId>Test</artifactId>
   <version>0.0.1-SNAPSHOT</version>

   <build>
      <sourceDirectory>src</sourceDirectory>
      <plugins>
         <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
		
            <configuration>
               <source>1.7</source>
               <target>1.7</target>
            </configuration>
		
         </plugin>
      </plugins>
   </build>

   <dependencies>
      <dependency>
         <groupId>org.apache.avro</groupId>
         <artifactId>avro</artifactId>
         <version>1.7.7</version>
      </dependency>
	
      <dependency>
         <groupId>org.apache.avro</groupId>
         <artifactId>avro-tools</artifactId>
         <version>1.7.7</version>
      </dependency>
	
      <dependency>
         <groupId>org.apache.logging.log4j</groupId>
         <artifactId>log4j-api</artifactId>
         <version>2.0-beta9</version>
      </dependency>
	
      <dependency>
         <groupId>org.apache.logging.log4j</groupId>
         <artifactId>log4j-core</artifactId>
         <version>2.0-beta9</version>
      </dependency>
	
   </dependencies>

</project>

Setting Classpath

To work with Avro in Linux environment, download the following jar files −

    avro-1.77.jar

    avro-tools-1.77.jar

    log4j-api-2.0-beta9.jar

    og4j-core-2.0.beta9.jar.

Copy these files into a folder and set the classpath to the folder, in the ./bashrc file as shown below.

#class path for Avro
export CLASSPATH=$CLASSPATH://home/Hadoop/Avro_Work/jars/*

Setting CLASSPATH Advertisements