搭建ambari

1.准备环境

2个ubantu系统(master,slave)

ambari的安装包:

ambari-2.7.3.0-ubuntu16.tar.gz

HDP-3.1.0.0-ubuntu16-deb.tar.gz

HDP-GPL-3.1.0.0-ubuntu16-gpl.tar.gz

HDP-UTILS-1.1.0.22-ubuntu16.tar.gz

2.安装jdk(不详细说,master,slave都要安装jdk)

3.配置两个机的主机名

#在你自己的master上:
root@student-virtual-machine:~# hostnamectl set-hostname master
root@student-virtual-machine:~# hostname
master
root@student-virtual-machine:~#


#在你的slave上:
root@student-virtual-machine:~# hostnamectl set-hostname slave
root@student-virtual-machine:~# hostname
slave
root@student-virtual-machine:~#

 4.修改映射文件

root@student-virtual-machine:~# vim /etc/hosts

#添加如下两行代码:(注意192.168.100.138是我自己的ip地址,根据自己ip地址设置)

192.168.100.138 master
192.168.100.136 slave

#master和slave中的映射文件都要修改,都添加以上内容

 5.master,slave都要配置ssh免密登陆

#在master上:

#安装ssh
root@student-virtual-machine:~# apt-get install openssh-server

#登陆本机(会发现拒绝访问)
root@student-virtual-machine:/home/student# ssh localhost
The authenticity of host 'localhost (127.0.0.1)' can't be established.
ECDSA key fingerprint is SHA256:mzbSukvowOq47pVauJTgPoqDGA3V7Ts6u3HbVU0qpgs.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.
root@localhost's password: 
Permission denied, please try again.
root@localhost's password: 
Permission denied, please try again.
root@localhost's password: 
Permission denied (publickey,password).

#拒绝访问的解决办法:
root@student-virtual-machine:/home/student# cd /etc/ssh/

root@student-virtual-machine:/etc/ssh# vim sshd_config
#修改如下内容:
#将sshd_config中的PermitRootLogin prohibit-password注释或者删除,
#然后添加PermitRootLogin yes


#PermitRootLogin prohibit-password
PermitRootLogin yes

#重启ssh服务
root@student-virtual-machine:/etc/ssh# service ssh restart

root@student-virtual-machine:/etc/ssh# cd ~/.ssh

root@student-virtual-machine:~/.ssh# ls
known_hosts

#生成密钥:
root@student-virtual-machine:~/.ssh# ssh-keygen -t rsa

#实现免密登陆:
root@student-virtual-machine:~/.ssh# ssh-copy-id master

root@student-virtual-machine:~/.ssh# ssh-copy-id slave

#验证免密登陆是否成功:测试登陆master免密登陆是否成功(出现Welcome to..则成功了)
root@student-virtual-machine:~/.ssh# ssh master

root@master:~# exit

#测试本机的免密登陆是否成功
root@student-virtual-machine:~/.ssh# ssh slave

root@slave:~# exit

#验证免密登陆两台机器上都要进行
#在slave上:

#安装ssh
#步骤和master上一样就不多说了

6.在master上安装ntp

root@master:~# apt-get install ntp
root@master:~#ntpq -q
root@master:~#ntpq
ntpq> exit
root@master:~#service ntp enable
root@master:~#service ntp start

7.在slave上安装ntpdata

root@slave:~# apt-get install ntpdate

root@slave:~# ntpdate master
30 Dec 09:21:57 ntpdate[6228]: adjust time server 192.168.100.138 offset 0.023626 sec

#在slave上也要安装ntp步骤和master上的一样

 8.在master上安装apache2

root@master:~# apt-get install apache2

root@master:/var/www/html# ll
total 20
drwxr-xr-x 2 root root  4096 12月 30 09:04 ./
drwxr-xr-x 3 root root  4096 12月 30 09:04 ../
-rw-r--r-- 1 root root 11321 12月 30 09:04 index.html

#将四个安装包解压到/var/www/html/下面
root@master:/mnt/hgfs/ambari# tar -zxvf ambari-2.7.3.0-ubuntu16.tar.gz -C /var/www/html/

root@master:/mnt/hgfs/ambari# tar -zxvf HDP-UTILS-1.1.0.22-ubuntu16.tar.gz -C /var/www/html/

root@master:/mnt/hgfs/ambari# tar -zxvf HDP-3.1.0.0-ubuntu16-deb.tar.gz -C /var/www/html/

root@master:/mnt/hgfs/ambari# tar -zxvf HDP-GPL-3.1.0.0-ubuntu16-gpl.tar.gz -C /var/www/html/

root@master:/etc# cd apache2

root@master:/etc/apache2# ls
apache2.conf     conf-enabled  mods-available  sites-available
apache2.conf.in  envvars       mods-enabled    sites-enabled
conf-available   magic         ports.conf

root@master:/etc/apache2# vim ports.conf
#将端口改成8089
Listen 8089

#重启apche2服务
root@master:/etc/apache2# service apache2 restart

root@master:/etc/apache2# cd /etc/apt

root@master:/etc/apt# cd sources.list.d

root@master:/etc/apt/sources.list.d# ll
total 8
drwxr-xr-x 2 root root 4096 4月  14  2016 ./
drwxr-xr-x 7 root root 4096 12月 23 17:06 ../

root@master:/etc/apt/sources.list.d# vim ambari.list
#添加内容:
deb http://master:8089/ambari/ubuntu16/2.7.3.0-139 Ambari main

root@master:/etc/apt/sources.list.d# vim hdp.list
#添加内容:
deb  http://master:8089/HDP/ubuntu16/3.1.0.0-78/ HDP main
deb  http://master:8089/HDP-UTILS/ubuntu16/1.1.0.22/ HDP-UTILS main


root@master:/etc/apt/sources.list.d# vim hdp.gpl.list
#添加内容:
deb  http://master:8089/HDP-GPL/ubuntu16/3.1.0.0-78/ HDP-GPL main

root@master:/etc/apt/sources.list.d# ll
total 20
drwxr-xr-x 2 root root 4096 12月 30 09:57 ./
drwxr-xr-x 7 root root 4096 12月 23 17:06 ../
-rw-r--r-- 1 root root   63 12月 30 09:51 ambari.list
-rw-r--r-- 1 root root   65 12月 30 09:57 hdp.gpl.list
-rw-r--r-- 1 root root  123 12月 30 09:57 hdp.list

#将这三个文件拷贝到slave上
root@master:/etc/apt/sources.list.d# scp ./* root@slave:/etc/apt/sources.list.d/
ambari.list                                   100%   63     0.1KB/s   00:00    
hdp.gpl.list                                  100%   65     0.1KB/s   00:00    
hdp.list                                      100%  123     0.1KB/s   00:00    



#在slave中查看三个文件是否存在

root@student-virtual-machine:~# cd /etc/apt/sources.list.d
root@student-virtual-machine:/etc/apt/sources.list.d# ls
ambari.list  hdp.gpl.list  hdp.list
root@student-virtual-machine:/etc/apt/sources.list.d# ll
total 20
drwxr-xr-x 2 root root 4096 12月 30 09:58 ./
drwxr-xr-x 7 root root 4096 12月 18 16:32 ../
-rw-r--r-- 1 root root   63 12月 30 09:58 ambari.list
-rw-r--r-- 1 root root   65 12月 30 09:58 hdp.gpl.list
-rw-r--r-- 1 root root  123 12月 30 09:58 hdp.list

 9.配置Ambari Server

root@master:/etc/apt/sources.list.d# apt-key adv --recv-keys --keyserver keyserver.ubuntu.com B9733A7A07513CAD;

root@master:/etc/apt/sources.list.d# apt-get update

root@master:/etc/apt/sources.list.d# apt-get install ambari-server

#配置ambari-server 
root@master:/etc/apt/sources.list.d# ambari-server setup
Using python  /usr/bin/python
Setup ambari-server
Checking SELinux...
WARNING: Could not run /usr/sbin/sestatus: OK
Customize user account for ambari-server daemon [y/n] (n)? n
Adjusting ambari-server permissions and ownership...
Checking firewall status...
Checking JDK...
[1] Oracle JDK 1.8 + Java Cryptography Extension (JCE) Policy Files 8
[2] Custom JDK
==============================================================================
Enter choice (1): 2
WARNING: JDK must be installed on all hosts and JAVA_HOME must be valid on all hosts.
WARNING: JCE Policy files are required for configuring Kerberos security. If you plan to use Kerberos,please make sure JCE Unlimited Strength Jurisdiction Policy Files are valid on all hosts.
Path to JAVA_HOME: /usr/local/jdk1.8.0_261
Validating JDK on Ambari Server...done.
Check JDK version for Ambari Server...
JDK version found: 8
Minimum JDK version is 8 for Ambari. Skipping to setup different JDK for Ambari Server.
Checking GPL software agreement...
GPL License for LZO: https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html
Enable Ambari Server to download and install GPL Licensed LZO packages [y/n] (n)? n
Completing setup...
Configuring database...
Enter advanced database configuration [y/n] (n)? n
Configuring database...
Default properties detected. Using built-in database.
Configuring ambari database...
Checking PostgreSQL...
Configuring local database...
Configuring PostgreSQL...
Restarting PostgreSQL
Creating schema and user...
done.
Creating tables...
done.
Extracting system views...
..ambari-admin-2.7.3.0.139.jar
..
Ambari repo file doesn't contain latest json url, skipping repoinfos modification
Adjusting ambari-server permissions and ownership...
Ambari Server 'setup' completed successfully.


root@master:/etc/apt/sources.list.d# ambari-server start
Using python  /usr/bin/python
Starting ambari-server
Ambari Server running with administrator privileges.
Organizing resource files at /var/lib/ambari-server/resources...
Ambari database consistency check started...
Server PID at: /var/run/ambari-server/ambari-server.pid
Server out at: /var/log/ambari-server/ambari-server.out
Server log at: /var/log/ambari-server/ambari-server.log
Waiting for server start..................................
Server started listening on 8080

DB configs consistency check: no errors and warnings were found.
Ambari Server 'start' completed successfully.


root@master:/etc/apt/sources.list.d# 

在slave上:

root@slave:/etc/apt/sources.list.d# apt-key adv --recv-keys --keyserver keyserver.ubuntu.com B9733A7A07513CAD;

root@slave:/etc/apt/sources.list.d# apt-get update

root@slave:/etc/apt/sources.list.d# apt-cache showpkg ambari-server

在浏览器中输入http://192.168.100.138:8080/出现下面界面

 

10.在slave中安装ambari-agent


root@student-virtual-machine:/etc/apt/sources.list.d# apt-get install ambari-agent

root@student-virtual-machine:/etc/apt/sources.list.d# cd /etc/ambari-agent
root@student-virtual-machine:/etc/ambari-agent# ls
conf

root@student-virtual-machine:/etc/ambari-agent# cd conf
root@student-virtual-machine:/etc/ambari-agent/conf# ll
total 16
drwxr-xr-x 2 root root 4096 12月 30 11:01 ./
drwxr-xr-x 3 root root 4096 12月 30 11:01 ../
-rw-r--r-- 1 root root 2560 12月  8  2018 ambari-agent.ini
-rw-r--r-- 1 root root 2694 12月  8  2018 logging.conf.sample

root@student-virtual-machine:/etc/ambari-agent/conf# vim ambari-agent.ini
#更改这个hostname=master
hostname=master

#重启ambari-agent服务
root@student-virtual-machine:/etc/ambari-agent/conf# ambari-agent restart

Restarting ambari-agent
Verifying Python version compatibility...
Using python  /usr/bin/python
ambari-agent is not running. No PID found at /run/ambari-agent/ambari-agent.pid
Verifying Python version compatibility...
Using python  /usr/bin/python
Checking for previously running Ambari Agent...
Checking ambari-common dir...
Starting ambari-agent
Verifying ambari-agent process status...
Ambari Agent successfully started
Agent PID at: /run/ambari-agent/ambari-agent.pid
Agent out at: /var/log/ambari-agent/ambari-agent.out
Agent log at: /var/log/ambari-agent/ambari-agent.log

root@student-virtual-machine:/etc/ambari-agent/conf# 

 再次在浏览器中输入http://192.168.100.138:8080/进入登陆界面,在密码和用户框中都输入admin

然后再进行相应的配置(后续还会随这自己的搭建而更新)

 

 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值