CentOS7 Ambari2.7.5编译

目录

 

1.前言

2.编译环境安装

3.下载源码编译

4.大包提前下载

5.报错处理

5.1.报错

5.2.报错

5.3.报错

5.4.报错

5.5.报错

5.6.报错

5.7.报错

6.编译成功

7.官方说明


1.前言

本文讲解了在纯净CentOS7环境下,编译Ambari2.7.5所需进行的一系列操作及异常处理。

附参考资料连接:

编译官方说明

https://cwiki.apache.org/confluence/display/AMBARI/Ambari+Development

部署官方说明

https://cwiki.apache.org/confluence/display/AMBARI/Installation+Guide+for+Ambari+2.7.5

git地址:https://github.com/apache/ambari

吐槽啊,此版本对应的HDP3.1.5无法下载,编译后也无法完成全部的部署……

官方说明打开较慢,为了方便大家,文末附官方说明。

 

2.编译环境安装

yum install -y java-1.8.0-openjdk

yum install -y gcc-c++ rpm-build git

下载maven新版3.6.3(笔者实验时yum直接安装的maven是3.0.x,会提示需要3.1.0以上)

http://mirror.bit.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz

tar xzvf apache-maven-3.6.3-bin.tar.gz

 

 

 

#pip安装(官方中说安装setuptools即可,pip比较好装,包含了setuptools)

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

python get-pip.py

 

nodejs环境安装

yum install epel-release

yum install nodejs -y

升级nodejs

sudo npm install n -g

sudo n stable

 

vi ~/.bash_profile

添加

export PATH=/usr/local/bin/:$PATH:/root/apache-maven-3.6.3/bin

 

再执行

source ~/.bash_profile

 

 

安装yarn

curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo

sudo yum install yarn

 

npm install -g bower

npm install -g gulp

 

3.下载源码编译

到http://www.apache.org/dyn/closer.cgi/ambari/ambari-2.7.5

找到镜像服务器下载

https://mirrors.tuna.tsinghua.edu.cn/apache/ambari/ambari-2.7.5/apache-ambari-2.7.5-src.tar.gz

下载后解压

tar xfvz apache-ambari-2.7.5-src.tar.gz
cd apache-ambari-2.7.5-src
mvn versions:set -DnewVersion=2.7.5.0.0


pushd ambari-metrics
mvn versions:set -DnewVersion=2.7.5.0.0
popd

#编译
mvn -B clean install rpm:rpm -DnewVersion=2.7.5.0.0 -DbuildNumber=5895e4ed6b30a2da8a90fee2403b6cab91d19972 -DskipTests -Dpython.ver="python >= 2.6"  apache-rat:check -Drat.numUnapprovedLicenses=600

 

编译过程中失败,继续从该项目编译即可(mvn命令后添加参数如下,后面的ambari-metrics-host-monitoring就是提示的项目名)

mvn …… -rf :ambari-metrics-host-monitoring

 

觉得下载依赖包特别慢的,可以添加阿里云镜像

vi pom.xml

添加相应节点:


    
        aliyun
        https://maven.aliyun.com/repository/public
        
            true
        
        
            true
        
    
    
        aliyun-apache snapshots
        https://maven.aliyun.com/repository/apache-snapshots
        
            true
        
        
            true
        
    
    
        aliyun-central
        https://maven.aliyun.com/repository/central
        
            true
        
        
            true
        
    
    
        aliyun-google
        https://maven.aliyun.com/repository/google
        
            true
        
        
            true
        
    
    
        aliyun-gradle-plugin
        https://maven.aliyun.com/repository/gradle-plugin
        
            true
        
        
            true
        
    
    
        aliyun-jcenter
        https://maven.aliyun.com/repository/jcenter
        
            true
        
        
            true
        
    
    
        aliyun-spring
        https://maven.aliyun.com/repository/spring
        
            true
        
        
            true
        
    
    
        aliyun-spring-plugin
        https://maven.aliyun.com/repository/spring-plugin
        
            true
        
        
            true
        
    
    
        aliyun-public
        https://maven.aliyun.com/repository/public
        
            true
        
        
            true
        
    
    
        aliyun-releases
        https://maven.aliyun.com/repository/releases
        
            true
        
        
            true
        
    
    
        aliyun-snapshots
        https://maven.aliyun.com/repository/snapshots
        
            true
        
        
            true
        
    
    
        aliyun-grails-core
        https://maven.aliyun.com/repository/grails-core
        
            true
        
        
            true
        
    
    
        aliyun-mapr-public
        https://maven.aliyun.com/repository/mapr-public
        
            true
        
        
            true
        
    


    
        aliyun-plugin
        https://maven.aliyun.com/repository/public
        
            true
        
        
            true
        
    
    
        aliyun-plugin-apache snapshots
        https://maven.aliyun.com/repository/apache-snapshots
        
            true
        
        
            true
        
    
    
        aliyun-plugin-central
        https://maven.aliyun.com/repository/central
        
            true
        
        
            true
        
    
    
        aliyun-plugin-google
        https://maven.aliyun.com/repository/google
        
            true
        
        
            true
        
    
    
        aliyun-plugin-gradle-plugin
        https://maven.aliyun.com/repository/gradle-plugin
        
            true
        
        
            true
        
    
    
        aliyun-plugin-jcenter
        https://maven.aliyun.com/repository/jcenter
        
            true
        
        
            true
        
    
    
        aliyun-plugin-spring
        https://maven.aliyun.com/repository/spring
        
            true
        
        
            true
        
    
    
        aliyun-plugin-spring-plugin
        https://maven.aliyun.com/repository/spring-plugin
        
            true
        
        
            true
        
    
    
        aliyun-plugin-public
        https://maven.aliyun.com/repository/public
        
            true
        
        
            true
        
    
    
        aliyun-plugin-releases
        https://maven.aliyun.com/repository/releases
        
            true
        
        
            true
        
    
    
        aliyun-plugin-snapshots
        https://maven.aliyun.com/repository/snapshots
        
            true
        
        
            true
        
    
    
        aliyun-plugin-grails-core
        https://maven.aliyun.com/repository/grails-core
        
            true
        
        
            true
        
    
    
        aliyun-plugin-mapr-public
        https://maven.aliyun.com/repository/mapr-public
        
            true
        
        
            true
        
    

 

4.大包提前下载

hadoop等包

下载很慢,可以提前下载

vi ambari-metrics/pom.xml

找到

https://s3.amazonaws.com/dev.hortonworks.com/HDP/centos7/3.x/BUILDS/3.1.4.0-315/tars/hbase/hbase-2.0.2.3.1.4.0-315-bin.tar.gz

hbase-2.0.2.3.1.4.0-315

https://s3.amazonaws.com/dev.hortonworks.com/HDP/centos7/3.x/BUILDS/3.1.4.0-315/tars/hadoop/hadoop-3.1.1.3.1.4.0-315.tar.gz

hadoop-3.1.1.3.1.4.0-315

grafana-6.4.2

https://dl.grafana.com/oss/release/grafana-6.4.2.linux-amd64.tar.gz

https://s3.amazonaws.com/dev.hortonworks.com/HDP/centos7/3.x/BUILDS/3.1.4.0-315/tars/phoenix/phoenix-5.0.0.3.1.4.0-315.tar.gz

phoenix-5.0.0.3.1.4.0-315

这一段,用下载工具下载下来(PS:迅雷可以直接镜像加速),在部署到自己本地的web服务器上,再修改这个pom.xml中的url地址,下载使用更快捷

 

5.报错处理

5.1.报错

[INFO] Downloading https://nodejs.org/dist/v4.5.0/node-v4.5.0-linux-x64.tar.gz to /root/.m2/repository/com/github/eirslett/node/4.5.0/node-4.5.0-linux-x64.tar.gz

[INFO] No proxies configured

[INFO] No proxy was configured, downloading directly

[INFO] Unpacking /root/.m2/repository/com/github/eirslett/node/4.5.0/node-4.5.0-linux-x64.tar.gz into /root/apache-ambari-2.7.5-src/ambari-web/node/tmp

……

[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.4:install-node-and-yarn (install node and yarn) on project ambari-web: Could not extract the Node archive: Could not extract archive: '/root/.m2/repository/com/github/eirslett/node/4.5.0/node-4.5.0-linux-x64.tar.gz': EOFException -> [Help 1]

解决

手动下载

curl -o /root/.m2/repository/com/github/eirslett/node/4.5.0/node-4.5.0-linux-x64.tar.gz https://nodejs.org/dist/v4.5.0/node-v4.5.0-linux-x64.tar.gz

 

5.2.报错

[ERROR] warning [email protected]: The platform "linux" is incompatible with this module.

解决

npm install pm2@latest -g

pm2 install pm2-slack

(执行后上面的错误也还存在,但是可以往下走,这里发现了需要安装bower,安装这个即可)

安装bower的依赖包(个人在ambari-admin/src/main/resources/ui/admin-web/下执行)

bower install --allow-root

 

5.3.报错

Failed to execute goal org.apache.rat:apache-rat-plugin:0.12:check (default) on project ambari: Too many files with unapproved license: 1 See RAT report in: /root/apache-ambari-2.7.5-src/target/rat.txt -> [Help 1]

 

解决(采用方案二)

一种方案是在新建的每一个类的第一行添加

 

/**

* 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.

*/

第二种解决方案:

在mvn命令中添加参数

apache-rat:check -Drat.numUnapprovedLicenses=600

数字600是一个大于报错信息中的数量。

 

 

5.4.报错

ClassNotFoundException : Com.Sun.Jersey.Spi.Container.Servlet.ServletContainer

解决

vi ambari-metrics/ambari-metrics-timelineservice/pom.xml

添加依赖(注意version与其他一致即可)

com.sun.jersey

jersey-bundle

1.11

 

5.5.报错

[exec] psutil/_psutil_linux.c:12:20: 致命错误:Python.h:没有那个文件或目录

[exec] #include

[exec] ^

[exec] 编译中断。

[exec] error: command 'gcc' failed with exit status 1

 

解决

yum install -y python-devel

 

5.6.报错

/root/apache-ambari-2.7.5-src/ambari-metrics/ambari-metrics-host-aggregator/src/test/java/org/apache/hadoop/metrics2/host/aggregator/AggregatorWebServiceTest.java:[22,33] 程序包com.sun.jersey.api.client不存在

 

解决

vi ambari-metrics/ambari-metrics-host-aggregator/pom.xml

添加依赖

com.sun.jersey

jersey-client

1.11

5.7.报错

[ERROR] /root/apache-ambari-2.7.5-src/ambari-metrics/ambari-metrics-host-aggregator/src/test/java/org/apache/hadoop/metrics2/host/aggregator/AggregatorWebServiceTest.java:[31,34] 程序包org.codehaus.jackson.jaxrs不存在

[ERROR] /root/apache-ambari-2.7.5-src/ambari-metrics/ambari-metrics-host-aggregator/src/test/java/org/apache/hadoop/metrics2/host/aggregator/AggregatorWebServiceTest.java:[49,55] 找不到符号

符号: 类 JacksonJaxbJsonProvider

位置: 类 org.apache.hadoop.metrics2.host.aggregator.AggregatorWebServiceTest

解决

vi ambari-metrics/ambari-metrics-host-aggregator/pom.xml

添加依赖

org.codehaus.jackson

jackson-jaxrs

1.9.13

注意要看清是codehaus的,不是fasterxml的,别添加错了

 

6.编译成功

[INFO] Rat check: Summary over all files. Unapproved: 0, unknown: 0, generated: 0, approved: 17 licenses.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Ambari Main 2.7.5.0.0 .............................. SUCCESS [  5.378 s]
[INFO] Apache Ambari Project POM 2.7.5.0.0 ................ SUCCESS [  0.170 s]
[INFO] Ambari Web 2.7.5.0.0 ............................... SUCCESS [01:00 min]
[INFO] Ambari Views 2.7.5.0.0 ............................. SUCCESS [  1.265 s]
[INFO] Ambari Admin View 2.7.5.0.0 ........................ SUCCESS [ 26.880 s]
[INFO] ambari-utility 1.0.0.0-SNAPSHOT .................... SUCCESS [ 15.939 s]
[INFO] ambari-metrics 2.7.5.0.0 ........................... SUCCESS [  0.626 s]
[INFO] Ambari Metrics Common 2.7.5.0.0 .................... SUCCESS [  4.607 s]
[INFO] Ambari Metrics Hadoop Sink 2.7.5.0.0 ............... SUCCESS [  2.358 s]
[INFO] Ambari Metrics Flume Sink 2.7.5.0.0 ................ SUCCESS [  1.527 s]
[INFO] Ambari Metrics Kafka Sink 2.7.5.0.0 ................ SUCCESS [  1.630 s]
[INFO] Ambari Metrics Storm Sink 2.7.5.0.0 ................ SUCCESS [  1.693 s]
[INFO] Ambari Metrics Storm Sink (Legacy) 2.7.5.0.0 ....... SUCCESS [  1.743 s]
[INFO] Ambari Metrics Collector 2.7.5.0.0 ................. SUCCESS [02:56 min]
[INFO] Ambari Metrics Monitor 2.7.5.0.0 ................... SUCCESS [  2.459 s]
[INFO] Ambari Metrics Grafana 2.7.5.0.0 ................... SUCCESS [  1.618 s]
[INFO] Ambari Metrics Host Aggregator 2.7.5.0.0 ........... SUCCESS [  5.608 s]
[INFO] Ambari Metrics Assembly 2.7.5.0.0 .................. SUCCESS [01:00 min]
[INFO] Ambari Service Advisor 1.0.0.0-SNAPSHOT ............ SUCCESS [  0.531 s]
[INFO] Ambari Server 2.7.5.0.0 ............................ SUCCESS [03:25 min]
[INFO] Ambari Functional Tests 2.7.5.0.0 .................. SUCCESS [  0.550 s]
[INFO] Ambari Agent 2.7.5.0.0 ............................. SUCCESS [ 51.679 s]
[INFO] ambari-logsearch 2.7.5.0.0 ......................... SUCCESS [  1.299 s]
[INFO] Ambari Logsearch Appender 2.7.5.0.0 ................ SUCCESS [  0.262 s]
[INFO] Ambari Logsearch Config Api 2.7.5.0.0 .............. SUCCESS [  0.239 s]
[INFO] Ambari Logsearch Config JSON 2.7.5.0.0 ............. SUCCESS [  0.196 s]
[INFO] Ambari Logsearch Config Solr 2.7.5.0.0 ............. SUCCESS [  0.199 s]
[INFO] Ambari Logsearch Config Zookeeper 2.7.5.0.0 ........ SUCCESS [  0.185 s]
[INFO] Ambari Logsearch Config Local 2.7.5.0.0 ............ SUCCESS [  0.182 s]
[INFO] Ambari Logsearch Log Feeder Plugin Api 2.7.5.0.0 ... SUCCESS [  0.179 s]
[INFO] Ambari Logsearch Log Feeder Container Registry 2.7.5.0.0 SUCCESS [  0.346 s]
[INFO] Ambari Logsearch Log Feeder 2.7.5.0.0 .............. SUCCESS [  3.645 s]
[INFO] Ambari Logsearch Web 2.7.5.0.0 ..................... SUCCESS [ 55.186 s]
[INFO] Ambari Logsearch Server 2.7.5.0.0 .................. SUCCESS [  5.825 s]
[INFO] Ambari Logsearch Assembly 2.7.5.0.0 ................ SUCCESS [  0.176 s]
[INFO] Ambari Logsearch Integration Test 2.7.5.0.0 ........ SUCCESS [  0.887 s]
[INFO] ambari-infra 2.7.5.0.0 ............................. SUCCESS [  0.166 s]
[INFO] Ambari Infra Solr Client 2.7.5.0.0 ................. SUCCESS [01:03 min]
[INFO] Ambari Infra Solr Plugin 2.7.5.0.0 ................. SUCCESS [  0.490 s]
[INFO] Ambari Infra Manager 2.7.5.0.0 ..................... SUCCESS [  5.827 s]
[INFO] Ambari Infra Assembly 2.7.5.0.0 .................... SUCCESS [  0.165 s]
[INFO] Ambari Infra Manager Integration Tests 2.7.5.0.0 ... SUCCESS [  1.310 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  12:51 min
[INFO] Finished at: 2020-03-11T17:11:54+08:00
[INFO] ------------------------------------------------------------------------

成功

一系列漫长的折磨,断断续续两三天,终于成功了!

总结教训:

1.用阿里云镜像,能加速很多

2.关注几个常用的编译工具,问题出现在这些点上的时候要想到是不是他没安装的问题。

感慨啊

这么牛的开源项目还缺少maven依赖包配置,也是醉了……

 

 

 

7.官方说明

Build and install Ambari 2.7.5

 

Refer Ambari Development for prerequisites and additional information on how to build Apache Ambari.

 

Step 1: Download and build Ambari 2.7.5 source

Go to http://www.apache.org/dyn/closer.cgi/ambari/ambari-2.7.5 and find the suggested mirror for download. The process to verify the download is described is at http://www.apache.org/dyn/closer.cgi#verify

wget https://www-eu.apache.org/dist/ambari/ambari-2.7.5/apache-ambari-2.7.5-src.tar.gz (use the suggested mirror from above) tar xfvz apache-ambari-2.7.5-src.tar.gz cd apache-ambari-2.7.5-src mvn versions:set -DnewVersion=2.7.5.0.0 pushd ambari-metrics mvn versions:set -DnewVersion=2.7.5.0.0 popd

 

RHEL (CentOS 7) & SUSE (SLES 12 SP2 & SP3):

mvn -B clean install rpm:rpm -DnewVersion=2.7.5.0.0 -DbuildNumber=5895e4ed6b30a2da8a90fee2403b6cab91d19972 -DskipTests -Dpython.ver="python >= 2.6"

 

Ubuntu/Debian:

mvn -B clean install jdeb:jdeb -DnewVersion=2.7.5.0.0 -DbuildNumber=5895e4ed6b30a2da8a90fee2403b6cab91d19972 -DskipTests -Dpython.ver="python >= 2.6"

 

Note: You need to have tools such as rpm-build tool, brunch, etc.  For details on prerequisites, please see Ambari Development.

Step 2: Install Ambari Server

Install the rpm package from ambari-server/target/rpm/ambari-server/RPMS/noarch/

[For CentOS 7]

yum install ambari-server*.rpm    #This should also pull in postgres packages as well.

[For SLES 12]

zypper install ambari-server*.rpm    #This should also pull in postgres packages as well.

[For Ubuntu/Debian]

apt-get install ./ambari-server*.deb   #This should also pull in postgres packages as well.

Step 3: Setup and Start Ambari Server

Run the setup command to configure your Ambari Server, Database, JDK, LDAP, and other options:

ambari-server setup

Follow the on-screen instructions to proceed.

Once set up is done, start Ambari Server:

ambari-server start

Step 4: Install and Start Ambari Agent on All Hosts

Note: This step needs to be run on all hosts that will be managed by Ambari.

Copy the rpm package from ambari-agent/target/rpm/ambari-agent/RPMS/x86_64/ and run:

[For CentOS 7]

yum install ambari-agent*.rpm

[For SLES 12]

zypper install ambari-agent*.rpm

[Ubuntu/Debian]

apt-get install ./ambari-agent*.deb

Edit /etc/ambari-agent/ambari.ini

... [server] hostname=localhost ...

Make sure hostname under the [server] section points to the actual Ambari Server host, rather than "localhost".

ambari-agent start

Step 5: Deploy Cluster using Ambari Web UI

Open up a web browser and go to http://:8080.

Log in with username admin and password admin and follow on-screen instructions. Secure your environment by ensuring your administrator details are changed from the default values as soon as possible.

Under Install Options page, enter the hosts to add to the cluster.  Do not supply any SSH key, and check "Perform manual registration on hosts and do not use SSH" and hit "Next".

 

Ambari Development

转至元数据结尾

  • 由 Mahadev Konar创建, 最终由 Jonathan Hurley修改于 十一月 30, 2018

转至元数据起始

Checking out Ambari source

Follow the instructions under Checkout source code section of "How to contribute" guide.

We'll refer to the top-level "ambari" directory as AMBARI_DIR in this document.

Tools needed to build Ambari

The following tools are needed to build Ambari from source.

Alternatively, you can easily launch a VM that is preconfigured with all the tools that you need.  See the Pre-Configured Development Environment section in the Quick Start Guide.

  • xCode (if using Mac - free download from the apple store)
  • JDK 8 (Ambari 2.6 and below can be compiled with JDK 7, from Ambari 2.7, it can be compiled with at least JDK 8)
  • Apache Maven 3.3.9 or later

Tip: In order to persist your changes to the JAVA_HOME environment variable and add Maven to your path, create the following files:

File: ~/.profile

 

source ~/.bashrc

File: ~/.bashrc

 

export PATH=/usr/local/apache-maven-3.3.9/bin:$PATH

export JAVA_HOME=$(/usr/libexec/java_home)

export _JAVA_OPTIONS="-Xmx2048m -XX:MaxPermSize=512m -Djava.awt.headless=true"

  • Python 2.6 (Ambari 2.7 or later require Python 2.7 as minimum supported version)
  • Python setuptools:

for Python 2.6: Download setuptools and run:

sh setuptools-0.6c11-py2.6.egg

for Python 2.7:  Download setuptools and run:

sh setuptools-0.6c11-py2.7.egg

  • rpmbuild (rpm-build package)
  • g++ (gcc-c++ package)

Running Unit Tests

  • mvn clean test
  • Run unit tests in a single module:

mvn -pl ambari-server test

  • Run only Java tests:

mvn -pl ambari-server -DskipPythonTests

  • Run only specific Java tests:

mvn -pl ambari-server -DskipPythonTests -Dtest=AgentHostInfoTest test

  • Run only Python tests:

mvn -pl ambari-server -DskipSurefireTests test

  • Run only specific Python tests:

mvn -pl ambari-server -DskipSurefireTests -Dpython.test.mask=TestUtils.py test

  • Run only Checkstyle and RAT checks:

mvn -pl ambari-server -DskipTests test

NOTE: Please make sure you have npm in the path before running the unit tests.

Generating Findbugs Report

  • mvn clean install

This will generate xml and html report unders target/findbugs. You can also add flags to skip unit tests to generate report faster.

Building Ambari

Note: if you can an error that too many files are open while building, then run: ulimit -n 10000 (for example)

To build Ambari RPMs, run the following.

Note: Replace ${AMBARI_VERSION} with a 4-digit version you want the artifacts to be (e.g., -DnewVersion=1.6.1.1)

Note: If running into errors while compiling the ambari-metrics package due to missing the artifacts of jms, jmxri, jmxtools:

 

[ERROR] Failed to execute goal on project ambari-metrics-kafka-sink: Could not resolve dependencies for project org.apache.ambari:ambari-metrics-kafka-sink:jar:2.0.0-0: The following artifacts could not be resolved: javax.jms:jms:jar:1.1, com.sun.jdmk:jmxtools:jar:1.2.1, com.sun.jmx:jmxri:jar:1.2.1: Could not transfer artifact javax.jms:jms:jar:1.1 from/to java.net (https://maven-repository.dev.java.net/nonav/repository): No connector available to access repository java.net (https://maven-repository.dev.java.net/nonav/repository) of type legacy using the available factories WagonRepositoryConnectorFactory

The work around is to manually install the three missing artifacts:

 

mvn install:install-file -Dfile=jms-1.1.pom -DgroupId=javax.jms -DartifactId=jms -Dversion=1.1 -Dpackaging=jar

mvn install:install-file -Dfile=jmxtools-1.2.1.pom -DgroupId=com.sun.jdmk -DartifactId=jmxtools -Dversion=1.2.1 -Dpackaging=jar

mvn install:install-file -Dfile=jmxri-1.2.1.pom -DgroupId=com.sun.jmx -DartifactId=jmxri -Dversion=1.2.1 -Dpackaging=jar

 

If when compiling it seems stuck, and you've already increased Java and Maven heapsize, it could be that Ambari Views has a lot of artifacts, and the rat-check is choking up. In this case, try running

git clean -df (this will remove untracked files and directories)

mvn clean package -DskipTests -Drat.ignoreErrors=true

or

mvn clean package -DskipTests -Drat.skip

 

Setting the Version Using Maven

Ambari 2.8+ uses a newer method to update the version when building Ambari. 

RHEL/CentOS 6:

# Update the revision property to the release version

mvn versions:set-property -Dproperty=revision -DnewVersion=2.8.0.0.0

 

mvn -B clean install package rpm:rpm -DskipTests -Dpython.ver="python >= 2.6" -Preplaceurl

 

SUSE/SLES 11

# Update the revision property to the release version

mvn versions:set-property -Dproperty=revision -DnewVersion=2.8.0.0.0

  

mvn -B clean install package rpm:rpm -DskipTests -Psuse11 -Dpython.ver="python >= 2.6" -Preplaceurl

 

Ubuntu 12:

# Update the revision property to the release version

mvn versions:set-property -Dproperty=revision -DnewVersion=2.8.0.0.0

  

mvn -B clean install package jdeb:jdeb -DskipTests -Dpython.ver="python >= 2.6" -Preplaceurl

 

Ambari 2.7 and Earlier Releases (Deprecated)

RHEL/CentOS 6: 展开源码

 

SUSE/SLES 11 展开源码

 

Ubuntu 12: 展开源码

 

Ambari Server will create following packages

  • RPM will be created under AMBARI_DIR/ambari-server/target/rpm/ambari-server/RPMS/noarch.
  • DEB will be created under AMBARI_DIR/ambari-server/target/

Ambari Agent will create following packages

  • RPM will be created under AMBARI_DIR/ambari-agent/target/rpm/ambari-agent/RPMS/x86_64.
  • DEB will be created under AMBARI_DIR/ambari-agent/target

Optional parameters:

  • -X -e: add these options for more verbose output by Maven.  Useful when debugging Maven issues.
  • -DdefaultStackVersion=STACK-VERSION
  • Sets the default stack and version to be used for installation (e.g., -DdefaultStackVersion=HDP-1.3.0)
  • -DenableExperimental=true
  • Enables experimental features to be available via Ambari Web (default is false)
  • All views can be packaged in RPM by adding -Dviews parameter
    • mvn -B clean install package rpm:rpm -Dviews -DskipTests
  • Specific views can be built by adding --projects parameter to the -Dviews
    • mvn -B clean install package rpm:rpm --projects ambari-web,ambari-project,ambari-views,ambari-admin,contrib/views/files,contrib/views/pig,ambari-server,ambari-agent,ambari-client,ambari-shell -Dviews -DskipTests

 

NOTE: Run everything as root below.

Building Ambari Metrics

If you plan on installing the Ambari Metrics service, you will also need to build the Ambari Metrics project. 

cd ambari-metrics

mvn clean package -Dbuild-rpm -DskipTests

 

For Ubuntu:

cd ambari-metrics

mvn clean package -Dbuild-deb -DskipTests

Note:

The metrics rpms will be found at: ambari-metrics-assembly/target/. These would be need for installing the Ambari Metrics service.

Running the Ambari Server

First, install the Ambari Server RPM.

On RHEL/CentOS:

yum install ambari-server/target/rpm/ambari-server/RPMS/noarch/ambari-server-*.noarch.rpm

On SUSE/SLES:

zypper install ambari-server/target/rpm/ambari-server/RPMS/noarch/ambari-server-*.noarch.rpm

On Ubuntu 12:

  

dpkg --install ambari-server/target/ambari-server-*.deb          # Will fail with missing dependencies errors

apt-get update                                                   # Update locations of dependencies

apt-get install -f                                               # Install all failed dependencies

dpkg --install ambari-server/target/ambari-server-*.deb          # Will succeed

Initialize Ambari Server:

ambari-server setup

Start up Ambari Server:

ambari-server start

See Ambari Server log:

tail -f /var/log/ambari-server/ambari-server.log

To access Ambari, go to

http://{ambari-server-hostname}:8080

from your web browser and log in with username admin and password admin.

Install and Start the Ambari Agent Manually on Each Host in the Cluster

Install the Ambari Agent RPM.

On RHEL/CentOS:

yum install ambari-agent/target/rpm/ambari-agent/RPMS/x86_64/ambari-agent-*.rpm

SUSE/SLES:

zypper install ambari-agent/target/rpm/ambari-agent/RPMS/x86_64/ambari-agent-*.rpm

Ubuntu12:

dpkg --install ambari-agent/target/ambari-agent-*.deb

Edit the location of Ambari Server in /etc/ambari-agent/conf/ambari-agent.ini by editing the hostname line.

Start Ambari Agent:

ambari-agent start

See Ambari Agent log:

tail -f /var/log/ambari-agent/ambari-agent.log

Setting up Ambari in Eclipse

$ mvn clean eclipse:eclipse

After doing the above you should be able to import the project via Eclipse "Import > Maven > Existing Maven Project". Choose the root directory where you cloned the git repository. You should be able to see the following projects on eclipse:

ambari

|

|- ambari-project

|- ambari-server

|- ambari-agent

|- ambari-web

Select the top-level "ambari pom.xml" and click Finish.

Coding Guidelines for Ambari

你可能感兴趣的:(hadoop相关,hadoop,ambari)