1.8 Ambari+HDP搭建hadoop(一)

总目录:http://08643.cn/p/e406a9bc93a9

Hadoop - 子目录:http://08643.cn/p/9428e443b7fd

Ambari+HDP简介

虚拟机准备

主机名 IP 角色 内存 核数 磁盘
ambari.lh.com 192.168.10.190 Ambari+HDP 2G 1 20G
master.lh.com 192.168.10.191 Master 2G 1 20G
slave1.lh.com 192.168.10.192 Slave1 2G 1 20G
slave2.lh.com 192.168.10.193 Slave2 2G 1 20G

环境配置

网络配置

ifcfg-ens33


其他几个也是这样配置。

hostname

[root@ambari ~] cat /etc/hostname
ambari.lh.com

修改主机名。

network

[root@ambari ~] cat /etc/sysconfig/network
# Created by anaconda
NETWORKING=yes
HOSTNAME=ambari.lh.com

配置主机名与网络状态的关系。

hosts

[root@ambari ~] cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.10.190 ambari.lh.com
192.168.10.191 master.lh.com
192.168.10.192 slave1.lh.com
192.168.10.193 slave2.lh.com

ip与主机名映射表。

关闭防火墙

systemctl stop firewalld.service
systemctl disable firewalld.service

服务配置

安装NTP时间同步服务

yum install ntp ntpdate -y

安装httpd服务

yum install httpd -y
systemctl start httpd.service
systemctl enable httpd.service
检查http

关闭SELinux

vim /etc/selinux/config
修改SELINUX=disabled

ssh免密登录

生成密钥

ssh-keygen -t rsa -f ~/.ssh/id_rsa

传输密钥

ssh-copy-id ambari.lh.com
ssh-copy-id master.lh.com
ssh-copy-id slave1.lh.com
ssh-copy-id slave2.lh.com

四台互传

[root@ambari .ssh] ssh-copy-id ambari.lh.com
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'ambari.lh.com (192.168.10.190)' can't be established.
ECDSA key fingerprint is SHA256:WHSTGFtt/3LnDgU60HxnG20y4sDogJb3ECIfA/2L3Mk.
ECDSA key fingerprint is MD5:53:ae:4a:0d:8e:55:3c:d7:17:44:c9:5b:00:67:a7:cb.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any th
at are already installed/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it 
is to install the new keysroot@ambari.lh.com's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'ambari.lh.com'"
and check to make sure that only the key(s) you wanted were added.

[root@ambari .ssh] ssh-copy-id master.lh.com
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'master.lh.com (192.168.10.191)' can't be established.
ECDSA key fingerprint is SHA256:WHSTGFtt/3LnDgU60HxnG20y4sDogJb3ECIfA/2L3Mk.
ECDSA key fingerprint is MD5:53:ae:4a:0d:8e:55:3c:d7:17:44:c9:5b:00:67:a7:cb.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any th
at are already installed/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it 
is to install the new keysroot@master.lh.com's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'master.lh.com'"
and check to make sure that only the key(s) you wanted were added.

[root@ambari .ssh] ssh-copy-id slave1.lh.com
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'slave1.lh.com (192.168.10.192)' can't be established.
ECDSA key fingerprint is SHA256:WHSTGFtt/3LnDgU60HxnG20y4sDogJb3ECIfA/2L3Mk.
ECDSA key fingerprint is MD5:53:ae:4a:0d:8e:55:3c:d7:17:44:c9:5b:00:67:a7:cb.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any th
at are already installed/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it 
is to install the new keysroot@slave1.lh.com's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'slave1.lh.com'"
and check to make sure that only the key(s) you wanted were added.

[root@ambari .ssh] ssh-copy-id slave2.lh.com
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'slave2.lh.com (192.168.10.193)' can't be established.
ECDSA key fingerprint is SHA256:WHSTGFtt/3LnDgU60HxnG20y4sDogJb3ECIfA/2L3Mk.
ECDSA key fingerprint is MD5:53:ae:4a:0d:8e:55:3c:d7:17:44:c9:5b:00:67:a7:cb.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any th
at are already installed/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it 
is to install the new keysroot@slave2.lh.com's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'slave2.lh.com'"
and check to make sure that only the key(s) you wanted were added.

jdk环境

首先创建放软件的文件夹。

cd /usr
mkdir hdk

然后上传安装包,解压

[root@ambari hdk] tar -zxvf jdk-1.8.tar.gz 
[root@ambari hdk] ll
总用量 155296
drwxr-xr-x. 8   10  143       255 6月  17 2014 jdk1.8.0_11
-rw-r--r--. 1 root root 159019376 4月   3 15:16 jdk-1.8.tar.gz
[root@ambari hdk] rm jdk-1.8.tar.gz 
rm:是否删除普通文件 "jdk-1.8.tar.gz"?y
[root@ambari hdk] mv jdk1.8.0_11/ jdk8
[root@ambari hdk] ll
总用量 0
drwxr-xr-x. 8 10 143 255 6月  17 2014 jdk8

配置环境变量

vi /etc/profile

# jdk8
export JAVA_HOME=/usr/hdk/jdk8
PATH=$JAVA_HOME/bin:$PATH

export PATH

刷新环境变量

[root@ambari hdk] source /etc/profile
[root@ambari hdk] java -version
java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)

把环境变量文件和jdk8目录传到其他节点上。

scp /etc/profile root@master.lh.com:/etc
scp /etc/profile root@slave1.lh.com:/etc
scp /etc/profile root@slave2.lh.com:/etc

scp -r jdk8/ root@master.lh.com:/usr/hdk
scp -r jdk8/ root@slave1.lh.com:/usr/hdk
scp -r jdk8/ root@slave2.lh.com:/usr/hdk

然后各自刷新环境变量。
这样四个节点的java环境就ok了。

mysql5.6

先检查是否已经安装了MySQL。

rpm -qa | grep mysql

返回空就是没有安装。

然后卸载mariadb数据库,因为在centos7中默认集成mariadb数据库。

rpm -qa|grep mariadb|xargs rpm -e --nodeps

检查是否卸掉

rpm -qa|grep -i mariadb

接着正式安装mysql5.6

下载

wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

安装

rpm -ivh mysql-community-release-el7-5.noarch.rpm

yum install mysql-server

设置服务

systemctl start mysqld.service #启动 mysql
systemctl restart mysqld.service #重启 mysql
systemctl stop mysqld.service #停止 mysql
systemctl enable mysqld.service #设置 mysql 开机启动

设置密码

mysql -u root

mysql> use mysql;
mysql> update user set password=PASSWORD("123456") where User='root';
mysql> flush privileges; 

设置远程访问

mysql> use mysql
mysql> select User, Host, Password from user;

mysql> update user set host='%' where host='localhost';
mysql> delete from user where Host='ambari.gey.com';
mysql> delete from user where Host='127.0.0.1';
mysql> delete from user where Host='::1';

mysql> flush privileges;
最后编辑于
?著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 214,100评论 6 493
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 91,308评论 3 388
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事?!?“怎么了?”我有些...
    开封第一讲书人阅读 159,718评论 0 349
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 57,275评论 1 287
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 66,376评论 6 386
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 50,454评论 1 292
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,464评论 3 412
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 38,248评论 0 269
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,686评论 1 306
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,974评论 2 328
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,150评论 1 342
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,817评论 4 337
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 40,484评论 3 322
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,140评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,374评论 1 267
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 47,012评论 2 365
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,041评论 2 351

推荐阅读更多精彩内容