CentOS7安装Ambari2.7.4过程【离线安装】

2019/12/11 11:07
阅读数 179

先配置免密码登录

  • 修改所有结点的host
192.168.210.133 node1
192.168.210.134 node2
192.168.210.135 node3
192.168.210.136 node4

  • 修改所有节点的主机名
vim /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=node2
  • 关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
  • reboot

开始配置免登录:

  • 免密的核心思想就是:如果B服务器authorized_keys有A服务器的公钥,那么A服务器可以免密登录B服务器。

先到几台机器分别生成密钥:

# 安装ssh
yum -y install openssh-clients  

rm -rf ~/.ssh/*
ssh-keygen -t rsa
# 一路回车,然后拷贝到授权文件

  • 在某一台机器
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
  • 然后在所有其他几台机器上执行如家命令,把各个机器的密钥发送到node1机器的authorized_keys中去:(注意用户名,谁登录谁)
ssh-copy-id -p 2121 root@node1
 cat .ssh/authorized_keys

测试可以免登录就ok了。

安装时间同步

yum -y install ntp

ntpdate cn.pool.ntp.org

安装Ambari2.7.4

先看看支持的软件列表

最终准备的软件清单

组件 版本
操作系统 CentOS7
Ambari 2.7.4
HDP 3.1.4
MySQL 5.7.25
OracleJDK11 JDK11 build 11+28

设置CentOS的repo 阿里云镜像

https://developer.aliyun.com/mirror/centos?spm=a2c6h.13651102.0.0.53322f70KNuobs

  • 备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

  • 新的repo
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
  • 更新缓存
yum makecache 

关闭Selinux和THP以降低系统CPU的使用率

Selinux

vi, /etc/sysconfig/selinux

修改文件中的SELINUX属性 SELINUX=disabled 即可

THP

透明大页面(THP)是一种Linux内存管理系统,通过使用更大的内存页面,可以减少具有大量内存的计算机上的Translation Lookaside Buffer(TLB)查找的开销。但是,数据库工作负载通常在THP上表现不佳,因为它们往往具有稀疏而不是连续的内存访问模式。 您应该在Linux机器上禁用THP以确保使用MongoDB获得最佳性能。

查询THP状态
cat /sys/kernel/mm/transparent_hugepage/defrag
cat /sys/kernel/mm/transparent_hugepage/enabled

若结果为 [always] 则表示启动了THP

  • 永久关闭THP
vim /etc/rc.d/rc.local

在文件末尾添加

if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
        echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
        echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi

并赋予rc.local文件执行权限

chmod +x /etc/rc.d/rc.local

重启reboot后查看THP状态,若结果显示为 [never] 则表明关闭成功

最大打开文件设置

设置最大文件描述符数,一般要求为10000及以上。

  • 检查最大文件描述符数的当前值
ulimit -Sn
ulimit -Hn

如若输出小于10000,则将其设置为10000

ulimit -n 10000

安装mysql

准备一台mysql,utf8mb4格式的 创建ambari数据库,一台hive数据库 各自准备用户名密码

https://docs.cloudera.com/HDPDocuments/Ambari-2.7.4.0/administering-ambari/content/amb_using_ambari_with_mysql_or_mariadb.html

#下载repo,制作本地镜像(参照官方文档的No Internet Access部分)

​Preparing to Set Up a Local Repository

编辑repo文件

Ambari repo

此处参照 https://docs.cloudera.com/HDPDocuments/Ambari-2.7.4.0/bk_ambari-installation/content/preparing_the_ambari_repository_configuration_file.html

  • 把上面的repo文件放置到 /etc/yum.repos.d/ambari.repo 目录下,即/etc/yum.repos.d/ambari.repo

HDP repo

touch /etc/yum.repos.d/HDP.repo
vim /etc/yum.repos.d/HDP.repo

添加内容如下

#VERSION_NUMBER=3.1.4.0-135
[HDP-3.1.4.0]
name=HDP Version - HDP-3.1.4.0
baseurl=http://192.168.210.133/hdp/HDP/centos7
gpgcheck=1
gpgkey=http://192.168.210.133/hdp/HDP/centos7/3.1.4.0-315/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1

[HDP-UTILS-1.1.0.22]
name=HDP-UTILS Version - HDP-UTILS-1.1.0.22
baseurl=http://192.168.210.133/hdp/HDP-UTILS
gpgcheck=1
gpgkey=http://192.168.210.133/hdp/HDP-UTILS/centos7/1.1.0.22/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins
enabled=1
priority=1

分发repo文件到集群所有机器

scp -P2121 /etc/yum.repos.d/HDP.repo root@node4:/etc/yum.repos.d/
scp -P2121 /etc/yum.repos.d/ambari.repo root@node4:/etc/yum.repos.d/
  • 编辑 vim /etc/yum/pluginconf.d/priorities.conf
[main]
enabled=1
gpgcheck=0

yum repolist

生成本地源

在node1上安装Ambari源

安装yum的相关工具

yum install yum-utils -y
yum repolist
yum install createrepo -y

安装

yum install ambari-sever

复制下载的mysql JDBC 驱动

[root@node1 main]# ambari-server setup --jdbc-db=mysql --jdbc-driver=/main/soft/mysql-connector-java-8.0.18.jar 
Using python  /usr/bin/python
Setup ambari-server
Copying /main/soft/mysql-connector-java-8.0.18.jar to /var/lib/ambari-server/resources/mysql-connector-java-8.0.18.jar
Creating symlink /var/lib/ambari-server/resources/mysql-connector-java-8.0.18.jar to /var/lib/ambari-server/resources/mysql-connector-java.jar
If you are updating existing jdbc driver jar for mysql with mysql-connector-java-8.0.18.jar. Please remove the old driver jar, from all hosts. Restarting services that need the driver, will automatically copy the new jar to the hosts.
JDBC driver was successfully initialized.
Ambari Server 'setup' completed successfully.

准备mysql的driver到/usr/share/java/中去

mkdir -p /usr/share/java/
cp /main/soft/mysql-connector-java-8.0.18.jar /usr/share/java/
chmod 644 /usr/share/java/mysql-connector-java-8.0.18.jar

安装 setup

ambari-server setup

自定义JDK目录

自定义数据库

指定mysql的JDBC driver

其他几个节点安装ambari-agent

因为repo已经复制过去了,所以很快 yum install ambari-agent

登录,配置集群

  • 修改下面的repo地址为本地的仓库 HDP-3.1部分的 http://public-repo-1.hortonworks.com/HDP/centos7/3.x/updates/3.1.4.0 修改为 http://192.168.210.133/hdp/HDP/centos7/3.1.4.0-315 HDP-UTILS-1.1.0.22部分 http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.22/repos/centos7 修改为:http://192.168.210.133/hdp/HDP-UTILS/centos7/1.1.0.22

密码

都是admin,都是wq_

配置数据库

设置目录

确认账号

最终清单

中途有两个警告,再议

Highly Recommended Configurations 3

Please review the folowing recommended changes, and click on the property name to change its value.

Type	Service	Property	Current Value	Description
Warning	Ambari Metrics	hbase.rootdir	file:///var/lib/ambari-metrics-collector/hbase	
It is not recommended to use root partition for hbase.rootdir

Ambari Metrics service uses HBase as default storage backend. Set the rootdir for
HBase to either local filesystem path if using Ambari Metrics in embedded mode or
to a HDFS dir, example: hdfs://namenode.example.org:8020/amshbase.
Warning	Ambari Metrics	hbase.tmp.dir	/var/lib/ambari-metrics-collector/hbase-tmp	
Consider not using / partition for storing metrics temporary data. / partition is already used as hbase.rootdir to store metrics data

Temporary directory on the local filesystem.
Change this setting to point to a location more permanent
than '/tmp' (The '/tmp' directory is often cleared on
machine restart).
Warning	Atlas	atlas.graph.storage.hostname	node1,node2,node3	
Atlas is configured to use the HBase installed in this cluster. If you would like Atlas to use another HBase instance, please configure this property and HBASE_CONF_DIR variable in atlas-env appropriately.

备注

官方文档 https://docs.cloudera.com/HDPDocuments/Ambari-2.7.4.0/bk_ambari-installation/content/configuring_mysql_for_ranger.html

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部