欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

超详细hadoop集群服务器安装配置教程

程序员文章站 2024-01-22 13:55:04
...

 

虚拟机以及Linux系统安装在之前的两篇分享中已经详细的介绍了方法,并且每一步的都配图了。如果有朋友还是看不懂,那我也爱莫能助了。本篇主要就hadoop服务器操作系统配置进行详细说明,hadoop安装会在下一篇文章中详细的介绍。

hadoop安装包用的是大快DKHadoop发行版,个人觉得DKHadoop的安装过程是比较简单,关于dkhadoop的安装在下一次的分享中再详细介绍吧。下面进入到本篇的主题——服务器操作系统配置教程


超详细hadoop集群服务器安装配置教程
            
    
    博客分类: 大数据hadoop hadoop 
 

 一、安装包准备

1、虚拟机分布式安装(三台及以上虚拟机)

若是个人电脑Windows系统或Linux系统,虚拟机上虚拟的三台服务器,则将安装包拷贝到服务器上,进行安装操作即可。

2、物理集群(三台及以上实体服务器)

  1. 外网下载模式

  2. 本地文件模式

    将安装包文件直接拷贝到实体服务器root目录下,进行安装操作即可。

    3、上传模式

    当服务器在机房,且无显示和输入设备的情况下,应用该模式。

    现将文件,安装在本地计算机上(默认为笔记本电脑,在机房现场),并将计算机与服务器连接,将安装包install、DKHInstall上传到服务器root目录下。

 

二、服务器操作系统配置教程

准备工作完成之后,就要进行服务器配置操作,首先必须三台服务器之间要互相ping通。所谓ping通,就是两台设备之间网络是通的。从一端发送一个数据包,另一端就能够收到,就代表两台设备是能够ping通了。

1、修改权限

目的:使install、DKHInstall两个安装包有可执行的权限。权限不足无法执行一些操作。install里面是脚本和所有组件,DKHInstall里面是安装界面。

步骤:在准备工作中拷贝安装包 install、DKHInstall到主节点目录后,修改文件权限。首先进入root目录,安装目录 install、DKHInstall的权限改为:文件所有者可读可写可执行,与文件所有者属于一个用户组的其他用户可读可执行,其他用户组可读可执行。

命令:

cd /root/

unzip DKHPlantform.zip

chmod -R 755 DKHPlantform

 

2、 搭建Hadoop集群设置SSH免密登录

目的:Hadoop运行过程中需要管理远端Hadoop守护进程,在Hadoop启动以后,NameNode是通过SSH(Secure Shell)来启动和停止各个DataNode上的各种守护进程的。这就必须在节点之间执行指令的时候是不需要输入密码的形式,所以我们需要配置SSH运用无密码公钥认证的形式,这样NameNode使用SSH无密码登录并启动DataName进程,同样原理,DataNode上也能使用SSH无密码登录到NameNode。

步骤:

1修改本机hosts文件,写入对应关系

为了区*域网内的每台主机,都会给主机配一个主机名,每台主机之间又是通过IP进行通信,但IP地址不方便记忆,所以配置主机名和IP映射能够实现主机之间的快速方便的访问。

命令:

vi /etc/hosts

通过按键盘上的insert或是I键进入编辑模式,编辑完成后按一下Esc键然后按一下按Shift+: 键,输入wq,后回车就可以保存。输入q!后回车则是放弃保存并退出.

进入编辑模式后,按照规则写入主机与ip的对应关系(主机名称dk41是自己命名的,如下图)例:

   192.168.1.41    dk41

192.168.1.42    dk42

192.168.1.43    dk43

 


超详细hadoop集群服务器安装配置教程
            
    
    博客分类: 大数据hadoop hadoop 
 

编辑完后,保存退出。把对应关系拷到其他两台或多台机器上。

命令:

scp  -r  /etc/hosts  192.168.1.42:/etc

scp  -r  /etc/hosts  192.168.1.43:/etc

2执行集群之间免密前的准备工作   

执行sshpass.sh的脚本的时候会去读sshhosts和sshslaves这两个文件,替换sshpass.sh中的master和slave文件。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

修改文件sshhosts,输入全部机器的主机名,每行一个主机名(如下图)

命令:

vi /root/DKHPlantform/autossh/sshhosts

通过按键盘上的insert或是I键进入编辑模式,编辑完成后按一下Esc键然后按一下按Shift+:键,输入wq,后回车就可以保存。输入q!后回车则是放弃保存并退出


超详细hadoop集群服务器安装配置教程
            
    
    博客分类: 大数据hadoop hadoop 
 

修改文件sshslaves,写入除主机名之外的所有机器名(如下图)

命令:

vi /root/DKHPlantform/autossh/sshslaves

通过按键盘上的insert或是I键进入编辑模式,编辑完成后按一下Esc键然后按一下按Shift+:键,输入wq,后回车就可以保存。输入q!后回车则是放弃保存并退出.

 


超详细hadoop集群服务器安装配置教程
            
    
    博客分类: 大数据hadoop hadoop 
 

 

3执行集群免密工作

命令:

cd /root/DKHPlantform/autossh

./autossh 主节点主机名 集群密码

例: ./autossh dk41 123456

4关闭防火墙

防止访问服务器时某些服务被拦截,需关闭防火墙。

命令:

cd /root/DKHPlantform/autossh

./offIptables.sh

 


超详细hadoop集群服务器安装配置教程
            
    
    博客分类: 大数据hadoop hadoop 
 

 

3、 安装双机热备份的MySQL

目的:存放Hive的元数据

步骤:

1)从主节点分发mySQL安装目录到第二节点

命令:

scp -r /root/DKHPlantform/mysqlInst/ 192.168.1.42:/root/

2)主节点执行:

命令:                                                                                                                                 

cd /root/DKHPlantform/mysqlInst/

./mysql.sh 1

从节点执行:

命令:

cd /root/mysqlInst/

./mysql.sh 2

 

3)执行成功之后执行热备份(两台机器上都要执行,两个ip互换,41上写42,42上写41,密码是MySQL的密码为:123456。平台内已经设定好,请勿修改):

命令:

source /etc/profile

./sync.sh 192.168.1.xxx(另一台mysql地址)

4、 创建数据库

目的:MySQL是一种关联数据库管理系统,关联数据库将数据保存在不同的表中,增加了速度并提高了灵活性。

步骤:

1导入MySQL数据表,只在主节点执行:

命令:

mysql -uroot -p123456 < { 此处为sql文件,主目录下文件: dkh.sql}

如:mysql -uroot -p123456 </root/DKHPlantform/dkh.sql

2执行完后查看一下两台mysql的数据表是否存在,从主节点中查看执行:

命令:

mySQL  -uroot  -p123456
show databases;

use dkh;

show tables;

 


超详细hadoop集群服务器安装配置教程
            
    
    博客分类: 大数据hadoop hadoop 
 

 

5、启动安装

目的:服务器配置操作完成之后,启动DKH。

步骤:执行以下命令。

命令:

cd /root/DKHPlantform/dkh-tomcat*/bin/

./startup.sh

6、本地时间服务器搭建步骤

没联网或者装系统时时间未同步,需要搭建本地时间服务器。

1)搭建内网的ntp服务器

修改/etc/ntp.conf

命令:

Vim /etc/ntp.conf

通过按键盘上的insert或是I键进入编辑模式,编辑完成后按一下Esc键然后按一下按Shift+:键,输入wq后回车就可以保存。输入q!后回车则是放弃保存并退出.

修改下列三行:

#server 0.centos.pool.ntp.org  

#server 1.centos.pool.ntp.org  

#server 2.centos.pool.ntp.org  

 在文件最后添加下列两行:

server  127.127.1.0   

fudge   127.127.1.0 stratum 10

2)启动ntp服务

service ntpd start

3)开机自动启动

chkconfig ntpd on

4)客户端同步时间

命令:

Vim /etc/ntp.conf

通过按键盘上的insert或是I键进入编辑模式,编辑完成后按一下Esc键然后按一下按Shift+:键,输入wq,后回车就可以保存。输入q!后回车则是放弃保存并退出.

在文件最后添加一行:

*/15 * * * * root ntpdate 192.168.27.35;hwclock -w 

 

  • 超详细hadoop集群服务器安装配置教程
            
    
    博客分类: 大数据hadoop hadoop 
  • 大小: 143.4 KB
  • 超详细hadoop集群服务器安装配置教程
            
    
    博客分类: 大数据hadoop hadoop 
  • 大小: 17.5 KB
  • 超详细hadoop集群服务器安装配置教程
            
    
    博客分类: 大数据hadoop hadoop 
  • 大小: 14.5 KB
  • 超详细hadoop集群服务器安装配置教程
            
    
    博客分类: 大数据hadoop hadoop 
  • 大小: 15.8 KB
  • 超详细hadoop集群服务器安装配置教程
            
    
    博客分类: 大数据hadoop hadoop 
  • 大小: 21.4 KB
  • 超详细hadoop集群服务器安装配置教程
            
    
    博客分类: 大数据hadoop hadoop 
  • 大小: 10.8 KB
相关标签: hadoop