Ambari-2.7.7源码编译

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集群

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

Linux:文本三剑客之sed编辑器

Linux&#xff1a;sed编辑器 一、sed1.1 sed编辑器1.2 sed编辑器的工作流程1.3 命令格式1.4常用选项1.5 常用操作1.6 实际应用 一、sed 1.1 sed编辑器 sed是一种流编辑器&#xff0c;流编辑器会在编辑器处理数据之前基于预先提供的一组规则来编辑数据流。sed编辑器可以根据命…

FE_Vue学习笔记 常用指令的学习【v-model filters v-text v-html v-cloak v-once v-pre 自定义指令】

1 收集表单数据 v-model 收集表单数据&#xff1a; 若&#xff1a;<input type"text">&#xff0c;则v-model收集的是value的值&#xff0c;用户输入的就是value值。 若&#xff1a;<input type"radio">&#xff0c;则v-modle收集的是value的…

浏览csdn博客自动隐藏侧边栏并只看目录

背景 CSDN 总算做了点好事&#xff0c;能够隐藏大部分无关信息&#xff0c;只看博客内容本身。具体如图&#xff0c;还在测试版 以我的一篇博客为例&#xff0c;原始界面&#xff0c;花里胡哨一堆 点击隐藏侧栏后的清爽版 点击只看目录后的清爽版 前提提要 安装油猴脚本&…

OLS样本估计量抽样分布模拟

OLS样本估计量抽样分布模拟 文章目录 OLS样本估计量抽样分布模拟1 OLS估计量分布2 R语言实现 1 OLS估计量分布 对于线性回归方程 Y β 0 β 1 X ε Y \beta_0\beta_1 X \varepsilon Yβ0​β1​Xε 利用普通最小二乘法(OLS&#xff09;估计上述方程参数使的假定(之一)是…

[译] Flutter 3.10 的新功能

[译] Flutter 3.10 的新功能 原文 https://medium.com/flutter/whats-new-in-flutter-3-10-b21db2c38c73 无缝的Web和移动端集成&#xff0c;Impeller稳定版的突破性图形性能&#xff0c;以及更多 欢迎使用Flutter 3.10&#xff01;我们非常期待展示我们令人惊叹的Flutter社区所…

示波器的数据处理怎么记录?

示波器的使用 - 记录和保存示波器测试结果 安泰测试为您分享如何记录示波器的数据。 "从您把示波器探头连接到器件的那一刻起&#xff0c;信号就开启了一次瞬间即可完成的重大旅程。它必须 跨过五个不同的“模块”&#xff0c;才能完成从器件到示波器&#xff0c;最后返回…

十五、Gateway网关

目录 Zuul网关和gateway网关的区别&#xff1a; Gateway路由配置 1、新建服务网关项目&#xff0c;并在项目pom文件中引入gateway网关依赖 2、在application.yml配置gateway 3、如果不用配置的方式配置gateway路由&#xff0c;还可以通过代码的形式配置 4、启动网关服务&…

Reed-Muller序列

Reed-Muller函数的由来 我们知道对于连续信号&#xff0c;时间和频率是对偶域(duality)&#xff0c;其中正弦函数是时移的特征函数&#xff08;where sinusoids are eigenfunctions of time shifts&#xff09;。而在汉明空间(Hamming space)中&#xff0c;there are discrete…

【软考|软件设计师】某计算机系统的CPU主频为2.8GHz

目录 题&#xff1a; CPI MIPS 题&#xff1a; 某计算机系统的CPU主频为2.8GHz。某应用程序包括3类指令&#xff0c;各类指令的CPI &#xff08;执行每条指令所需要的时钟周期&#xff09;及指令比例如下表所示。执行该应用程序时 的平均CPI为______&#xff1b; 运算速度…

ASP.NET Core 8 中身份验证的改进

ASP.NET Core 团队正在改进 .NET 8 中的身份验证、授权和身份管理(统称为“身份验证”)。新的 APIs 将使自定义用户登录和身份管理体验变得更加容易。新的端点将在没有外部依赖的单页应用程序(SPA)中启用基于令牌的身份验证和授权。我们还将改进我们的指引和文档&#xff0c;使…

基于SSM+JSP的人体健康信息管理系统

末尾获取源码 开发语言&#xff1a;Java Java开发工具&#xff1a;JDK1.8 后端框架&#xff1a;SSM 前端&#xff1a;采用JSP技术开发 数据库&#xff1a;MySQL5.7和Navicat管理工具结合 服务器&#xff1a;Tomcat8.5 开发软件&#xff1a;IDEA / Eclipse 是否Maven项目&#x…

JMeter入门配置

目录 场景&#xff1a; 环境及工具 &#xff1a; JMeter中文配置&#xff1a; 配置登录接口&#xff1a; 配置响应结果&#xff1a; 配置json提取器 测试json提取器 配置Beanshell后置处理器&#xff1a; http请求右键-->添加---->后置处理器--->Beanshell后置处理…

第五章 面向对象-7.hashCode()和toString()

hashCode()和toString() hashCode() hashCoed 的特性&#xff1a; &#xff08;1&#xff09;HashCode的存在主要是用于查找的快捷性&#xff0c;如Hashtable&#xff0c;HashMap等&#xff0c;HashCode经常用于确定对象的存储地址&#xff1b; &#xff08;2&#xff09;如果…

MySQL基础(二十九)数据库的设计规范

1 范式 1.1 范式简介 在关系型数据库中&#xff0c;关于数据表设计的基本原则、规则就称为范式。可以理解为&#xff0c;一张数据表的设计结 构需要满足的某种设计标准的 级别 。要想设计一个结构合理的关系型数据库&#xff0c;必须满足一定的范式。 1.2 范式都包括哪些 目…

医院内导航及智能导医,医院导诊图怎么制作?

在大型综合性医院&#xff0c;由于专业分工精细&#xff0c;一个诊疗过程涉及的功能单元往往分布在不同的楼宇、不同楼层的不同位置&#xff0c;再加上多数患者对医院环境不熟悉&#xff0c;导致滞院的时间长、诊疗效率低、患者对服务的满意度下降。为解决这一问题&#xff0c;…

空中下载技术(OTA)电控信息安全

随着汽车电子控制系统功能复杂度和数据颗粒度呈阶梯式增加&#xff0c;其发展速度逐渐超越网络安全防护方法、技术和标准的发展&#xff0c;现阶段汽车电子正面临巨大的网络信息安全风险&#xff0c;对功能安全的潜在影响也仍在探索和解决中&#xff0c;信息安全问题已经成为影…

C++ 中到底是应该include .h文件还是应该include .cpp文件

在阅读一个较大的解决方案中&#xff0c;对于其他文件夹下的.h和.cpp文件&#xff0c;有时候#include“XXX.h”文件&#xff0c;有时候是#include“XXX.cpp”文件&#xff0c;而且二者还不能更换。下面就好好分析一下他们二者的区别。 测试 测试&#xff1a;XXX.h和XXX.cpp…

Linux内核(十四)Input 子系统详解 IV —— 配对的input设备与input事件处理器 input_register_handle

文章目录 input_handle结构体详解配对的input设备与input事件处理器实例input核心层对驱动层和事件层之间的框架建立流程图 本文章中与input子系统相关的结构体可参考input子系统结构体解析 input函数路径&#xff1a;drivers/input/input.c input_handle结构体详解 input_ha…

(转)雪花算法(SnowFlake)

简介 现在的服务基本是分布式、微服务形式的&#xff0c;而且大数据量也导致分库分表的产生&#xff0c;对于水平分表就需要保证表中 id 的全局唯一性。 对于 MySQL 而言&#xff0c;一个表中的主键 id 一般使用自增的方式&#xff0c;但是如果进行水平分表之后&#xff0c;多…

第八章结构型模式—装饰者模式

文章目录 装饰者模式解决的问题概念结构 案例使用装配者进行改进 使用场景JDK源码分析 静态代理和装饰者的区别 结构型模式描述如何将类或对象按某种布局组成更大的结构&#xff0c;有以下两种&#xff1a; 类结构型模式&#xff1a;采用继承机制来组织接口和类。对象结构型模式…