好久没更新文章了,今天心血来潮 更新一篇~~~
有问题随时联系博主~~~~
【背景说明】
Ambari 现有环境都是 Centos7 版本的操作系统
需要扩容麒麟v10 的操作系统
【需求确认】
Ambari 扩容麒麟v10 主机
【文档记录】
初始化操作:
配置hosts
配置免密
关闭防火墙
配置JDK
Ambari 默认不支持麒麟操作系统。
所以需要修改配置文件
首先备份如下配置文件
cp /var/lib/ambari-agent/tmp/ambari_commons/os_check.py /opt/ambari_py/
cp /usr/lib/ambari-server/lib/ambari_commons/repo_manager/yum_manager.py /opt/ambari_py/
cp /usr/lib/ambari-agent/lib/resource_management/libraries/script/script.py /opt/ambari_py/
修改配置文件
os_check.py- 基本就是把kylin伪装成centos
vim /var/lib/ambari-agent/tmp/ambari_commons/os_check.py
80 _IS_KYLIN_LINUX = os.path.exists('/etc/kylin-release')
-------
88 def _is_kylin_linux():
89 return _IS_KYLIN_LINUX
------
205 elif _is_kylin_linux():
206 distribution =("centos","8","core")


修改yum_manager.py 配置文件
vim /usr/lib/ambari-agent/lib/ambari_commons/repo_manager/yum_manager.py
208 name = name.replace("${stack_version}", "3_1_0_0_78")
--------
277 # if os.geteuid() == 0:
278 # return self.yum_check_package_available(name)
279 # else:
280 # return self.rpm_check_package_available(name)


script.py 文件修改
vim /usr/lib/ambari-agent/lib/resource_management/libraries/script/script.py
89 STACK_VERSION_PLACEHOLDER ="3_1_0_0_78"

安装lsb_release 依赖
wget https://update.cs2c.com.cn/NS/V10/V10SP2/os/adv/lic/base/x86_64/Packages/kylin-lsb-5.0-1.p01.ky10.x86_64.rpm
rpm -ivh kylin-lsb-5.0-1.p01.ky10.x86_64.rpm
第二层依赖
mkdir -p /opt/redhat-lsb
cd /opt/redhat-lsb
wget http://mirrors.sohu.com/centos/7/os/x86_64/Packages/redhat-lsb-4.1-27.el7.centos.1.x86_64.rpm
wget http://mirrors.sohu.com/centos/7/os/x86_64/Packages/redhat-lsb-core-4.1-27.el7.centos.1.x86_64.rpm
wget http://mirrors.sohu.com/centos/7/os/x86_64/Packages/redhat-lsb-cxx-4.1-27.el7.centos.1.x86_64.rpm
wget http://mirrors.sohu.com/centos/7/os/x86_64/Packages/redhat-lsb-desktop-4.1-27.el7.centos.1.x86_64.rpm
wget http://mirrors.sohu.com/centos/7/os/x86_64/Packages/redhat-lsb-languages-4.1-27.el7.centos.1.x86_64.rpm
wget http://mirrors.sohu.com/centos/7/os/x86_64/Packages/redhat-lsb-printing-4.1-27.el7.centos.1.x86_64.rpm
wget http://mirrors.sohu.com/centos/7/os/x86_64/Packages/redhat-lsb-submod-multimedia-4.1-27.el7.centos.1.x86_64.rpm
wget http://mirrors.sohu.com/centos/7/os/x86_64/Packages/redhat-lsb-submod-security-4.1-27.el7.centos.1.x86_64.rpm
wget http://mirrors.sohu.com/centos/7/os/x86_64/Packages/redhat-lsb-supplemental-4.1-27.el7.centos.1.x86_64.rpm
wget http://mirrors.sohu.com/centos/7/os/x86_64/Packages/redhat-lsb-trialuse-4.1-27.el7.centos.1.x86_64.rpm
安装
rpm -ivh *rpm --nodeps --force

验证
lsb_release

修改/etc/system-release
调整/etc/system-release 与 server 端保持一致
#备份
cp /etc/system-release /etc/system-release_kylin
#scp
scp /etc/system-release 新节点:/etc/system-release
软连 yum
yum是python的一个模块module;麒麟V10系统自带两个版本的python,2和3;也自带yum,但是此yum并不是yum,而是dnf
将 centos7 的 包 给到麒麟
scp -r /usr/lib/python2.7/site-packages/* hdp05:/usr/lib/python2.7/site-packages/
在安装一些依赖
rpm -ivh https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm --force
# 安装pip
python2 -m ensurepip --upgrade
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
#报错:Could not run curl-config: [Errno 2] No such file or directory
rpm -ivh http://mirrors.sohu.com/centos/7/os/x86_64/Packages/libidn-1.28-4.el7.x86_64.rpm --force
rpm -ivh http://mirrors.sohu.com/centos/7/os/x86_64/Packages/libidn-devel-1.28-4.el7.x86_64.rpm --force
rpm -ivh http://mirrors.sohu.com/centos/7/os/x86_64/Packages/nss-pem-1.0.3-7.el7.x86_64.rpm --force
rpm -ivh http://mirrors.sohu.com/centos/7/os/x86_64/Packages/libcurl-7.29.0-59.el7.x86_64.rpm --force
rpm -ivh http://mirrors.sohu.com/centos/7/os/x86_64/Packages/libcurl-devel-7.29.0-59.el7.x86_64.rpm --force
#安装openssl-devel
yum install -y openssl-devel
#卸载重装pycurl并指定openssl
pip uninstall pycurl
export PYCURL_SSL_LIBRARY=openssl
#成功安装后,再次安装pycurl
pip install pycurl
#安装成功

验证
[root@hdp05 site-packages]# python2
Python 2.7.18 (default, Mar 14 2021, 14:54:03)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import yum
>>>
手动安装 ambari-agent
由于操作系统不合适不可以界面化安装 agetn 需要手动安装
相关报错:
Authorized users only. All activities may be monitored and reported.
Connection to hdp05 closed.
SSH command execution finished
host=hdp05, exitcode=0
Command end time 2025-08-12 23:11:42
==========================
Running OS type check...
==========================
Command start time 2025-08-12 23:11:42
Cluster primary/cluster OS family is redhat7 and local/current OS family is kylin linux advanced server release v10
Traceback (most recent call last):
File "/var/lib/ambari-agent/tmp/os_check_type1755054701.py", line 44, in <module>
main()
File "/var/lib/ambari-agent/tmp/os_check_type1755054701.py", line 40, in main
raise Exception("Local OS is not compatible with cluster primary OS family. Please perform manual bootstrap on this host.")
Exception: Local OS is not compatible with cluster primary OS family. Please perform manual bootstrap on this host.
Authorized users only. All activities may be monitored and reported.
Connection to hdp05 closed.
SSH command execution finished
host=hdp05, exitcode=1
Command end time 2025-08-12 23:11:42
ERROR: Bootstrap of host hdp05 fails because previous action finished with non-zero exit code (1)
ERROR MESSAGE:
Authorized users only. All activities may be monitored and reported.
Connection to hdp05 closed.
STDOUT: Cluster primary/cluster OS family is redhat7 and local/current OS family is kylin linux advanced server release v10
Traceback (most recent call last):
File "/var/lib/ambari-agent/tmp/os_check_type1755054701.py", line 44, in <module>
main()
File "/var/lib/ambari-agent/tmp/os_check_type1755054701.py", line 40, in main
raise Exception("Local OS is not compatible with cluster primary OS family. Please perform manual bootstrap on this host.")
Exception: Local OS is not compatible with cluster primary OS family. Please perform manual bootstrap on this host.
Authorized users only. All activities may be monitored and reported.
Connection to hdp05 closed.
手动安装方法
sudo yum install ambari-agent

修改 agent.ini 文件
vim /etc/ambari-agent/conf/ambari-agent.ini
指定server节点

启动 agent
sudo ambari-agent start

启动日志:
tail -f /var/log/ambari-agent/ambari-agent.log

主机界面正常接入

扩容 Datanode 和 Nodemanager 成功


2096

被折叠的 条评论
为什么被折叠?



