docker/hadoop/README.md
2018-07-28 17:30:46 +08:00

63 lines
1.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# hadoop 单机测试环境搭建
## 创建镜像
镜像构建源码请[参考](http://git.yangyufans.com/pub/docker/tree/master/hadoop)
```bash
docker build -t ccr.ccs.tencentyun.com/yy-dk/hadoop:2.6.0 .
```
## 从远程拉取镜像
```bash
docker pull ccr.ccs.tencentyun.com/yy-dk/hadoop:2.6.0
```
## 创建镜像
```bash
docker run -d \
--privileged=true \
-p 12580:22 \
-p 9870:9870 \
-p 50070:50070 \
-p 8020:8020 \
-p 8088:8088 \
-p 8042:8042 \
-v $PWD/conf:/conf \
-v $PWD/data:/data \
-v $PWD/logs:/logs \
--name hadoop \
ccr.ccs.tencentyun.com/yy-dk/hadoop:2.6.0
```
> conf:配置文件,若自己修改完配置文件放在本目录,会自动覆盖
> data:数据目录
> logs:日志文件目录
## 进入容器
```bash
docker exec -it hadoop /bin/bash
```
或者
```bash
ssh -p 12580 root@localhost
```
- 密码123456
## 格式化namenode
```bash
hdfs namenode -format
```
## 启动hdfs
```bash
start-dfs.sh
```
## 关闭hdfs
```bash
stop-dfs.sh
```
## 启动所有
```bash
start-all.sh
```