CentOS7安裝Ambari2.7.4過程【離線安裝】

先配置免密碼登陸

  • 修改全部結點的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服務器。

先到幾臺機器分別生成密鑰:html

# 安裝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了。java

安裝時間同步

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.53322f70KNuobsnode

  • 備份
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 便可python

THP

透明大頁面(THP)是一種Linux內存管理系統,經過使用更大的內存頁面,能夠減小具備大量內存的計算機上的Translation Lookaside Buffer(TLB)查找的開銷。可是,數據庫工做負載一般在THP上表現不佳,由於它們每每具備稀疏而不是連續的內存訪問模式。 您應該在Linux機器上禁用THP以確保使用MongoDB得到最佳性能。mysql

查詢THP狀態
cat /sys/kernel/mm/transparent_hugepage/defrag
cat /sys/kernel/mm/transparent_hugepage/enabled

若結果爲 [always] 則表示啓動了THP linux

  • 永久關閉THP
vim /etc/rc.d/rc.local

在文件末尾添加nginx

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文件執行權限sql

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

重啓reboot後查看THP狀態,若結果顯示爲 [never] 則代表關閉成功 數據庫

最大打開文件設置

設置最大文件描述符數,通常要求爲10000及以上。apache

  • 檢查最大文件描述符數的當前值
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

相關文章
相關標籤/搜索