> ## Content Index
> Fetch the complete content index at: https://sanghunkang.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# MaxOS Hadoop 설치
- URL: https://sanghunkang.com/ko/installing-hadoop-on-macos-ko/
- Published: 2017-12-02T00:00:00.000Z
- Updated: 2026-08-31T10:05:51.000Z
- Author: Sanghun Kang
- Tags: dev, #ko, hadoop, macOS

- 2.7.3기준으로 작성되어있음.
- `2.7.3`을 설치하고자 하는 버전으로 바꿔주세요.
- [참조](https://amodernstory.com/2014/09/23/installing-hadoop-on-mac-osx-yosemite/?ref=sanghunkang.com)

# Homebrew 설치

```bash
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

```

# Hadoop 설치

```bash
brew install hadoop

```

- `/usr/local/Cellar/hadoop`에 설치됨

# Hadoop 설정

## hadoop-env.sh 편집

- 파일 위치: ‘/usr/local/Cellar/hadoop/2.7.3/libexec/etc/hadoop/hadoop-env.sh’

이 부분을

```bash
export HADOOP_OPTS="$HADOOP_OPTS -Djava.net.preferIPv4Stack=true"

```

아래처럼 변경

```bash
export HADOOP_OPTS="$HADOOP_OPTS -Djava.net.preferIPv4Stack=true -Djava.security.krb5.realm= -Djava.security.krb5.kdc="

```

## Core-site.xml 편집

- 파일 위치: /usr/local/Cellar/hadoop/2.7.3/libexec/etc/hadoop/core-site.xml .

```xml
<configuration>
<property>
     <name>hadoop.tmp.dir</name>
     <value>/usr/local/Cellar/hadoop/hdfs/tmp</value>
     <description>A base for other temporary directories.</description>
  </property>
  <property>
     <name>fs.default.name</name>
     <value>hdfs://localhost:9000</value>
  </property>
</configuration>

```

## mapred-site.xml 편집

- 파일 위치: /usr/local/Cellar/hadoop/2.7.3/libexec/etc/hadoop/mapred-site.xml

```xml
<configuration>
<property>
<name>mapred.job.tracker</name>
<value>localhost:9010</value>
</property>
</configuration>

```

## hdfs-site.xml 편집

- 파일 위치: /usr/local/Cellar/hadoop/2.7.3/libexec/etc/hadoop/hdfs-site.xml

```xml
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>

```

## (Optional)alias 추가

- 나 같은 경우엔 zsh사용자라 .zshrc에 아래 내용 추가
- 추가 후 `source ~/.zshrc`

```bash
alias hstart="/usr/local/Cellar/hadoop/2.7.3/sbin/start-dfs.sh;/usr/local/Cellar/hadoop/2.6.0/sbin/start-yarn.sh"
alias hstop="/usr/local/Cellar/hadoop/2.7.3/sbin/stop-yarn.sh;/usr/local/Cellar/hadoop/2.6.0/sbin/stop-dfs.sh"

```

## format hdfs

`hdfs namenode -format`

# SSH Localhost

- ssh key를 이미 생성했다면 패스해도 됨.
- `ssh-keygen -t rsa`
- Enable Remote Login
  - “System Preferences” -> “Sharing”. Check “Remote Login”
- Authorize SSH Keys
  - `cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys`
- 테스트
  - `ssh localhost`
  - 로그인 되면 성공
  - `exit`로 종료

# Hadoop 실행&종료

- 위에서 만든 alias를 활용 하자.
- `hstart`
- `hstop`