Upload logs from windows to hdfs

Source: Internet
Author: User

Windows: windows server2003
I am not familiar with cygwin. Fortunately, I just need to make a very simple application. With the help of my colleagues, I have finished this job. Here we will give you a general idea.
1. Install JDK and configure environment variables. Note that the installation path should not contain spaces or be installed in a directory similar to program files. Otherwise, cygwin may have problems.
2. Deploy hadoop. Directly pull a hadoop deployed on liux and deploy it locally. I put it in the root directory of drive D.
3. Install cygwin. There are several main components. I installed it in the root directory of drive D.
4. Create a windows user cloud. The user created here must be the same as the user running hadoop in linux. Otherwise, the system prompts that the user has no permission when uploading files.
5. Create a bat file for cloud users to call, write: D: \ cygwin \ bin \ bash -- login-I D: \ hadoop-0.20.2-CDH3B4 \ bin \ hadoop-ls \
The purpose of the above script is to test whether the hadoop command is successfully called through cygwin using a windows Script. After running this script as a cloud user, cygwin will create a cloud user directory under the home file under the installation directory!
6. After the above test is passed, create an sh file in the cloud user directory of cygwin, for example, upload. sh file, write: D:/hadoop-0.20.2-CDH3B4/bin/hadoop fs-put $ DIR/$ FILES $ HDFS.
Then, edit the bat file and change the following command to sh Script Name: D: \ cygwin \ bin \ bash -- login-I \ home \ cloud \ upload. sh.
7. other modifications are mainly made to hadoop configuration files. Generally, You Need To comment out the JAVA environment variables or change the slashes of some parts to windows.


Author "cool"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.