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

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

虚拟机以及Linux系统安装在以前的两篇分享中已经详细的介绍了方法,而且每一步的都配图了。若是有朋友仍是看不懂,那我也心有余而力不足了。本篇主要就hadoop服务器操做系统配置进行详细说明,hadoop安装会在下一篇文章中详细的介绍。sql

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

 1、安装包准备centos

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

如果我的电脑Windows系统或Linux系统,虚拟机上虚拟的三台服务器,则将安装包拷贝到服务器上,进行安装操做便可。服务器

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

  1. 外网下载模式
  2. 本地文件模式

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

三、上传模式分布式

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

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

 

2、服务器操做系统配置教程

准备工做完成以后,就要进行服务器配置操做,首先必须三台服务器之间要互相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

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

命令:

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!后回车则是放弃保存并退出.

修改文件sshslaves,写入除主机名以外的全部机器名(以下图)

命令:

vi /root/DKHPlantform/autossh/sshslaves

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

 

(3)执行集群免密工做

命令:

cd /root/DKHPlantform/autossh

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

例: ./autossh dk41 123456

(4)关闭防火墙

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

命令:

cd /root/DKHPlantform/autossh

./offIptables.sh

 

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;

 

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 

相关文章
相关标签/搜索