Ambaria安装
操作系统:CentOS 6.9 min
安装vim
cd
yum install vim -y
vi .bashrc
alias vi='vim'
. .bashrc # 第一个点和source效果一样
修改网卡配置
默认是没有ip的,配置网卡
vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0 HWADDR=00:0C:29:2F:2A:58 TYPE=Ethernet ONBOOT=yes # 修改 NM_CONTROLLED=yes BOOTPROTO=static #修改,一下为增加 IPADDR=192.168.202.201 NETMASK=255.255.255.0 GATEWAY=192.168.202.2 DNS1=114.114.114.114 DNS2=8.8.8.8
service network restart # 重启网卡
关闭防火墙
【iptables】
service iptables stop
chkconfig iptables off
【selinux】
sestatus # 查看selinux状态
vi /etc/sysconfig/selinux # 重启生效
SELINUX=disabled
修改hosts
vi /etc/hosts # 增加
192.168.202.77 yum yum.hdp 192.168.202.200 nd-00 nd-00.hdp 192.168.202.201 nd-01 nd-01.hdp 192.168.202.202 nd-02 nd-02.hdp 192.168.202.203 nd-03 nd-03.hdp 192.168.202.204 nd-04 nd-04.hdp
修改主机名
vi /etc/sysconfig/network
HOSTNAME=yum.hdp
修改yum源
https://opsx.alibaba.com/mirror # 点击centos右侧的帮助
安装ntp
yum install -y ntp
service ntpd start
chkconfig ntpd on # 设为开机启动
date # 查看时间是否正确
安装java
上传jdk到家目录
tar zxfv jdk-8u131-linux-x64.tar.gz
mkdir /soft/java
cd !$
mv ~/jdk1.8.0_131 /soft/java/
vi /etc/profile
export JAVA_HOME=/soft/java/jdk1.8.0_131 export PATH=$PATH:$JAVA_HOME/bin
. /etc/profile # 第一个点和source效果一样
克隆虚拟机
rm -f /etc/udev/rules.d/70-persistent-net.rules # 克隆前的准备:避免mac冲突
halt # 关闭虚拟机
克隆3个centos
操作步骤:虚拟机->管理->克隆->完整克隆
克隆机生成一个新的mac地址
配置其余机器的ip hostname
rm -f /etc/udev/rules.d/70-persistent-net.rules # 每次重启网络服务(或重启机器)会重新生成该文件
vi /etc/sysconfig/network-scripts/ifcfg-eth0 # 删除 HARDWARE、修改ip
vi /etc/sysconfig/network # 修改主机名
reboot
安装mysql
安装
yum list |grep mysql-server # yum仓库是否有mysql-server
yum install mysql-server # 安装
/etc/init.d/mysqld start # 启动
mysqladmin -u root password 'root' # 设置root用户密码
chkconfig mysqld on # 开机启动
修改配置
vi /etc/my.cnf
[mysqld] # mysqld添加 collation_server=utf8_general_ci character_set_server=utf8 default-storage-engine=INNODB # 添加 [client] default-character-set=utf8
/etc/init.d/mysqld restart # 重启mysql
创建数据库
create database ambari character set utf8; grant all on ambari.* to 'ambari'@'%' identified by '062417'; flush privileges;
create database hive character set utf8; grant all on hive.* to 'hive'@'%' identified by '062417'; flush privileges;
yum install mysql-connector-java
配置免密登录
nd-00 登录到nd-00 nd-01 nd-02 nd-03 nd-04
1)检查是否安装了ssh相关软件包(openssh-server + openssh-clients + openssh) $yum list installed | grep ssh 2)检查是否启动了sshd进程 $>ps -Af | grep sshd 3)在client侧生成公私秘钥对。 $>ssh-keygen -t rsa -P '' # -P密码 4)生成~/.ssh文件夹,里面有id_rsa(私钥) + id_rsa.pub(公钥)
ssh-copy-id nd-00 ssh-copy-id nd-01 ssh-copy-id nd-02 ssh-copy-id nd-03 ssh-copy-id nd-04
nd-01 登录到nd-01 nd-02 nd-03 nd-04
ssh-keygen -t rsa
ssh-copy-id nd-01 ssh-copy-id nd-02 ssh-copy-id nd-03 ssh-copy-id nd-04
共享目录
安装VMware tools
1、vmware-tools安装存在几个依赖,首先保证依赖包都安装完毕。
yum install -y perl net-tools gcc kernel-headers
2、点击vmware中【虚拟机】-【安装VMware tools工具】,这时会自动挂载安装镜像。如果没有自动挂载,执行#mount /dev/cdrom /media挂载到media目录
将安装文件拷贝到自己的目录下。
# tar -xzf vmware-tools.tar.gz
# cd vmware-tools
# ./vmware-tools.pl
其后所有的交互位置均选择默认,即回车即可。
安装完毕后,选择挂载的文件夹,重启虚拟机,mount -t vmhgfs .host:/Downloads /mnt/hgfs,在/mnt/hgfs目录下可以看到共享的文件夹。
Enjoy it!
还有问题请参考
http://www.bubuko.com/infodetail-2152481.html
集群工具
对所有机器:xcall.sh做成命令
#!/bin/bash params=$@ for (( i=1 ; i <= 4 ; i = $i + 1 )) ; do echo ============= nd-0$i $params ============= ssh nd-0$i "$params" echo done
ln -s /soft/myscripts/xcall.sh /usr/sbin/
注意:jps要加入/usr/local/bin
xcall.sh ln -s /soft/java/jdk1.8.0_131/bin/jps /usr/local/bin/jps
对某台机器:ncall.sh做成命令
#!/bin/bash params=$@ echo ============= nd-0$1 ${params:2} ============= ssh nd-0$1 "${params:2}"
ln -s /soft/myscripts/ncall.sh /usr/sbin/
配置Ambari-HDP的本地YUM源
6台机器:77(hdp) 200 201 202 203 204
77机器
安装YUM相关工具
yum install yum-utils -y
yum install createrepo -y
yum repolist
安装apache httpd
yum install httpd -y
service httpd start
chkconfig httpd on
包文件上传、解压
cd /var/www/html
mkdir ambari hdp
cd /var/www/html/
mkdir HDP-UTILS-1.1.0.21
tar zxvf ambari-2.4.1.0-centos6.tar.gz -C /var/www/html/ambari/
tar zxvf HDP-2.5.0.0-centos6-rpm.tar.gz -C /var/www/html/hdp/
tar zxxvf HDP-UTILS-1.1.0.21-centos6.tar.gz -C /var/www/html/hdp/HDP-UTILS-1.1.0.21/
配置本地repo
cd /etc/yum.repos.d
#VERSION_NUMBER=2.5.0.0-1245 [HDP-2.5.0.0] name=HDP Version - HDP-2.5.0.0 baseurl=http://192.168.202.77/hdp/HDP/centos6 gpgcheck=1 gpgkey=http://192.168.202.77/hdp/HDP/centos6/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins enabled=1 priority=1 [HDP-UTILS-1.1.0.21] name=HDP-UTILS Version - HDP-UTILS-1.1.0.2 baseurl=http://192.168.202.77/hdp/HDP/centos6 gpgcheck=1 gpgkey=http://192.168.202.77/hdp/HDP/centos6/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins enabled=1 priority=1
#VERSION_NUMBER=2.4.1.0-22 [Updates-ambari-2.4.1.0] name=ambari-2.4.1.0 - Updates baseurl=http://192.168.202.77/ambari/AMBARI-2.4.1.0/centos6/2.4.1.0-22 gpgcheck=1 gpgkey=http://192.168.202.77/ambari/AMBARI-2.4.1.0/centos6/2.4.1.0-22/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins enabled=1 priority=1
分发
scp ambari.repo HDP.repo nd-00:$PWD scp ambari.repo HDP.repo nd-01:$PWD scp ambari.repo HDP.repo nd-02:$PWD scp ambari.repo HDP.repo nd-03:$PWD scp ambari.repo HDP.repo nd-04:$PWD
createrepo /var/www/html/hdp/HDP/centos6/
createrepo /var/www/html/hdp/HDP-UTILS-1.1.0.21/
安装ambari-server
nd-00机器
初始化
yum install ambari-server
mysql -uambari -p062417
mysql> grant all on ambari.* to 'ambari'@'localhost' identified by '062417'; mysql> use ambari; mysql> source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql;
启动ambari-server
ambari-server start
登录ambari
默认账号:admin admin
安装Hadoop集群
把nd-00.hdp的私钥拿下来
点击Failed,Ambari agent machine hostname (nd-03.ndp) does not match expected ambari server hostname (nd-03.hdp).
hostname没有配置正确,发现nd-03.hdp写成了nd-03.ndp,修改后重启
最后出现一个界面,选择自己要安装的大数据生态圈组件,没有勾选的可以后续再安装
指定服务所在的机器(本人默认,懒的折腾党)
解决Hive错误:
ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar
Message: ERROR: Unable to connect to the DB. Please check DB connection properties. com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
Ambari Metrics和SmartSense设置密码
安装,这个过程可能会有很多bug
如果未出现error,则Next
如果有未启动成功的服务,在WEB后台手动启动