Ambari-2.7.7源码编译

news2024/11/27 14:38:46

0 说明

本文基于Ambari-2.7.7版本进行源码编译。所需的编译资料统一提供如下:

链接:https://pan.baidu.com/s/1F2D7zBGfKihxTBArnOilTw 
提取码:8m17 

1 前提条件

1.1 下载ambari源码包

wget https://github.com/apache/ambari/releases/tag/release-2.7.7-rc0/ambari-release-2.7.7-rc0.tar.gz
wget https://www-eu.apache.org/dist/ambari/ambari-2.7.7/apache-ambari-2.7.7-src.tar.gz
wget https://mirrors.tuna.tsinghua.edu.cn/apache/ambari/ambari-2.7.7/apache-ambari-2.7.7-src.tar.gz

选择其中一个下载一个就行,下载完成后解压

tar -zxvf apache-ambari-2.7.7-src.tar.gz
chown -R root:root apache-ambari-2.7.7-src

1.2 需要安装软件

java1.8.0_201
mavenApache Maven 3.8.6
rpm-buildrpm-build-4.11.3-48.el7_9.x86_64
gcc-c++4.8.5
python2.7.5
python-develpython-devel-2.7.5-92.el7_9.x86_64
git1.8.3.1
nodejsv4.5.0

注:①rpm-build安装

yum install rpm-build -y

查看rpm-build版本
在这里插入图片描述
② python-devel安装

yum install python-devel -y

查看安装版本
在这里插入图片描述
③ 安装node

wget https://nodejs.org/dist/v4.5.0/node-v4.5.0-linux-x64.tar.gz
tar -zxvf node-v4.5.0-linux-x64.tar.gz -C /usr/lib/node

安装完成后确保npm和node命令正常
在这里插入图片描述
注:如果执行npm -v时发生如下报错:

Cannot find module ‘npmlog’ 

解决办法:

# cd 命令进入nodejs安装目录然后执行如下命令,建立软连接:
ln -s ../lib/node_modules/npm/bin/npm-cli.js

④ 将以上安装的jdk/maven/node配置环境变量

#java environment
export JAVA_HOME=/usr/local/java
export CLASSPATH=.:${JAVA_HOME}/jre:${JAVA_HOME}/lib
export PATH=$PATH:${JAVA_HOME}/bin

#maven environment
export MAVEN_HOME=/usr/local/maven/apache-maven-3.8.6
export M2_HOME=/usr/local/maven/apache-maven-3.8.6
export PATH=$PATH:$MAVEN_HOME/bin

#node
export NODE_HOME=/usr/lib/node-v4.5.0-linux-x64
export PATH=$PATH:$NODE_HOME/bin

1.3 maven镜像源配置

编辑 conf/settings.xml 配置文件,添加好下述镜像源,会提高编译ambari的速度。

<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->
<!--
 | This is the configuration file for Maven. It can be specified at two levels:
 |
 |  1. User Level. This settings.xml file provides configuration for a single user,
 |                 and is normally provided in ${user.home}/.m2/settings.xml.
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |
 |                 -s /path/to/user/settings.xml
 |
 |  2. Global Level. This settings.xml file provides configuration for all Maven
 |                 users on a machine (assuming they're all using the same Maven
 |                 installation). It's normally provided in
 |                 ${maven.conf}/settings.xml.
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |
 |                 -gs /path/to/global/settings.xml
 |
 | The sections in this sample file are intended to give you a running start at
 | getting the most out of your Maven installation. Where appropriate, the default
 | values (values used when the setting is not specified) are provided.
 |
 |-->
<settings
	xmlns="http://maven.apache.org/SETTINGS/1.2.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd">
	<!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ${user.home}/.m2/repository
  <localRepository>/path/to/local/repo</localRepository>
  -->
	<localRepository>/usr/local/maven/apache-maven-3.8.6/repository</localRepository>
	<!-- interactiveMode
   | This will determine whether maven prompts you when it needs input. If set to false,
   | maven will use a sensible default value, perhaps based on some other setting, for
   | the parameter in question.
   |
   | Default: true
  <interactiveMode>true</interactiveMode>
  -->
	<!-- offline
   | Determines whether maven should attempt to connect to the network when executing a build.
   | This will have an effect on artifact downloads, artifact deployment, and others.
   |
   | Default: false
  <offline>false</offline>
  -->
	<!-- pluginGroups
   | This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
   | when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
   | "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
   |-->
	<pluginGroups>
		<!-- pluginGroup
     | Specifies a further group identifier to use for plugin lookup.
    <pluginGroup>com.your.plugins</pluginGroup>
    -->
	</pluginGroups>
	<!-- proxies
   | This is a list of proxies which can be used on this machine to connect to the network.
   | Unless otherwise specified (by system property or command-line switch), the first proxy
   | specification in this list marked as active will be used.
   |-->
	<proxies>
		<!-- proxy
     | Specification for one proxy, to be used in connecting to the network.
     |
    <proxy><id>optional</id><active>true</active><protocol>http</protocol><username>proxyuser</username><password>proxypass</password><host>proxy.host.net</host><port>80</port><nonProxyHosts>local.net|some.host.com</nonProxyHosts></proxy>
    -->
	</proxies>
	<!-- servers
   | This is a list of authentication profiles, keyed by the server-id used within the system.
   | Authentication profiles can be used whenever maven must make a connection to a remote server.
   |-->
	<servers>
		<!-- server
     | Specifies the authentication information to use when connecting to a particular server, identified by
     | a unique name within the system (referred to by the 'id' attribute below).
     |
     | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
     |       used together.
     |
    <server><id>deploymentRepo</id><username>repouser</username><password>repopwd</password></server>
    -->
		<!-- Another sample, using keys to authenticate.
    <server><id>siteServer</id><privateKey>/path/to/private/key</privateKey><passphrase>optional; leave empty if not used.</passphrase></server>
    -->
	</servers>
	<!-- mirrors
   | This is a list of mirrors to be used in downloading artifacts from remote repositories.
   |
   | It works like this: a POM may declare a repository to use in resolving certain artifacts.
   | However, this repository may have problems with heavy traffic at times, so people have mirrored
   | it to several places.
   |
   | That repository definition will have a unique id, so we can create a mirror reference for that
   | repository, to be used as an alternate download site. The mirror site will be the preferred
   | server for that repository.
   |-->
	<mirrors>
		<!-- mirror
     | Specifies a repository mirror site to use instead of a given repository. The repository that
     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
     |
    <mirror><id>mirrorId</id><mirrorOf>repositoryId</mirrorOf><name>Human Readable Name for this Mirror.</name><url>http://my.repository.com/repo/path</url></mirror>
     -->
		<!-- Amabri build mirror source -->
		<mirror>
			<id>huaweicloud</id>
			<name>huaweicloud maven</name>
			<mirrorOf>central</mirrorOf>
			<url>https://repo.huaweicloud.com/repository/maven/</url>
		</mirror>
		<mirror>
			<id>nexus-aliyun</id>
			<mirrorOf>central</mirrorOf>
			<name>Nexus aliyun</name>
			<url>https://maven.aliyun.com/nexus/content/groups/public/</url>
		</mirror>
		<mirror>
			<id>alimaven</id>
			<!-- <mirrorOf>central</mirrorOf> -->
			<mirrorOf>central,apache.snapshots.https,maven2-repository.dev.java.net,maven2-glassfish-repository.dev.java.net,maven2-repository.atlassian,apache.staging.https,oss.sonatype.org,spring-milestones</mirrorOf>
			<name>aliyun maven</name>
			<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
		</mirror>
		<mirror>
			<id>nexus-hortonworks</id>
			<mirrorOf>central</mirrorOf>
			<name>Nexus hortonworks</name>
			<url>https://repo.hortonworks.com/content/groups/public/</url>
		</mirror>
		<mirror>
			<id>HDPReleases</id>
			<name>HDP Releases</name>
			<url>https://repo.hortonworks.com/content/repositories/releases/</url>
			<mirrorOf>central</mirrorOf>
		</mirror>
		<mirror>
			<id>WSO2Releases</id>
			<name>WSO2 Dist Repository</name>
			<url>http://dist.wso2.org/maven2/</url>
			<mirrorOf>central</mirrorOf>
		</mirror>
		<mirror>
			<id>MavenCentralReleases</id>
			<name>Maven Central Repository</name>
			<url>https://repo1.maven.org/maven2/</url>
			<mirrorOf>central</mirrorOf>
		</mirror>
	</mirrors>
	<!-- profiles
   | This is a list of profiles which can be activated in a variety of ways, and which can modify
   | the build process. Profiles provided in the settings.xml are intended to provide local machine-
   | specific paths and repository locations which allow the build to work in the local environment.
   |
   | For example, if you have an integration testing plugin - like cactus - that needs to know where
   | your Tomcat instance is installed, you can provide a variable here such that the variable is
   | dereferenced during the build process to configure the cactus plugin.
   |
   | As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles
   | section of this document (settings.xml) - will be discussed later. Another way essentially
   | relies on the detection of a system property, either matching a particular value for the property,
   | or merely testing its existence. Profiles can also be activated by JDK version prefix, where a
   | value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.
   | Finally, the list of active profiles can be specified directly from the command line.
   |
   | NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact
   |       repositories, plugin repositories, and free-form properties to be used as configuration
   |       variables for plugins in the POM.
   |
   |-->
	<profiles>
		<!-- profile
     | Specifies a set of introductions to the build process, to be activated using one or more of the
     | mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>
     | or the command line, profiles have to have an ID that is unique.
     |
     | An encouraged best practice for profile identification is to use a consistent naming convention
     | for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.
     | This will make it more intuitive to understand what the set of introduced profiles is attempting
     | to accomplish, particularly when you only have a list of profile id's for debug.
     |
     | This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.
    <profile><id>jdk-1.4</id><activation><jdk>1.4</jdk></activation><repositories><repository><id>jdk14</id><name>Repository for JDK 1.4 builds</name><url>http://www.myhost.com/maven/jdk14</url><layout>default</layout><snapshotPolicy>always</snapshotPolicy></repository></repositories></profile>
    -->
		<!--
     | Here is another profile, activated by the system property 'target-env' with a value of 'dev',
     | which provides a specific path to the Tomcat instance. To use this, your plugin configuration
     | might hypothetically look like:
     |
     | ...
     | <plugin>
     |   <groupId>org.myco.myplugins</groupId>
     |   <artifactId>myplugin</artifactId>
     |
     |   <configuration>
     |     <tomcatLocation>${tomcatPath}</tomcatLocation>
     |   </configuration>
     | </plugin>
     | ...
     |
     | NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to
     |       anything, you could just leave off the <value/> inside the activation-property.
     |
    <profile><id>env-dev</id><activation><property><name>target-env</name><value>dev</value></property></activation><properties><tomcatPath>/path/to/tomcat/instance</tomcatPath></properties></profile>
    -->
		<profile>
			<id>huaweicloud</id>
			<repositories>
				<repository>
					<id>huawei</id>
					<url>https://repo.huaweicloud.com/repository/maven/</url>
					<releases>
						<enabled>true</enabled>
					</releases>
					<snapshots>
						<enabled>true</enabled>
						<updatePolicy>always</updatePolicy>
					</snapshots>
				</repository>
			</repositories>
		</profile>
		<profile>
			<id>nexus-aliyun</id>
			<repositories>
				<repository>
					<id>aliyun</id>
					<url>https://maven.aliyun.com/nexus/content/groups/public/</url>
					<releases>
						<enabled>true</enabled>
					</releases>
					<snapshots>
						<enabled>true</enabled>
						<updatePolicy>always</updatePolicy>
					</snapshots>
				</repository>
			</repositories>
		</profile>
		<profile>
			<id>alimaven</id>
			<repositories>
				<repository>
					<id>ali</id>
					<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
					<releases>
						<enabled>true</enabled>
					</releases>
					<snapshots>
						<enabled>true</enabled>
						<updatePolicy>always</updatePolicy>
					</snapshots>
				</repository>
			</repositories>
		</profile>
		<profile>
			<id>nexus-hortonworks</id>
			<repositories>
				<repository>
					<id>hortonworks</id>
					<url>https://repo.hortonworks.com/content/groups/public/</url>
					<releases>
						<enabled>true</enabled>
					</releases>
					<snapshots>
						<enabled>true</enabled>
						<updatePolicy>always</updatePolicy>
					</snapshots>
				</repository>
			</repositories>
		</profile>
		<profile>
			<id>HDPReleases</id>
			<repositories>
				<repository>
					<id>HDP</id>
					<url>https://repo.hortonworks.com/content/repositories/releases/</url>
					<releases>
						<enabled>true</enabled>
					</releases>
					<snapshots>
						<enabled>true</enabled>
						<updatePolicy>always</updatePolicy>
					</snapshots>
				</repository>
			</repositories>
		</profile>
		<profile>
			<id>WSO2Releases</id>
			<repositories>
				<repository>
					<id>WSO2</id>
					<url>http://dist.wso2.org/maven2/</url>
					<releases>
						<enabled>true</enabled>
					</releases>
					<snapshots>
						<enabled>true</enabled>
						<updatePolicy>always</updatePolicy>
					</snapshots>
				</repository>
			</repositories>
		</profile>
		<profile>
			<id>MavenCentralReleases</id>
			<repositories>
				<repository>
					<id>MavenCentral</id>
					<url>https://repo1.maven.org/maven2/</url>
					<releases>
						<enabled>true</enabled>
					</releases>
					<snapshots>
						<enabled>true</enabled>
						<updatePolicy>always</updatePolicy>
					</snapshots>
				</repository>
			</repositories>
		</profile>
	</profiles>
	<activeProfiles>
		<activeProfile>huaweicloud</activeProfile>
		<activeProfile>nexus-aliyun</activeProfile>
		<activeProfile>alimaven</activeProfile>
		<activeProfile>nexus-hortonworks</activeProfile>
		<activeProfile>HDPReleases</activeProfile>
		<activeProfile>WSO2Releases</activeProfile>
		<activeProfile>MavenCentralReleases</activeProfile>
	</activeProfiles>
	<!-- activeProfiles
   | List of profiles that are active for all builds.
   |
  <activeProfiles><activeProfile>alwaysActiveProfile</activeProfile><activeProfile>anotherAlwaysActiveProfile</activeProfile></activeProfiles>
  -->
</settings>

1.4 将 HDP 3.0 和 3.1 文件拷贝到源码中

HDP3.0/HDP3.1获取连接如下:
将HDP3.0/HDP3.1拷贝到apache-ambari-2.7.7-src/ambari-server/src/main/resources/stacks/HDP目录下:
在这里插入图片描述

1.5 编译加速

1.5.1 下载bower_components

ambari编译时需要去apache-ambari-2.7.7-src/ambari-admin/src/main/resources/ui/admin-web/app/目录下载bower_components内容,由于网络原因不能下载,可以自行下载放入该目录下,再重新编译。
在这里插入图片描述
注意:如果未做该操作可能会报4.1中的错误

1.5.2 下载编译metrics所需依赖

修改ambari-metrics/pom.xml文件,将habse、hadoop、phoenix和grafana的下载路径进行替换

<hbase.tar>http://192.168.5.78/compile-ambari/hbase-2.4.2-bin.tar.gz</hbase.tar><hadoop.tar>http://192.168.5.78/compile-ambari/hadoop-3.1.1.tar.gz</hadoop.tar>
<grafana.tar>http://192.168.5.78/compile-ambari/grafana-6.7.4.linux-amd64.tar.gz</grafana.tar>
<phoenix.tar>http://192.168.5.78/compile-ambari/phoenix-hbase-2.4-5.1.2-bin.tar.gz</phoenix.tar>

注意:① 这里的192.168.5.78已配置httpd功能,可以通过该下载方式下载所需的依赖包
在这里插入图片描述
② 如果不做任何修改则在编译时会报4.2所示错误
③ 如果没有配置httpd,也可以配置为本地路径。例如:

    <hbase.tar>file:///opt/compile-ambari/hbase-2.4.2-bin.tar.gz</hbase.tar>
    <hbase.folder>hbase-2.4.2</hbase.folder>
    <hadoop.tar>file:///opt/compile-ambari/hadoop-3.1.1.tar.gz</hadoop.tar>
    <hadoop.folder>hadoop-3.1.1</hadoop.folder>
    <grafana.folder>grafana-6.7.4</grafana.folder>
    <grafana.tar>file:///opt/compile-ambari/grafana-6.7.4.linux-amd64.tar.gz</grafana.tar>
    <phoenix.tar>file:///opt/compile-ambari/phoenix-hbase-2.4-5.1.2-bin.tar.gz</phoenix.tar>
    <phoenix.folder>phoenix-hbase-2.4-5.1.2</phoenix.folder>

1.5.3 修改ambari-infra/ambari-infra-assembly/pom文件

<solr.tar>http://archive.apache.org/dist/lucene/solr/${solr.version}/solr-${solr.version}.tgz</solr.tar>
改为:
<solr.tar>http://192.168.5.78/compile-ambari/solr-${solr.version}.tgz</solr.tar>

注:如果没有安装httpd服务的节点,也可设置为本地路径,同上

1.5.4 修改ambari-infra/ambari-infra-solr-client/pom文件

<lucene6-core.url>https://repo1.maven.org/maven2/org/apache/lucene/lucene-core/${lucene6.version}/${lucene6-core-jar.name}</lucene6-core.url>
<lucene6-backward-codecs.url>https://repo1.maven.org/maven2/org/apache/lucene/lucene-backward-codecs/${lucene6.version}/${lucene6-backward-codecs-jar.name}</lucene6-backward-codecs.url>
改为:
<lucene6-core.url>http://192.168.5.78/compile-ambari/${lucene6-core-jar.name}</lucene6-core.url>
<lucene6-backward-codecs.url>http://192.168.5.78/compile-ambari/${lucene6-backward-codecs-jar.name}</lucene6-backward-codecs.url>

注:如果没有安装httpd服务的节点,也可设置为本地路径,同上

1.5.6 替换maven仓库依赖

如果网络不好的小伙伴,可以直接使用我提供的maven仓库,将该依赖库直接解压到自己本地环境的maven仓库中再进行编译。
在这里插入图片描述

1.5.7 赋予所有执行权限

为确保编译过程中无可执行权限导致的报错,在编译前可以对所有ambari编译目录文件赋予可执行的权限

chmod -R 777 apache-ambari-2.7.7/

注:如果不执行上述操作,在编译时可能报如下错误:

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (Bower install) on project ambari-admin: Command execution failed. Process exited with an error: 1 (Exit value: 1)

在这里插入图片描述

2 编译

① 编译ambari的话,如果有自定义版本号的要求,可以先给ambari源码打上自己定义的版本号。打版本号其实就是通过mvn命令自动修改pom.xml文件里面的version值,包括子模块。
②通过mvn命令,将ambari各模块源码编译,最终得到各自的rpm包,类似hortonworks官方提供的ambari相关rpm包。

2.1 打版本号

给ambari源码打版本号,版本号可自定义

mvn versions:set -DnewVersion=2.7.7.0.1

在这里插入图片描述

2.2 ambari-metrics模块

pushd ambari-metrics

在这里插入图片描述

# 打版本号
mvn versions:set -DnewVersion=2.7.7.0.1

在这里插入图片描述

2.3 ambari-logsearch模块

# 返回到ambari根目录
popd
pushd ambari-logsearch
# 打版本号
mvn versions:set -DnewVersion=2.7.7.0.1

在这里插入图片描述

2.4 ambari-infra模块

# 返回到ambari根目录
popd
pushd ambari-infra
# 打版本号
mvn versions:set -DnewVersion=2.7.7.0.1

在这里插入图片描述

2.5 开始编译所有模块

# 返回到ambari根目录
popd
mvn -B -X install rpm:rpm -DnewVersion=2.7.7.0.1 -DbuildNumber=5895e4ed6b30a2da8a90fee2403b6cab91d19972 -DskipTests -Dpython.ver="python >= 2.6" -Drat.skip=true

建议将上述命令全量复制,需要buildNumber,否则等rpm包安装时,会报buildNumber错误;-Drat.skip=true会跳过license校验。

编译成功
在这里插入图片描述

3 编译说明

ambari 源码分为多个模块,当某个模块编译失败时,我们想继续从这个模块开始编译,怎么做呢?
举个例子,假如 ambari-web 模块编译报错,只需要在编译命令的末尾添加:-rf :ambari-web 即可。当报错时显示的模块名,会在 mvn 输出的最后一行显示。

4 编译过程报错

4.1 Admin View报错

具体报错内容

[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.4:yarn (yarn install) on project ambari-admin: Failed to run task: 'yarn install --ignore-engines --pure-lockfile' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.4:yarn (yarn install) on project ambari-admin: Failed to run task
bower angular-bootstrap#0.11.0                       ECMDERR Failed to execute "git ls-remote --tags --heads https://github.com/angular-ui/bootstrap-bower.git", exit code of #128 fatal: unable to access 'https://github.com/angular-ui/bootstrap-bower.git/': Empty reply from server

在这里插入图片描述
这是由于ambari编译时需要去apache-ambari-2.7.7-src/ambari-admin/src/main/resources/ui/admin-web目录下载bower_components内容,由于网络原因不能下载,可以自行下载放入该目录下,再重新编译即可。

4.2 Ambari Metrics Collector报错

在这里插入图片描述
解决方法:
方式①
需要去掉ambari项目中pom.xml文件中的metric模块,删除后再重新编译即可
在这里插入图片描述
方式②
手动下载编译metrics需要的依赖包,并修改metrics的pom.xml文件。具体修改方法见1.5.2

4.3 缺少phoenix-core包

进入maven仓库下载该jar包,并将下载好的jar包放入maven中
在这里插入图片描述

4.4 未安装rpm-build

[ERROR] Failed to execute goal org.codehaus.mojo:rpm-maven-plugin:2.1.4:rpm (default-cli) on project ambari: Unable to build the RPM: Error while executing process. Cannot run program "rpmbuild" (in directory "/root/ambari/apache-ambari-2.7.7-src/target/rpm/ambari/SPECS"): error=2, No such file or directory -> [Help 1]

在这里插入图片描述
解决办法:安装rpm-build

yum install -y rpm-build

4.5 yarn报错

Could not extract the Yarn archive: Could not extract archive

在这里插入图片描述
解决办法:
① 手动下载https://github.com/yarnpkg/yarn/releases/download/v0.23.2/yarn-v0.23.2.tar.gz
② 下载完成后手动放入maven仓库的com/github/eirslett/yarn/0.23.2/yarn-0.23.2./目录下即可

4.6 yarn install报错

[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.4:yarn (yarn install) on project ambari-web: Failed to run task: 'yarn install --ignore-engines --pure-lockfile' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.4:yarn (yarn install) on project ambari-web: Failed to run task

在这里插入图片描述
解决办法:这个问题最容易出现,主要是nodejs会通过 yarn去加载依赖包,解决方式是保证网络环境好。确保网络环境没问题之后删除编译报错目录下的*.lock文件(个人将target目录一起删除),重新编译

# find ~/.m2/repository/ -name "*.lastUpdated" -exec rm -rf {} \;

4.7 ambari-admin报错

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (Bower install) on project ambari-admin: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (Bower install) on project ambari-admin: Command execution failed.

在这里插入图片描述
解决办法:cd ambari-admin/src/main/resources/ui/admin-web目录下,编辑 .bowerrc ,修改后的内容如下:

{
    "directory": "app/bower_components",
    "allow_root": true
}

4.8 yarn报错

 Could not download Yarn: Could not download https://github.com/yarnpkg/yarn/releases/download/v1.1.0/yarn-v1.1.0.tar.gz: Connect to objects.githubusercontent.com:443 [objects.githubusercontent.com/127.0.0.1, objects.githubusercontent.com/0:0:0:0:0:0:0:1] failed: Connection refused (Connection refused) -> [Help 1]

github的443端口不能访问

# 下载
https://github.com/yarnpkg/yarn/releases/download/v1.1.0/yarn-v1.1.0.tar.gz
# 放入maven仓库
repository/com/github/eirslett/yarn/1.1.0/yarn-1.1.0.tar.gz

5 编译包整理

Ambari 视图、ambari-metrics、ambari-logsearch、ambari-solr 都编译成功了。Ambari 源码全部编译完成后,我们需要将 ambari 各模块的编译包汇总起来。以 centos7 为例,我们需要将编译得到的 rpm 包汇总起来

5.1 合并rpm包

新建目录

mkdir ambari-2.7.7

汇总所有的rpm包,并制作生成yum源

cp -r ./ambari-server/target/rpm/ambari-server/RPMS/x86_64/ambari-server-2.7.7.0-1.x86_64.rpm ../ambari-2.7.7/
cp -r ./ambari-agent/target/rpm/ambari-agent/RPMS/x86_64/ambari-agent-2.7.7.0-1.x86_64.rpm  ../ambari-2.7.7/

cp -r ./ambari-infra/ambari-infra-assembly/target/rpm/ambari-infra-solr/RPMS/noarch/ambari-infra-solr-2.7.7.0-1.noarch.rpm  ../ambari-2.7.7/
cp -r ./ambari-infra/ambari-infra-assembly/target/rpm/ambari-infra-solr-client/RPMS/noarch/ambari-infra-solr-client-2.7.7.0-1.noarch.rpm ../ambari-2.7.7/
cp -r ./ambari-infra/ambari-infra-assembly/target/rpm/ambari-infra-manager/RPMS/noarch/ambari-infra-manager-2.7.7.0-1.noarch.rpm ../ambari-2.7.7/
cp -r ./ambari-logsearch/ambari-logsearch-assembly/target/rpm/ambari-logsearch-portal/RPMS/noarch/ambari-logsearch-portal-2.7.7.0-1.noarch.rpm ../ambari-2.7.7/
cp -r ./ambari-logsearch/ambari-logsearch-assembly/target/rpm/ambari-logsearch-logfeeder/RPMS/noarch/ambari-logsearch-logfeeder-2.7.7.0-1.noarch.rpm ../ambari-2.7.7/

cp -r ./ambari-metrics/ambari-metrics-assembly/target/rpm/ambari-metrics-collector/RPMS/x86_64/
cp -r ./ambari-metrics/ambari-metrics-assembly/target/rpm/ambari-metrics-hadoop-sink/RPMS/x86_64/
cp -r ./ambari-metrics/ambari-metrics-assembly/target/rpm/ambari-metrics-grafana/RPMS/x86_64/
cp -r ./ambari-metrics/ambari-metrics-assembly/target/rpm/ambari-metrics-monitor/RPMS/x86_64/
cp -r ./ambari-metrics/ambari-metrics-common/target/rpm/ambari-metrics-common/RPMS/noarch/

创建yum源

createrepo ./

执行完成后会生成repodata文件夹

注:如果报没有这个命令,安装一下createrepo即可

5.2 压缩ambari安装文件

tar -zcvf ambari-2.7.7.tar.gz ambari-2.7.7/

压缩完成即可
在这里插入图片描述
根据编译生成的ambari-2.7.7.tar.gz包即可以用于安装和部署amabri集群

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/533487.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【代码调试】《Multi-scale Positive Sample Refinement for Few-shot Object Detection》

论文地址&#xff1a;https://arxiv.org/abs/2007.09384#:~:textMulti-Scale%20Positive%20Sample%20Refinement%20for%20Few-Shot%20Object%20Detection.,previous%20attempts%20that%20exploit%20few-shot%20classification%20techniques%20 代码地址&#xff1a;https://git…

什么是低代码开发?低代码开发可以解决哪些问题?

一、什么是低代码开发&#xff1f; 低代码可以理解为是一种全新的应用开发理念。主要以可视化、参数化的系统配置方式来进行程序应用的开发&#xff0c;因此可以大幅度减少代码编写的工作&#xff0c;从而提高开发效率。 低代码平台则是通过对于业务场景进行高度抽象、提炼&a…

复习之Linux中的名词解释

1.什么是Linux? 严格来讲&#xff0c;Linux这个词本身只表示Linux内核&#xff0c;但实际上人们已经习惯了用Linux来形容整个基于Linux内核&#xff0c;并且使用GNU 工程各种工具和数据库的操作系统。因此LinuxLinux内核GNU软件 2.什么是Shell? Shell是系统的用户界面&…

Redis学习---01(Redis安装超详细)

一、Nosql非关系型数据库 (1)小tips: 数据库的发展&#xff1a; 单机时代memcached 缓存Mysql读写分离&#xff08;一部分数据库只写&#xff0c;一些数据库只用来读&#xff09;分库分表 水平拆分Mysql集群 (2) Nosql的特点&#xff1a; 对于数据量大&#xff0c;变化比较…

如何安装Tomcat并在IDEA中配置

下载 1.如果你使用的是Spring框架的6版本请下载Tomcat10版本 Apache Tomcat - Apache Tomcat 10 Software Downloads 2.如果你使用的是Spring框架的6以下请下载Tomcat9版本或以下都行&#xff0c;如果不知道你使用的是什么推荐下载Tomcat9版本使用 Apache Tomcat - Apache …

第三方直播云平台(保利威和阿里云)直播集成demo

第三方直播云平台&#xff08;保利威和阿里云&#xff09;直播集成文档整理。 保利威&#xff1a; 保利威帮助中心 js demo <div id"player"></div> <script src"//player.polyv.net/resp/live-h5-player/latest/liveplayer.min.js">…

通俗易懂的入门正则表达式

背景 其实在使用正则表达式之前&#xff0c;我们在查找文件之类的&#xff0c;已经用过类似正则表达式的符号&#xff0c;例如&#xff1a; // 匹配多个任意字符 ls *.js // 只匹配一个任意字符 ls ?.js这种方法很有用但也是有限的&#xff0c;而正则表达式则更加的完整、强…

Linux - 第14节 - 网络编程套接字(三)

1.Linux远程控制的网络程序 1.1.Linux远程控制的网络程序&#xff08;普通版&#xff09; 创建serverTcp.cc文件&#xff0c;写入下图一所示的代码&#xff0c;创建clientTcp.cc文件&#xff0c;写入下图二所示的代码&#xff0c;创建log.hpp文件&#xff0c;写入下图三所示的…

Dart整理笔记 | Dart参考手册

Dart SDK 安装 如果是使用Flutter 开发&#xff0c;Flutter SDK自带&#xff0c;无需单独安装Dart SDK。 如果需要独立调试运行Dart代码&#xff0c;需要独立安装Dart SDK。 官方文档&#xff1a;https://dart.dev/get-dart windows(推荐): http://www.gekorm.com/dart-wind…

秒级数据写入,毫秒查询响应,天眼查基于 Apache Doris 构建统一实时数仓

导读&#xff1a; 随着天眼查近年来对产品的持续深耕和迭代&#xff0c;用户数量也在不断攀升&#xff0c;业务的突破更加依赖于数据赋能&#xff0c;精细化的用户/客户运营也成为提升体验、促进消费的重要动力。在这样的背景下正式引入 Apache Doris 对数仓架构进行升级改造&a…

浅聊一下Linuxptp

浅聊一下Linuxptp 文章目录 浅聊一下Linuxptp1.什么是Linuxptp2.安装Linuxptp3.源码解析一下1.8个带main函数的源文件1.hwstamp_ctl.c2.nsm.c3.phc2sys.84.phc_ctl.85.pmc.86.ptp4l.c7.timemaster.c8.ts2phc.c 2.clock.c文件 4.自己实践 1.什么是Linuxptp LinuxPTP&#xff08…

HIS系统是什么意思?HIS系统的主要功能有哪些?

HIS系统是什么意思&#xff1f; HIS系统即医院信息系统(全称为Hospital information System) &#xff0c;是指利用计算机软硬件技术和网络通信技术等现代化手段&#xff0c;对医院及其所属各部门的人流、物流、财流进行综合管理&#xff0c;对在医疗活动各阶段产生的数据进行采…

构造函数(包括默认构造函数) ,析构函数的使用与特性

文章目录 一、构造函数二、默认构造函数&#xff08;也是构造函数&#xff09;默认构造函数的种类&#xff1a;1.无参类型2.全缺省类型3.编译器自动生成的4.汇总 三、析构函数 一、构造函数 构造函数是一个特殊的成员函数&#xff0c;名字与类名相同,创建类类型对象时由编译器自…

opencv_c++学习(七)

一、图像颜色空间变换 一、图像颜色空间介绍 RGB颜色模型 具体的体现样式如下&#xff1a; 在opencv中有可以实现数据类型的转换接口&#xff0c;如下&#xff1a; Mat:convertTo (OutputArray m, int rtype, alpha, double 1, double beta)实现如下&#xff1a; a.conve…

Python-字典与集合

学习内容&#xff1a;Python基础入门知识 专栏作者&#xff1a;不渴望力量的哈士奇不渴望力量的哈士奇擅长Python全栈白宝书[更新中],⑤ - 数据库开发实战篇,网安之路,等方面的知识,不渴望力量的哈士奇关注云原生,算法,python,集成测试,去中心化,web安全,智能合约,devops,golan…

如何使用jenkins、ant、selenium、testng搭建自动化测试框架

如果在你的理解中自动化测试就是在eclipse里面讲webdriver的包引入&#xff0c;然后写一些测试脚本&#xff0c;这就是你所说的自动化测试&#xff0c;其实这个还不能算是真正的自动化测试&#xff0c;你见过每次需要运行的时候还需要打开eclipse然后去选择运行文件吗&#xff…

NR RLC(二)相关参数及format

欢迎关注同名微信公众号“modem协议笔记”。 实际查看RLC部分log难免要翻协议&#xff0c;查阅最多的就是相关参数的含义&#xff0c;反而RLC具体过程就没有像当初阅读时那样特别关注了。其实清楚RLC参数含义&#xff0c;看38.322就没那么困难。而RLC具体过程往往要用到相关参…

azkaban --- 案例实操

目录 案例一 &#xff1a; 输出Hello World 案例二 &#xff1a;作业依赖 案例三 &#xff1a;内嵌工作流 案例四 &#xff1a;自动失败 案例五 &#xff1a;手动失败 案例六 &#xff1a;JavaProcess 案例七 &#xff1a;启动服务 案例八 &#xff1a;Hbase 案例九 …

SpringBoot整合企业微信消息推送(四十五)

从头开始&#xff0c;并不意味着失败&#xff0c;相反&#xff0c;正是拥抱成功的第一步&#xff0c;即使还会继续失败 上一章简单介绍了 SpringBoot整合钉钉消息推送(四十四) , 如果没有看过,请观看上一章 一. 企业微信前期准备 用户需要注册一个企业微信&#xff0c; 并且登…

ANR基础 - Input系统

系列文章目录 提示&#xff1a;这里可以添加系列文章的所有文章的目录&#xff0c;目录需要自己手动添加 例如&#xff1a;第一章 Python 机器学习入门之pandas的使用 文章目录 系列文章目录前言一、Input系统概述二、整体框架1.整体框架类图2.核心启动过程2.1 initialize2.1 I…