Ambari 2.7.3源码编译
1、安装JDK
[root@bigdata-test ambari-src]# java -version
java version “1.8.0_151”
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)
2、安装maven
[root@bigdata-test ambari-src]# mvn -v
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)
Maven home: /opt/soft/maven
Java version: 1.8.0_151, vendor: Oracle Corporation
Java home: /opt/soft/jdk/jre
Default locale: en_US, platform encoding: UTF-8
OS name: “linux”, version: “3.10.0.514.26.2.el7.x86_64”, arch: “amd64”, family: “unix”
3、下载 python2.7 设置工具
wget https://pypi.python.org/packages/2.7/s/setuptools/setuptools-… –no-check-certificate
运行命令
sh setuptools-0.6c11-py2.7.egg
4、下载node
wget https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-x64.tar.xz –no-check-certificate
添加下面两行:
export NODEJS=///node-v10.16.0-linux-x64 #解压NodeJS的路径
export PATH=:$NODEJS/bin:$PATH
node -v
npm -v
5、使用 npm 安装 Brunch
npm install -g brunch
brunch -v
npm install -g bower
6、修改/etc/profile,设置JVM参数
export _JAVA_OPTIONS=”-Xmx2048m -XX:MaxPermSize=512m -Djava.awt.headless=true”
cd apache-ambari-2.7.3-src
mvn versions:set -DnewVersion=2.7.3.0.0
pushd ambari-metrics
mvn versions:set -DnewVersion=2.7.3.0.0
popd
编译命令 : mvn -B clean install rpm:rpm -DnewVersion=2.7.3.0.0 -DskipTests -Dpython.ver=”python >= 2.6″ -Drat.skip=true -Dcheckstyle.skip -X
如果要单独编译某一个模块:
mvn -B clean install package rpm:rpm -DnewVersion=2.7.3.0.0 -DskipTests -Dpython.ver="python >= 2.6" -Drat.skip=true -Dcheckstyle.skip --rf :ambari-web
7、编译中遇到的问题
1、问题1
[DEBUG] Toolchains are ignored, 'executable' parameter is set to /root/ambari-src/ambari-2.7.3/ambari-web/node/node
[DEBUG] Executing command line: /root/ambari-src/ambari-2.7.3/ambari-web/node/node node_modules/brunch/bin/brunch build
或者
[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
}
个人将ambari-admin(包括子目录ambari-admin/src/main/resources/ui/admin-web)里面生成的node、node_modules删除,保持干净的源码环境,再单独编译ambari-admin
find ~/.m2/repository/ -name “*.lastUpdated” -exec rm -rf {} ;
mvn -B clean install rpm:rpm -DnewVersion=2.7.3.0.0 -DskipTests -Dpython.ver=”python >= 2.6″ -Drat.skip=true -X -rf :ambari-admin
其次解决方式
如果还报错,则在ambari-admin/src/main/resources/ui/admin-web/下执行
npm install -g brunch
bower install –allow-root
npm install
ambari-admin下 vim pom.xml
Before
v4.5.0
2.15.0
src/main/resources/ui/admin-web/
false
After 修改为你的node和npm版本,如果不知道,可以根据
node -v
npm -v
进行查看
v11.10.0
6.7.0
src/main/resources/ui/admin-web/
false
find ~/.m2/repository/ -name “*.lastUpdated” -exec rm -rf {} ;
mvn -B clean install rpm:rpm -DnewVersion=2.7.3.0.0 -DskipTests -Dpython.ver=”python >= 2.6″ -Drat.skip=true -X -rf :ambari-admin
2、问题2
Could not resolve dependencies for project org.apache.ambari:ambari-metrics-timelineservice:jar:2.7.3.0.0: Failed to collect dependencies at org.apache.phoenix:phoenix-core:jar:5.0.0.3.0.0.0-1634 -> org.apache.hbase:hbase-annotations:jar:2.0.0.3.0.0.0-1634
find ~/.m2/repository/ -name “*.lastUpdated” -exec rm -rf {} ;
mvn -B install package rpm:rpm -DnewVersion=2.7.3.0.0 -DskipTests -Dpython.ver=”python >= 2.6″ -Drat.skip=true –rf :ambari-metrics-assembly
3、问题3
Connect to nexus-private.hortonworks.com:80 [nexus-private.hortonworks.com/54.173.242.72] failed: 连接超时 (Connection timed out)
ping nexus-private.hortonworks.com,发现这个私有仓库地址访问不上去。Ambari配置的仓库为nexus-private.hortonworks.com,但该地址无法访问。
解决方案:个人是进入目录ambari-metrics,编辑pom.xml替换如下
使用迅雷下载以下包
换成
包到本地,然后在服务器上安装httpd
centos6
yum install httpd -y
/etc/init.d/httpd start
centos7
yum install httpd -y
systemctl start httpd
将迅雷下载的包,放入到/var/www/html 建立相应的hbase、hadoop、grafana、phoenix相应的目录,将tar.gz包放入进去,如下图所示
4、问题4
Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (default) on project ambari-infra-solr-client: An Ant BuildException has occured: The following error occurred while executing this line:
/opt/apache-ambari-2.7.3-src/ambari-infra/ambari-infra-solr-client/build.xml:39: java.net.UnknownHostException: central.maven.org
进入 /root/ambari-src/ambari-2.7.3/ambari-infra/ambari-infra-solr-client/pom.xml
在ambari-infra模块中有些pom.xml写的路径central.maven.org无法访问了,需要更换为https://repo1.maven.org
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net