1.操作系统 CentoOS Server with GUI(有GUI,有浏览器*ambari基于浏览器*推荐latest stable version), 安装操作系统前先将bios设置Default一下,然后将legacy改成utfi;
2.分区 默认 + /hadoop
3.网络设置:内网IP,外网IP,自动网络连接
4.hostname设置:
/etc/sysconfig/network: NETWORKING=yes
HOSTNAME=master/slave
/etc/hosts:192.168.200.10 master10
192.168.200.11 slave11
192.168.200.12 slave12
/etc/hostname:master10/slave11
logout----------->重新登录root
5.检查软件:which yum 等
6.检查jdk,卸载openjdk,安装oracle jdk 1.8+
yum remove *-openjdk-*
下载oracle jdk 1.8.0_77+<用了_101:jdk-8u101-linux-x64.tar.gz>
/etc/profile 环境变量
7.数据库会自动安装,所以未提前安装
8.ulimit -Sn
ulimit -Hn
如果<10000 ulimit -n 10000+
9.ssh配置:
master下:ssh-keygen
cat id_rsa.pub >> authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
slave下建立~/.ssh文件夹
scp root@
slave下: chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
10.时间同步
1. NTP时钟同步方式说明
NTP在linux下有两种时钟同步方式,分别为直接同步和平滑同步:
直接同步
使用ntpdate命令进行同步,直接进行时间变更。如果服务器上存在一个12点运行的任务,当前服务器时间是13点,但标准时间时11点,使用此命令可能会造成任务重复执行。因此使用ntpdate同步可能会引发风 险,因此该命令也多用于配置时钟同步服务时第一次同步时间时使用。
平滑同步
使用ntpd进行时钟同步,可以保证一个时间不经历两次,它每次同步时间的偏移量不会太陡,是慢慢来的,这正因为这样,ntpd平滑同步可能耗费的时间比较长。
标准时钟同步服务
http://www.pool.ntp.org/zone/cn网站包含全球的标准时间同步服务,也包括对中国时间的同步,对应的URL为cn.pool.ntp.org,在其中也描述了ntp配置文件中的建议写法:
server 1.cn.pool.ntp.org
server 3.asia.pool.ntp.org
server 2.asia.pool.ntp.org
2. 环境情况
准备四台电脑,分别为:
IP 用途
192.168.11.212 ntpd服务器,用于与外部公共ntpd同步标准时间
172.16.248.129 ntpd客户端,用于与ntpd同步时间
172.16.248.130 ntpd客户端,用于与ntpd同步时间
172,16,248.131 ntpd客户端,用于与ntpd同步时间
3. 检查服务是否安装
使用rpm检查ntp包是否安装
[root@localhost kevin]# rpm -q ntp
ntp-4.2.6p5-19.el7.CentOS.3.x86_64
如果已经安装则略过此步,否则使用yum进行安装,并设置系统开机自动启动并启动服务
[root@localhost kevin]# yum -y install ntp
[root@localhost kevin]# systemctl enable ntpd
[root@localhost kevin]# systemctl start ntpd
4. 设置ntp服务器: 192.168.11.212
配置前先使用命令:ntpdate -u cn.pool.ntp.org,同步服务器
修改/etc/ntp.conf文件,红色字体是修改的内容
# For more information about this file, see the man pages
# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).
driftfile /var/lib/ntp/drift
# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default nomodify notrap nopeer noquery
# Permit all access over the loopback interface. This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1
restrict ::1
# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
restrict 172.16.248.0 mask 255.255.255.0 nomodify notrap
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#server 0.centos.pool.ntp.org iburst
server 2.cn.pool.ntp.org
server 1.asia.pool.ntp.org
server 2.asia.pool.ntp.org
#broadcast 192.168.1.255 autokey # broadcast server
#broadcastclient # broadcast client
#broadcast 224.0.1.1 autokey # multicast server
#multicastclient 224.0.1.1 # multicast client
#manycastserver 239.255.254.254 # manycast server
#manycastclient 239.255.254.254 autokey # manycast client
# 允许上层时间服务器主动修改本机时间
restrict 2.cn.pool.ntp.org nomodify notrap noquery
restrict 1.asia.pool.ntp.org nomodify notrap noquery
restrict 2.asia.pool.ntp.org nomodify notrap noquery
server 127.0.0.1 # local clock
fudge 127.0.0.1 stratum 10
# Enable public key cryptography.
#crypto
includefile /etc/ntp/crypto/pw
# Key file containing the keys and key identifiers used when operating
# with symmetric key cryptography.
keys /etc/ntp/keys
# Specify the key identifiers which are trusted.
#trustedkey 4 8 42
# Specify the key identifier to use with the ntpdc utility.
#requestkey 8
# Specify the key identifier to use with the ntpq utility.
#controlkey 8
# Enable writing of statistics records.
#statistics clockstats cryptostats loopstats peerstats
# Disable the monitoring facility to prevent amplification attacks using ntpdc
# monlist command when default restrict does not include the noquery flag. See
# CVE-2013-5211 for more details.
# Note: Monitoring will not be disabled with the limited restriction flag.
disable monitor
修改完成后重启ntpd服务systemctl restart ntpd
使用ntpq -p 查看网络中的NTP服务器,同时显示客户端和每个服务器的关系
使用ntpstat 命令查看时间同步状态,这个一般需要5-10分钟后才能成功连接和同步。所以,服务器启动后需要稍等下:
刚启动的时候,一般是:
# ntpstat
unsynchronised
time server re-starting
polling server every 64 s
连接并同步后:
# ntpstat
synchronised to NTP server (202.112.10.36) at stratum 3
time correct to within 275 ms
polling server every 256 s
5. 设置ntp客户端: 172.16.248.129|130|131
配置前先使用命令:ntpdate -u cn.pool.ntp.org,同步服务器
安装ntp服务并设置为自动启动,和前面的设置方式相同。然后编辑/etc/ntp.conf文件,红色字体为变化的内容。
# For more information about this file, see the man pages
# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).
driftfile /var/lib/ntp/drift
# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default nomodify notrap nopeer noquery
# Permit all access over the loopback interface. This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1
restrict ::1
# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#server 0.centos.pool.ntp.org iburst
server 172.16.248.1
restrict 172.16.248.1 nomodify notrap noquery
server 127.0.0.1
fudge 127.0.0.1 stratum 10
#broadcast 192.168.1.255 autokey # broadcast server
#broadcastclient # broadcast client
#broadcast 224.0.1.1 autokey # multicast server
#multicastclient 224.0.1.1 # multicast client
#manycastserver 239.255.254.254 # manycast server
#manycastclient 239.255.254.254 autokey # manycast client
# Enable public key cryptography.
#crypto
includefile /etc/ntp/crypto/pw
# Key file containing the keys and key identifiers used when operating
# with symmetric key cryptography.
keys /etc/ntp/keys
# Specify the key identifiers which are trusted.
#trustedkey 4 8 42
# Specify the key identifier to use with the ntpdc utility.
#requestkey 8
# Specify the key identifier to use with the ntpq utility.
#controlkey 8
# Enable writing of statistics records.
#statistics clockstats cryptostats loopstats peerstats
# Disable the monitoring facility to prevent amplification attacks using ntpdc
# monlist command when default restrict does not include the noquery flag. See
# CVE-2013-5211 for more details.
# Note: Monitoring will not be disabled with the limited restriction flag.
disable monitor
重启ntpd服务
#systemctl restart ntpd
启动后,查看同步情况
# ntpq -p
# ntpstat
*******注意这些坑*********
*******注意这些坑*********
*******注意这些坑*********
1.同步不了,可能是因为时间差距太大,而且这个能忍受的差距可能要比想象的小得多,所以才需要ntpdate;
2.配置不需要改动,有错误提示(127.0.0.1)也不影响,问题一般出在网络上;
3.多重启几次;
11.DNS配置
1.hostname配置前面已完成
2.防火墙(iptables) systemctl disable firewalld
service stop firewalld.service
systemctl status firewalld
chkconfig --list
3.selinux
setenforce 0
/etc/selinux/config<
4.echo umask 0022 >> /etc/profile //*******用于配置新建文件和文件夹的默认权限(755)
12.配置yum仓库
1.yum install httpd
安装: httpd及依赖apr apr-util http-tools mailcap
systemctl start httpd
报错:kill:cannot find process "",程序似乎在kill一个不存在的进程,可能跟默认配置有关,未研究,重启解决
mkdir -p /var/www/html
2.从Hortonworks官方文档中给出的下载地址下载tar文件:ambari、hdp2.5及对应的repo文件和gpgkey文件
3.解压到apache http server根目录ambari:/var/www/html hdp/hdputil:/var/www/html/hdp,并从网页验证是否安装成功:http://master10/AMBARI-2.4.1.0/centos7 http://master10/...
4.修改repo文件并移动到/etc/yum.repo.d/
5.yum repolist
13.ambari server安装
yum install ambari-server <前面配置完成后此时是从本地库安装> ambari-server /dependencies:postgresql/postgresql-libs/postgresql-server
ambari-server setup /用于安装配置ambari server的数据库、JDK、进程用户。=============》》1.选择用户:直接回车,使用默认root;2.选择jdk:3custom-->$JAVA_HOME;4.默认postgreSQL用户名和密码:【ambari/bigdata】
14.ambari Server 使用
ambari-server start
ambari-server status
ambari-server stop
***********与以往不同,此次并未在三台主机上分别安装ambari-agent************
15.安装HDP
1.选择服务时:tez和slider与yarn有关,依赖安装;smartsense作为日志很重要,被推荐安装;
2.分配masters
3.分配clients
4.hive,smartsense和ambari metrics的密码设为windey,用户名分别为hive admin admin
16.安装vncserver
yum install tigervnc-server -y
chkconfig vncserver on 或者 chkconfig vncserver --level 5 on
注:注册时找错ambari-server服务器位置:
主要问题出现在最后两行。
上网查找原因,,可能的原因有:
1,
地址:http://stackoverflow.com/questions/27531215/ambari-1-7-0-cannot-register-datanodes-in-centos-cluster
说明:查看/etc/ambari-agent/conf/ambari-agent.ini文件,看hostname是否改成本机的主机名;
即,改成对应的master,slave1,slave2;
2,
地址:http://superuser.com/questions/825443/registration-with-the-server-failed-while-configuring-amabri-on-centos-7
说明:CentOS版本问题,使用CentOS7的话会失败,使用CentOS6,5成功;
3,
地址:http://stackoverflow.com/questions/38423925/ambari-confirm-hosts-step-fails-registration-with-the-server-failed
说明:中文和英文操作系统版本问题,中文操作系统出错,英文则成功;
Python 2.6 for UTF8 has a bug.
和
I think this is because I set a non-English language (i.e,. Trad. Chinese) as a default language when I installed CentOs 7. It would encounter a charset problem (UTF-8<->ascii) when confirming hosts. After changing the default language to English, This problem has been solved.
解决方法是将系统的默认语言改成英语。