环境:server1:172.25.4.1 rhel6.5
单机模式下的hadoop
参考官方文档:https://hadoop.apache.org/docs/r2.7.6/hadoop-project-dist/hadoop-common/SingleCluster.html
1、配置java环境
2、给hadoop的变量里添加java环境
3、生成数据
[hadoop@server1 hadoop-2.7.3]$ mkdir input
[hadoop@server1 hadoop-2.7.3]$ cp etc/hadoop/*.xml input/
[hadoop@server1 hadoop-2.7.3]$ du -h input/
52K input/
[hadoop@server1 hadoop-2.7.3]$ bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.3.jar grep input output 'dfs[a-z.]+'
18/11/12 16:06:00 INFO Configuration.deprecation: session.id is deprecated. Instead, use dfs.metrics.session-id
18/11/12 16:06:00 INFO jvm.JvmMetrics: Initializing JVM Metrics with processName=JobTracker, sessionId=
18/11/12 16:06:01 INFO input.FileInputFormat: Total input paths to process : 8
18/11/12 16:06:01 INFO mapreduce.JobSubmitter: number of splits:8
18/11/12 16:06:01 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_local547961790_0001
18/11/12 16:06:01 INFO mapreduce.Job: The url to track the job: http://localhost:8080/
18/11/12 16:06:01 INFO mapreduce.Job: Running job: job_local547961790_0001
18/11/12 16:06:01 INFO mapred.LocalJobRunner: OutputCommitter set in config null
18/11/12 16:06:01 INFO output.FileOutputCommitter: File Output Committer Algorithm version is 1
18/11/12 16:06:01 INFO mapred.LocalJobRunner: OutputCommitter is org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter
4、编写必要的配置文件
core-site.xml
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://172.25.4.1:9000</value>
</property>
</configuration>
hdfs-site.xml
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>
5、认证密钥
6、格式化文件系统
7、开启数据节点
7、创建目录,上传信息,下载信息
2018-11-12 17:48:21的屏幕截图.png 2018-11-12 17:48:43的屏幕截图.png 2018-11-12 17:48:56的屏幕截图.png 2018-11-12 17:49:10的屏幕截图.png
多个数据节点
server1:172.25.4.1
server2:172.25.4.2
server3:172.25.4.3
1、清除server1上的环境
2、在server2和server3上安装 nfs-utils ,共享server1上的数据。
2018-11-12 18:19:14的屏幕截图.png 2018-11-12 18:19:27的屏幕截图.png 2018-11-12 18:19:43的屏幕截图.png 2018-11-12 18:20:36的屏幕截图.png
server3同server2一模一样
server1上安装nfs-utils
3、配置认证
4、进行操作
2018-11-12 18:34:10的屏幕截图.png 2018-11-12 18:34:28的屏幕截图.png
2018-11-12 18:47:07的屏幕截图.png 2018-11-12 18:47:50的屏幕截图.png 2018-11-12 18:48:11的屏幕截图.png 2018-11-12 18:48:25的屏幕截图.png 2018-11-12 18:48:42的屏幕截图.png 2018-11-12 18:48:53的屏幕截图.png
2018-11-12 18:50:10的屏幕截图.png
添加节点和删除节点数据迁移
1、添加节点
新添加一个虚拟机server4,挂载server1,在server4上修改slaves添加172.25.4.4.开启节点服务。
2018-11-12 19:00:20的屏幕截图.png
记得先认证再开启节点服务
上传数据
2018-11-12 19:10:08的屏幕截图.png 2018-11-12 19:10:18的屏幕截图.png
2、删除节点
<configuration>
<property>
<name>dfs.replication</name>
<value>2</value>
</property>
<property>
<name>dfs.hosts.exclude</name>
<value>/home/hadoop/hadoop-2.7.3/etc/hadoop/exclude-hosts</value>
</property>
</configuration>
查看节点状态
网友评论