iopeni - Think of C# :: iopeni - Think of C#

얼마전 VM을 이용하여 Linux에 Hadoop을 설치 하고 공부 하려고 했었는데.... 


암튼 불의의 사정으로 인하여 VM이 사라져 버리는 바람에... Hadoop은 포기해야 하나 생각 하던 중... 그냥 Windows에 Hadoop을 설치 하고 C#으로 프로그램이 가능하지 않을까? 하는 궁금증이 생겼고...


오늘은 그 궁금증을 해결 하는 날이다.


일단... Windows 10에 ANT를 설치 한다.. 


ANT다운로드 사이트는.... 


http://ant.apache.org/bindownload.cgi 


이곳이 되겠다.


이어 Java를 설치 한다...


자바의 다운로드 사이트는....


http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html


이곳이 되겠다.


그리고 나서 하둡을 다운로드 받는다..


http://www.apache.org/dyn/closer.cgi/hadoop/common/hadoop-2.8.0/hadoop-2.8.0.tar.gz 


이곳이 되시겠다. 


이제 JDK를 설치 하고 Hadoop과 Ant는 사용자가 원하는 임의의 폴더에 압축을 해제 한다. 


하둡 압축 해제 도충 다음과 같은 오류를 만나게 되면 무시 한다.




임의의 ANT 설치 폴더와 하둡 설치 폴더를 환경 변수에 등록 한다.



이렇게 설치 된 폴더를 등록 하고 Path를 등록 한다.




이 까지 완료 하였다면 하둡의 설치 경로가 C:\hadoop-2.8.0 일 경우라고 가정 할때 

아래 폴더를 생성 한다.


C:\hadoop-2.8.0\data

C:\hadoop-2.8.0\data\data

C:\hadoop-2.8.0\data\name


C:\Hadoop\temp

C:\Hadoop\userlog


다음 하둡의 환경 설정파일을 수정 하여야 한다.


C:\hadoop-2.8.0\etc\hadoop 디렉토리의 4가지 xml 파일을 수정 하여야 한다.


-- Core-site.XML -----------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>

<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<!--

  Licensed under the Apache License, Version 2.0 (the "License");

  you may not use this file except in compliance with the License.

  You may obtain a copy of the License at


    http://www.apache.org/licenses/LICENSE-2.0


  Unless required by applicable law or agreed to in writing, software

  distributed under the License is distributed on an "AS IS" BASIS,

  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  See the License for the specific language governing permissions and

  limitations under the License. See accompanying LICENSE file.

-->


<!-- Put site-specific property overrides in this file. -->


<configuration>

<property>

  <name>hadoop.tmp.dir</name>

  <value>C:\hadoop\temp</value>

</property>

<property>

<name>fs.default.name</name>

<value>hdfs://localhost:50071</value>

</property>

</configuration>


-- hdfs-site.XML -----------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>

<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<!--

  Licensed under the Apache License, Version 2.0 (the "License");

  you may not use this file except in compliance with the License.

  You may obtain a copy of the License at


    http://www.apache.org/licenses/LICENSE-2.0


  Unless required by applicable law or agreed to in writing, software

  distributed under the License is distributed on an "AS IS" BASIS,

  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  See the License for the specific language governing permissions and

  limitations under the License. See accompanying LICENSE file.

-->


<!-- Put site-specific property overrides in this file. -->


<configuration>

<property>

<name>dfs.replication</name>

<value>1</value>

</property>

<!-- 데이터를 저장할 생성 디렉토리 설정. -->

<property>

<name>dfs.namenode.name.dir</name>

<value>/hadoop-2.8.0/data/name</value>

<final>true</final>

</property>

<property>

<name>dfs.datanode.data.dir</name>

<value>/hadoop-2.8.0/data/data</value>

<final>true</final> 

</property> 

</configuration>


-- mapred-site.XML -----------------------------------------------------------------------

<?xml version="1.0"?>

<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<!--

  Licensed under the Apache License, Version 2.0 (the "License");

  you may not use this file except in compliance with the License.

  You may obtain a copy of the License at


    http://www.apache.org/licenses/LICENSE-2.0


  Unless required by applicable law or agreed to in writing, software

  distributed under the License is distributed on an "AS IS" BASIS,

  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  See the License for the specific language governing permissions and

  limitations under the License. See accompanying LICENSE file.

-->


<!-- Put site-specific property overrides in this file. -->


<configuration>

  <property>

  <name>mapreduce.framework.name</name>

  <value>yarn</value>

  </property>

<property>

  <name>mapred.job.tracker</name>

  <value>localhost:9001</value>

  </property>

<property>

<name>mapreduce.application.classpath</name> 

<value>/hadoop-2.8.0/share/hadoop/mapreduce/*,

  /hadoop-2.8.0/share/hadoop/mapreduce/lib/*,

  /hadoop-2.8.0/share/hadoop/common/*,

    /hadoop-2.8.0/share/hadoop/common/lib/*,

    /hadoop-2.8.0/share/hadoop/yarn/*,

  /hadoop-2.8.0/share/hadoop/yarn/lib/*,

  /hadoop-2.8.0/share/hadoop/hdfs/*,

  /hadoop-2.8.0/share/hadoop/hdfs/lib/*,

 </value>

</property>

</configuration>



-- yarn-site.XML -----------------------------------------------------------------------

<?xml version="1.0"?>

<!--

  Licensed under the Apache License, Version 2.0 (the "License");

  you may not use this file except in compliance with the License.

  You may obtain a copy of the License at


    http://www.apache.org/licenses/LICENSE-2.0


  Unless required by applicable law or agreed to in writing, software

  distributed under the License is distributed on an "AS IS" BASIS,

  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  See the License for the specific language governing permissions and

  limitations under the License. See accompanying LICENSE file.

-->

<configuration>


<!-- Site specific YARN configuration properties -->

<property>

 <name>yarn.nodemanager.aux-services</name>

 <value>mapreduce_shuffle</value>

 </property>

 <property>

 <name>yarn.nodemanager.aux-services.mapreduce.shuffle.class</name>

 <value>org.apache.hadoop.mapred.ShuffleHandler</value>

 </property>

<property>

 <name>yarn.nodemanager.log-dirs</name>

 <value>C:\hadoop\userlog</value>

 <final>true</final>

 </property>

 <property>

<name>yarn.nodemanager.local-dirs</name>

<value>C:\hadoop\temp\nm-localdir</value>

</property>

 <property>

 <name>yarn.nodemanager.delete.debug-delay-sec</name>

 <value>600</value>

 </property>

 <property><name>yarn.application.classpath</name>

 <value>/hadoop-2.8.0/,

       /hadoop-2.8.0/share/hadoop/common/*,

       /hadoop-2.8.0/share/hadoop/common/lib/*,

       /hadoop-2.8.0/share/hadoop/hdfs/*,

       /hadoop-2.8.0/share/hadoop/hdfs/lib/*,

       /hadoop-2.8.0/share/hadoop/mapreduce/*,

       /hadoop-2.8.0/share/hadoop/mapreduce/lib/*,

       /hadoop-2.8.0/share/hadoop/yarn/*,

       /hadoop-2.8.0/share/hadoop/yarn/lib/*

 </value>

 </property>


</configuration>



이후 재 부팅 하고 Hadoop의 버젼을 확인 해 보자. 


하둡 버젼 확인은 잘 된다. 


이제 하둡 namenode 포맷을 하면 된다.


hdfs namenode -format 


명령으로 포맷 한다.


이 후 hadoop의 sbin 디렉토리로 경로 이동하여 


start-all 명령을 실행 하면 다음과 같은 오류가 발생 한다. 


이 문제의 해결 방법은 위 에러 메시지에서 해결 방법을 안내 하고 있다. 


https://wiki.apache.org/hadoop/WindowsProblems


사이트의 내용을 읽어 보면...  

How to fix a missing WINUTILS.EXE

You can fix this problem in two ways

  1. Install a full native windows Hadoop version. The ASF does not currently (September 2015) release such a version; releases are available externally.
  2. Or: get the WINUTILS.EXE binary from a Hadoop redistribution. There is a repository of this for some Hadoop versions on github.

Then

  1. Set the environment variable %HADOOP_HOME% to point to the directory above the BIN dir containing WINUTILS.EXE.

  2. Or: run the Java process with the system property hadoop.home.dir set to the home directory.

이런 방법으로 해결 하라고 한다. 


난 그냥 winutils.exe를 찾아서 다운로드 받아 bin 디렉토리에 추가해 주었다. 


Hadoop-2.7.1_WinUtils.zip


다시 start-all 명령을 때리면 잘 동작 된다. 


그런데 PC를 다시 재부팅 하고나니 이거 참... 

또 에러가 뜬다. 에러의 종류가.. org.apache.hadoop.yarn.exceptions.YarnRuntimeException

요런 Error인데. cmd를 관리자 권한으로 실행 이후 start-all 명령 실행 하니 아주 잘 동작 한다.


이제.. Windows 10에 하둡 실행 완료


자 이제 C#으로 로컬 테스트만 성공 하면 되겠다. 

Posted by 프로그래머란 카페인을 코드로 변환하는 기계다
,